nux-0.9.46
|
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 IOPENGLVOLUME_H 00024 #define IOPENGLVOLUME_H 00025 00026 namespace nux 00027 { 00028 00029 class IOpenGLResource; 00030 class IOpenGLVolumeTexture; 00031 00032 class IOpenGLVolume: public IOpenGLResource 00033 { 00034 NUX_DECLARE_OBJECT_TYPE (IOpenGLVolume, IOpenGLResource); 00035 00036 public: 00037 virtual int RefCount() const; 00038 00039 int LockBox ( 00040 VOLUME_LOCKED_BOX *pLockedVolume, 00041 const VOLUME_BOX *pBox); 00042 00043 int UnlockBox(); 00044 00045 BitmapFormat GetPixelFormat() const; 00046 int GetWidth() const; 00047 int GetHeight() const; 00048 int GetDepth() const; 00049 00050 int GetMipLevel() const 00051 { 00052 return _SMipLevel; 00053 } 00054 00055 int GetSurfaceTarget() const 00056 { 00057 return _SSurfaceTarget; 00058 } 00059 00060 int GetLevelDesc (VOLUME_DESC *pDesc) 00061 { 00062 pDesc->Width = GetWidth(); 00063 pDesc->Height = GetHeight(); 00064 pDesc->Depth = GetDepth(); 00065 pDesc->PixelFormat = GetPixelFormat(); 00066 pDesc->Type = _ResourceType; 00067 return OGL_OK; 00068 } 00069 00070 private: 00071 virtual ~IOpenGLVolume(); 00072 00073 int InitializeLevel(); 00074 00075 IOpenGLVolume (IOpenGLVolumeTexture *VolumeTexture, GLenum OpenGLID, GLenum TextureTarget, GLenum SurfaceTarget, unsigned int MipLevel) 00076 : IOpenGLResource (RTVOLUME) 00077 , _STextureTarget (TextureTarget) 00078 , _SSurfaceTarget (SurfaceTarget) 00079 , _SMipLevel (MipLevel) 00080 , _VolumeTexture (VolumeTexture) 00081 , _AllocatedUnpackBuffer (0xFFFFFFFF) 00082 { 00083 // IOpenGLVolume surfaces are created inside a IOpenGLVolumeTexture. 00084 // They reside within this class. The reference counting starts once a call to GetVolumeLevel is made to the container object. 00085 _RefCount = 0; 00086 _OpenGLID = OpenGLID; 00087 _LockedBox.pBits = 0; 00088 _LockedBox.RowPitch = 0; 00089 _CompressedDataSize = 0; 00090 _Initialized = 0; 00091 } 00092 00093 // _STextureTarget may be 00094 // GL_TEXTURE_3D 00095 GLenum _STextureTarget; 00096 00097 // _SSurfaceTarget may be 00098 // GL_TEXTURE_3D 00099 GLenum _SSurfaceTarget; 00100 int _SMipLevel; 00101 00102 VOLUME_LOCKED_BOX _LockedBox; 00103 VOLUME_BOX _Box; 00104 int _CompressedDataSize; 00105 00106 IOpenGLVolumeTexture *_VolumeTexture; 00107 bool _Initialized; 00108 00109 int _AllocatedUnpackBuffer; 00110 00111 friend class IOpenGLVolumeTexture; 00112 friend class ObjectPtr<IOpenGLVolume>; 00113 }; 00114 00115 } 00116 00117 #endif // IOPENGLVOLUME_H