nux-0.9.48
|
00001 /* 00002 * Copyright 2010 Inalogic® Inc. 00003 * 00004 * This program is free software: you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License, as 00006 * published by the Free Software Foundation; either version 2.1 or 3.0 00007 * of the License. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranties of 00011 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 00012 * PURPOSE. See the applicable version of the GNU Lesser General Public 00013 * License for more details. 00014 * 00015 * You should have received a copy of both the GNU Lesser General Public 00016 * License along with this program. If not, see <http://www.gnu.org/licenses/> 00017 * 00018 * Authored by: Jay Taoko <jaytaoko@inalogic.com> 00019 * 00020 */ 00021 00022 00023 #ifndef IOPENGLCUBETEXTURE_H 00024 #define IOPENGLCUBETEXTURE_H 00025 00026 namespace nux 00027 { 00028 00029 class IOpenGLBaseTexture; 00030 class IOpenGLCubeTexture: public IOpenGLBaseTexture 00031 { 00032 NUX_DECLARE_OBJECT_TYPE (IOpenGLCubeTexture, IOpenGLBaseTexture); 00033 00034 public: 00035 virtual ~IOpenGLCubeTexture(); 00036 00037 int GetCubeMapSurface ( 00038 eCUBEMAP_FACES FaceType, 00039 int Level, 00040 IOpenGLSurface **ppCubeMapSurface 00041 ); 00042 00043 int LockRect ( 00044 eCUBEMAP_FACES FaceType, 00045 int Level, 00046 SURFACE_LOCKED_RECT *pLockedRect, 00047 const SURFACE_RECT *pRect); 00048 00049 int UnlockRect ( 00050 eCUBEMAP_FACES FaceType, 00051 int Level 00052 ); 00053 00054 unsigned int EnableGammaCorrection (bool b); 00055 00056 int GetLevelDesc ( 00057 int Level, 00058 SURFACE_DESC *pDesc 00059 ) 00060 { 00061 nuxAssert (Level >= 0 ); 00062 nuxAssert (Level < _NumMipLevel); 00063 00064 if ( (Level < 0) || (Level > _NumMipLevel) ) 00065 { 00066 pDesc->Width = 0; 00067 pDesc->Height = 0; 00068 pDesc->PixelFormat = BITFMT_UNKNOWN; 00069 pDesc->Type = _ResourceType; 00070 } 00071 else 00072 { 00073 pDesc->Width = Max<unsigned int> (1, _Width >> Level); 00074 pDesc->Height = Max<unsigned int> (1, _Height >> Level); 00075 pDesc->PixelFormat = _PixelFormat; 00076 pDesc->Type = _ResourceType; 00077 } 00078 00079 return OGL_OK; 00080 } 00081 private: 00082 00083 IOpenGLCubeTexture ( 00084 unsigned int EdgeLength 00085 , int Levels 00086 , BitmapFormat PixelFormat); 00087 00088 // unsigned int _Width; 00089 // unsigned int _Height; 00090 std::map<eCUBEMAP_FACES, std::vector<IOpenGLSurface *>* > _SurfaceArray; 00091 00092 friend class GpuDevice; 00093 friend class IOpenGLSurface; 00094 }; 00095 00096 } 00097 #endif // IOPENGLCUBETEXTURE_H