nux-1.14.0
|
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 IOPENGLVOLUMETEXTURE_H 00024 #define IOPENGLVOLUMETEXTURE_H 00025 00026 namespace nux 00027 { 00028 00029 class IOpenGLBaseTexture; 00030 class IOpenGLVolumeTexture: public IOpenGLBaseTexture 00031 { 00032 NUX_DECLARE_OBJECT_TYPE (IOpenGLVolumeTexture, IOpenGLBaseTexture); 00033 00034 public: 00035 virtual ~IOpenGLVolumeTexture(); 00036 00037 int GetVolumeLevel ( 00038 int Level, 00039 IOpenGLVolume **ppVolumeLevel 00040 ); 00041 00042 int LockRect ( 00043 int Slice, 00044 int Level, 00045 SURFACE_LOCKED_RECT *pLockedRect, 00046 const SURFACE_RECT *pRect); 00047 00048 int UnlockRect ( 00049 int Slice, 00050 int Level 00051 ); 00052 00053 int LockBox ( 00054 int Level, 00055 VOLUME_LOCKED_BOX *pLockedVolume, 00056 const VOLUME_BOX *pBox); 00057 00058 int UnlockBox ( 00059 int Level 00060 ); 00061 00062 int GetLevelDepth (int MipLevel) const 00063 { 00064 return ImageSurface::GetLevelDim (_PixelFormat, _Depth, MipLevel); 00065 } 00066 00067 int GetLevelDesc ( 00068 int Level, 00069 VOLUME_DESC *pDesc 00070 ) 00071 { 00072 nuxAssert (Level >= 0 ); 00073 nuxAssert (Level < _NumMipLevel); 00074 00075 if ( (Level < 0) || (Level > _NumMipLevel) ) 00076 { 00077 pDesc->Width = 0; 00078 pDesc->Height = 0; 00079 pDesc->Depth = 0; 00080 pDesc->PixelFormat = BITFMT_UNKNOWN; 00081 pDesc->Type = _ResourceType; 00082 } 00083 else 00084 { 00085 pDesc->Width = Max<int> (1, _Width >> Level); 00086 pDesc->Height = Max<int> (1, _Height >> Level); 00087 pDesc->Depth = _Depth; 00088 pDesc->PixelFormat = _PixelFormat; 00089 pDesc->Type = _ResourceType; 00090 } 00091 00092 return OGL_OK; 00093 } 00094 00095 private: 00096 00097 IOpenGLVolumeTexture ( 00098 int Width 00099 , int Height 00100 , int Depth 00101 , int Levels 00102 , BitmapFormat PixelFormat); 00103 00104 std::vector< ObjectPtr<IOpenGLSurface> > *_VolumeSurfaceArray; 00105 std::vector< ObjectPtr<IOpenGLVolume> > _VolumeArray; 00106 00107 friend class GpuDevice; 00108 friend class IOpenGLSurface; 00109 }; 00110 00111 } 00112 00113 #endif // IOPENGLVOLUMETEXTURE_H