00001 //============================================================================= 00002 // filename: RmVolume.h 00003 // 00004 // ATI Research, Inc. 00005 // 3D Application Research Group 00006 // 00007 // Description: RenderMonkey's Volume Definition 00008 // 00009 //============================================================================= 00010 // (C) 2004 ATI Research, Inc. All rights reserved. 00011 //============================================================================= 00012 00013 #ifndef _RM_CORE_VOLUME_H_ 00014 #define _RM_CORE_VOLUME_H_ 00015 00016 #include <Core/RmTypes.h> 00017 #include <Core/RmDefines.h> 00018 #include <Core/RmEffect.h> 00019 #include <Core/RmMath.h> 00020 #include <Core/RmMatrix.h> 00021 #include <Core/RmSurface.h> 00022 00023 //============================================================================= 00038 //============================================================================= 00039 class RM_API RmVolume 00040 { 00041 public : 00042 //-------------------------------------------------------------------------- 00046 //-------------------------------------------------------------------------- 00047 RmVolume(); 00048 00049 //-------------------------------------------------------------------------- 00053 //-------------------------------------------------------------------------- 00054 virtual ~RmVolume(); 00055 00056 //-------------------------------------------------------------------------- 00066 //-------------------------------------------------------------------------- 00067 bool Create( RmPixelFormatType pixelFormat, int width, int height, int depth ); 00068 00069 //-------------------------------------------------------------------------- 00075 //-------------------------------------------------------------------------- 00076 void Destroy(); 00077 00078 //-------------------------------------------------------------------------- 00084 //-------------------------------------------------------------------------- 00085 RM_BYTE* GetBuffer() { return m_pBuffer; }; 00086 00087 //-------------------------------------------------------------------------- 00093 //-------------------------------------------------------------------------- 00094 const RM_BYTE* GetBuffer() const { return m_pBuffer; }; 00095 00096 //-------------------------------------------------------------------------- 00103 //-------------------------------------------------------------------------- 00104 RM_BYTE* GetSlice( int z ); 00105 00106 //-------------------------------------------------------------------------- 00113 //-------------------------------------------------------------------------- 00114 const RM_BYTE* GetSlice( int z ) const; 00115 00116 //-------------------------------------------------------------------------- 00124 //-------------------------------------------------------------------------- 00125 RM_BYTE* GetScanLine( int y, int z ); 00126 00127 //-------------------------------------------------------------------------- 00135 //-------------------------------------------------------------------------- 00136 const RM_BYTE* GetScanLine( int y, int z ) const; 00137 00138 //-------------------------------------------------------------------------- 00147 //-------------------------------------------------------------------------- 00148 RM_BYTE* GetVoxel( int x, int y, int z ); 00149 00150 //-------------------------------------------------------------------------- 00159 //-------------------------------------------------------------------------- 00160 const RM_BYTE* GetVoxel( int x, int y, int z ) const; 00161 00162 //-------------------------------------------------------------------------- 00168 //-------------------------------------------------------------------------- 00169 int GetWidth() const { return m_width; }; 00170 00171 //-------------------------------------------------------------------------- 00177 //-------------------------------------------------------------------------- 00178 int GetHeight() const { return m_height; }; 00179 00180 //-------------------------------------------------------------------------- 00186 //-------------------------------------------------------------------------- 00187 int GetDepth() const { return m_depth; }; 00188 00189 //-------------------------------------------------------------------------- 00195 //-------------------------------------------------------------------------- 00196 int GetPitch() const { return m_pitch; }; 00197 00198 //-------------------------------------------------------------------------- 00204 //-------------------------------------------------------------------------- 00205 int GetSlicePitch() const { return m_slicePitch; }; 00206 00207 //-------------------------------------------------------------------------- 00213 //-------------------------------------------------------------------------- 00214 int GetBytesPerVoxel() const { return m_bytesPerVoxel; }; 00215 00216 //-------------------------------------------------------------------------- 00222 //-------------------------------------------------------------------------- 00223 int GetTotalSize() const { return m_totalSize; }; 00224 00225 //-------------------------------------------------------------------------- 00231 //-------------------------------------------------------------------------- 00232 RmPixelFormatType GetPixelFormat() const { return m_pixelFormat; }; 00233 00234 //-------------------------------------------------------------------------- 00240 //-------------------------------------------------------------------------- 00241 bool IsDXTFormat() const; 00242 00243 private : 00244 RmPixelFormatType m_pixelFormat; 00245 00246 int m_width; 00247 int m_height; 00248 int m_depth; 00249 int m_bytesPerVoxel; 00250 00251 int m_pitch; 00252 int m_slicePitch; 00253 00254 int m_totalSize; 00255 00256 int m_DXTBlockSize; 00257 int m_DXTBlockWidth; 00258 int m_DXTBlockHeight; 00259 00260 RM_BYTE *m_pBuffer; 00261 }; // End of RmVolume 00262 00263 00264 //============================================================================= 00274 //============================================================================= 00275 class RM_API Rm3DTexture : public RmTexture 00276 { 00277 public : 00278 //-------------------------------------------------------------------------- 00282 //-------------------------------------------------------------------------- 00283 Rm3DTexture(); 00284 00285 //-------------------------------------------------------------------------- 00289 //-------------------------------------------------------------------------- 00290 virtual ~Rm3DTexture(); 00291 00292 //-------------------------------------------------------------------------- 00306 //-------------------------------------------------------------------------- 00307 bool Create( RmPixelFormatType pixelFormat, int width, int height, int depth, 00308 int numMipmaps ); 00309 00310 //-------------------------------------------------------------------------- 00316 //-------------------------------------------------------------------------- 00317 void Destroy(); 00318 00319 //-------------------------------------------------------------------------- 00325 //-------------------------------------------------------------------------- 00326 int GetNumMipmaps() const { return m_numMipmaps; }; 00327 00328 //-------------------------------------------------------------------------- 00335 //-------------------------------------------------------------------------- 00336 RmVolume* GetMipmap( int level ); 00337 00338 //-------------------------------------------------------------------------- 00345 //-------------------------------------------------------------------------- 00346 const RmVolume* GetMipmap( int level ) const; 00347 00348 //-------------------------------------------------------------------------- 00354 //-------------------------------------------------------------------------- 00355 RmTextureType GetTextureType() const { return RM_TEXTURE_3D; }; 00356 00357 //-------------------------------------------------------------------------- 00363 //-------------------------------------------------------------------------- 00364 int GetWidth() const { return m_width; }; 00365 00366 //-------------------------------------------------------------------------- 00372 //-------------------------------------------------------------------------- 00373 int GetHeight() const { return m_height; }; // Height of top level mipmap 00374 00375 //-------------------------------------------------------------------------- 00381 //-------------------------------------------------------------------------- 00382 int GetDepth() const { return m_depth; }; // Depth of top level mipmap 00383 00384 //-------------------------------------------------------------------------- 00390 //-------------------------------------------------------------------------- 00391 RmPixelFormatType GetPixelFormat() const { return m_pixelFormat; }; 00392 00393 private : 00394 int m_numMipmaps; 00395 RmVolume *m_pMipmaps; 00396 00397 RmPixelFormatType m_pixelFormat; 00398 int m_width; 00399 int m_height; 00400 int m_depth; 00401 00402 }; // End of Rm3DTexture 00403 00404 #endif
1.3.6