"L. Spiro Engine"
|
00001 00016 #ifndef __LSE_STANDARDTEXTURE_H__ 00017 #define __LSE_STANDARDTEXTURE_H__ 00018 00019 #include "../LSGGraphicsLib.h" 00020 #ifdef LSG_DX9 00021 #include "../DirectX/LSGDirectX9StandardTexture.h" 00022 #endif // #ifdef LSG_DX9 00023 #ifdef LSG_DX10 00024 #include "../DirectX/LSGDirectX10StandardTexture.h" 00025 #endif // #ifdef LSG_DX10 00026 #ifdef LSG_DX11 00027 #include "../DirectX/LSGDirectX11StandardTexture.h" 00028 #endif // #ifdef LSG_DX11 00029 #ifdef LSG_OGLES 00030 #include "../OpenGLES/LSGOpenGlEsStandardTexture.h" 00031 #endif // #ifdef LSG_OGLES 00032 #ifdef LSG_OGL 00033 #include "../OpenGL/LSGOpenGlStandardTexture.h" 00034 #endif // #ifdef LSG_OGL 00035 #include "SharedPtr/LSTLSharedPtr.h" 00036 00037 namespace lsg { 00038 00045 class CStandardTexture : public 00046 #if defined( LSG_DX9 ) 00047 CDirectX9StandardTexture 00048 #elif defined( LSG_DX10 ) 00049 CDirectX10StandardTexture 00050 #elif defined( LSG_DX11 ) 00051 CDirectX11StandardTexture 00052 #elif defined( LSG_OGL ) 00053 COpenGlStandardTexture 00054 #elif defined( LSG_OGLES ) 00055 COpenGlEsStandardTexture 00056 #endif // #if defined( LSG_DX9 ) 00057 { 00058 public : 00059 // == Various constructors. 00060 LSE_CALLCTOR CStandardTexture(); 00061 virtual LSE_CALLCTOR ~CStandardTexture(); 00062 00063 00064 // == Functions. 00076 LSBOOL LSE_CALL LoadTextureFromMemory( const LSVOID * _pvBuffer, LSUINTPTR _uiptrSize, LSUINT32 _ui32Usage, 00077 LSBOOL _bMipMaps = true, LSG_WRAP_MODE _wmWrapMode = LSG_WM_CLAMP, CAllocator * _paAllocator = NULL ); 00078 00088 LSBOOL LSE_CALL LoadTextureFromMemory( const LSVOID * _pvBuffer, LSUINTPTR _uiptrSize, const LSG_TEX_PARMS &_tpSettings, 00089 CAllocator * _paAllocator = NULL ); 00090 00101 LSBOOL LSE_CALL LoadTextureFromFile( const LSCHAR * _pcPath, LSUINT32 _ui32Usage, 00102 LSBOOL _bMipMaps = true, LSG_WRAP_MODE _wmWrapMode = LSG_WM_CLAMP, CAllocator * _paAllocator = NULL ); 00103 00112 LSBOOL LSE_CALL LoadTextureFromFile( const LSCHAR * _pcPath, const LSG_TEX_PARMS &_tpSettings, CAllocator * _paAllocator = NULL ); 00113 00125 LSBOOL LSE_CALL CreateFromImage( const CImage &_iImage, LSUINT32 _ui32Usage, 00126 LSBOOL _bMipMaps = true, LSG_WRAP_MODE _wmWrapMode = LSG_WM_CLAMP, CAllocator * _paAllocator = NULL ); 00127 00139 LSBOOL LSE_CALL CreateFromRgbAndAlpha( const CStandardTexture &_stRgb, const CStandardTexture &_stAlpha, 00140 const LSG_TEX_PARMS &_tpSettings, CAllocator * _paAllocator = NULL ); 00141 00147 LSBOOL LSE_CALL Finalize(); 00148 00152 virtual LSVOID LSE_CALL Reset(); 00153 00160 LSVOID LSE_CALL ConvertToFormat( LSI_PIXEL_FORMAT _pfFormat ); 00161 00172 LSBOOL LSE_CALL ResizeTo( LSUINT32 _ui32Width, LSUINT32 _ui32Height, LSI_FILTER _fFilter = LSI_F_ANY ); 00173 00180 LSBOOL LSE_CALL Flip(); 00181 00191 LSVOID LSE_CALL ConvertToNormalMap( LSFLOAT _fStr, LSBOOL _bWrapX = true, LSBOOL _bWrapY = true ); 00192 00199 LSBOOL LSE_CALL ConvertToDxt(); 00200 00206 LSVOID LSE_CALL MakeSetOnly(); 00207 00213 LSE_INLINE LSI_PIXEL_FORMAT LSE_CALL GetFormat() const; 00214 00221 LSE_INLINE const CImage & LSE_CALL GetImage() const; 00222 00223 00224 protected : 00225 // == Members. 00229 LSI_PIXEL_FORMAT m_pfFormat; 00230 00231 00232 // == Functions. 00236 LSVOID LSE_CALL FixUsage(); 00237 00238 00239 private : 00240 #if defined( LSG_DX9 ) 00241 typedef CDirectX9StandardTexture Parent; 00242 #elif defined( LSG_DX10 ) 00243 typedef CDirectX10StandardTexture Parent; 00244 #elif defined( LSG_DX11 ) 00245 typedef CDirectX11StandardTexture Parent; 00246 #elif defined( LSG_OGL ) 00247 typedef COpenGlStandardTexture Parent; 00248 #elif defined( LSG_OGLES ) 00249 typedef COpenGlEsStandardTexture Parent; 00250 #endif // #if defined( LSG_DX9 ) 00251 }; 00252 00253 00254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00255 // DEFINITIONS 00256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00257 // == Types. 00261 typedef CSharedPtr<CStandardTexture> CSharedStdTexPtr; 00262 00263 // == Functions. 00269 LSE_INLINE LSI_PIXEL_FORMAT LSE_CALL CStandardTexture::GetFormat() const { 00270 return m_pfFormat; 00271 } 00272 00279 LSE_INLINE const CImage & LSE_CALL CStandardTexture::GetImage() const { 00280 return m_iTexels; 00281 } 00282 00283 } // namespace lsg 00284 00285 #endif // __LSE_STANDARDTEXTURE_H__