00001 //============================================================================// 00002 // filename: RmDDSVolume.h // 00003 // // 00004 // author: Toshiaki Tsuji // 00005 // ATI Research, Inc. // 00006 // 3D Application Research Group // 00007 // // 00008 // description: DDS Volume definition // 00009 // Written for 3D Labs guys for loading volume VolumeTexture. // 00010 // // 00011 //============================================================================// 00012 // $File: //depot/3darg/Tools/RenderMonkey/sdk/Include/Utilities/RmDDSVolume.h $ 00013 // $Author: natasha $ $Revision: #3 $ 00014 //============================================================================// 00015 // (C) 2004 ATI Research, Inc. All rights reserved. // 00016 //============================================================================// 00017 00018 #ifndef _RM_UTILITIES_DDS_VOLUME_H_ 00019 #define _RM_UTILITIES_DDS_VOLUME_H_ 00020 00021 #include "RmDDSLoaderTypes.h" 00022 #include "RmDDSSurface.h" 00023 00024 //============================================================================ 00025 // 00026 // DDS Volume 00027 // 00028 //============================================================================ 00029 class RMUTIL_API RmDDSVolume 00030 { 00031 public : 00032 RmDDSVolume(); 00033 virtual ~RmDDSVolume(); 00034 00035 //------------------------------------------------------------------------- 00036 // Creat/Destroy 00037 //------------------------------------------------------------------------- 00038 bool Create( RM_DDS_PIXEL_FORMAT pixelFormat, int width, int height, int depth ); 00039 void Destroy(); 00040 00041 //------------------------------------------------------------------------- 00042 // Accessor for Slice 00043 //------------------------------------------------------------------------- 00044 RmDDSSurface* GetSlice( int z ); 00045 const RmDDSSurface* GetSlice( int z ) const; 00046 00047 //------------------------------------------------------------------------- 00048 // Info 00049 //------------------------------------------------------------------------- 00050 int GetWidth() const { return m_width; }; 00051 int GetHeight() const { return m_height; }; 00052 int GetDepth() const { return m_depth; }; 00053 00054 RM_DDS_PIXEL_FORMAT GetPixelFormat() const { return m_pixelFormat; }; 00055 00056 bool IsRGBAFormat() const; 00057 bool IsDXTFormat() const; 00058 bool IsLuminanceFormat() const; 00059 00060 //------------------------------------------------------------------------- 00061 // Change format to RGBA 8888 and returns result volume 00062 //------------------------------------------------------------------------- 00063 bool ChangeFormatToRGBA( RmDDSVolume *pVolume ); 00064 00065 //------------------------------------------------------------------------- 00066 // Create one big chunk of memory to store volume 00067 //------------------------------------------------------------------------- 00068 bool CreateVolumeMemory(); 00069 void DestroyVolumeMemory(); 00070 00071 RM_DDS_BYTE *GetVolumeBuffer() { return m_pBuffer; }; 00072 const RM_DDS_BYTE *GetVolumeBuffer() const { return m_pBuffer; }; 00073 00074 private : 00075 RM_DDS_PIXEL_FORMAT m_pixelFormat; 00076 00077 int m_width; 00078 int m_height; 00079 int m_depth; 00080 00081 // Store each slice as a surface 00082 int m_numSlices; 00083 RmDDSSurface *m_pSlices; 00084 00085 // Storte volume as one big chunk of memory 00086 RM_DDS_BYTE *m_pBuffer; 00087 }; // End of RmDDSVolume 00088 00089 00090 //============================================================================ 00091 // 00092 // DDS VolumeTexture 00093 // 00094 // - Collection of mip Volumes. Each successive Volume is 1/2 the size 00095 // 00096 //============================================================================ 00097 class RMUTIL_API RmDDSVolumeTexture 00098 { 00099 public : 00100 RmDDSVolumeTexture(); 00101 virtual ~RmDDSVolumeTexture(); 00102 00103 //------------------------------------------------------------------------- 00104 // Create/Destroy 00105 //------------------------------------------------------------------------- 00106 bool Create( RM_DDS_PIXEL_FORMAT pixelFormat, int width, int height, int depth, 00107 int numMipmaps ); 00108 void Destroy(); 00109 00110 //------------------------------------------------------------------------- 00111 // Mipmaps 00112 //------------------------------------------------------------------------- 00113 int GetNumMipmaps() const { return m_numMipmaps; }; 00114 00115 RmDDSVolume* GetMipmap( int level ); 00116 const RmDDSVolume* GetMipmap( int level ) const; 00117 00118 //------------------------------------------------------------------------- 00119 // Information 00120 //------------------------------------------------------------------------- 00121 int GetWidth() const { return m_width; }; // Width of top level mipmap 00122 int GetHeight() const { return m_height; }; // Height of top level mipmap 00123 int GetDepth() const { return m_depth; }; // Depth of top level mipmap 00124 00125 RM_DDS_PIXEL_FORMAT GetPixelFormat() const { return m_pixelFormat; }; 00126 00127 private : 00128 int m_numMipmaps; 00129 RmDDSVolume *m_pMipmaps; 00130 00131 RM_DDS_PIXEL_FORMAT m_pixelFormat; 00132 int m_width; 00133 int m_height; 00134 int m_depth; 00135 }; // End of RmDDSVolumeTexture 00136 00137 #endif // __RmDDSVolume_H__
1.3.6