"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSGraphicsLib/Src/Texture/LSGTextureBase.h

00001 
00016 #ifndef __LSG_TEXTUREBASE_H__
00017 #define __LSG_TEXTUREBASE_H__
00018 
00019 #include "../LSGGraphicsLib.h"
00020 #include "../RenderTarget/LSGRenderTargetInterface.h"
00021 #include "Matrix/LSMMatrix4x4.h"
00022 
00023 namespace lsg {
00024 
00025         // == Enumerations.
00029         enum LSG_WRAP_MODE {
00030                 LSG_WM_CLAMP,
00031                 LSG_WM_REPEAT,
00032                 LSG_WM_MIRROR,
00033         };
00034 
00038         enum LSG_MAPPING_TYPE {
00039                 LSG_MT_UV,
00040                 LSG_MT_XY,
00041                 LSG_MT_YZ,
00042                 LSG_MT_XZ,
00043                 LSG_MT_SPERICAL,
00044                 LSG_MT_ENVIRONMENT,
00045                 LSG_MT_CYLINDRICAL,
00046                 LSG_MT_PROJ,
00047         };
00048 
00052         enum LSG_TEXTURE_USAGE_FORMAT {
00053                 LSG_UF_NORMAL,                                                  
00054                 LSG_UF_CUBE_MAP,                                                
00055                 LSG_UF_SHADOW_MAP,                                              
00056                 LSG_UF_COLOR_MAP,                                               
00057                 LSG_UF_NORMAL_MAP,                                              
00058         };
00059 
00063         enum LSG_TEXTURE_USAGE_TYPE {
00064                 LSG_TU_SETONLY                                                  = (1 << 0UL),                                                   
00065                 LSG_TU_MODIFYABLE                                               = (1 << 1UL),                                                   
00066                 LSG_TU_RENDERTARGET                                             = (1 << 2UL),                                                   
00067                 LSG_TU_BITS                                                             = 3,                                                                    
00068         };
00069 
00073         enum LSG_TEXTURE_FILTER_TYPE {
00074                 LSG_TFT_ANISOTROPIC                                             = (1 << 3UL),                                                   
00075                 LSG_TFT_LINEAR                                                  = (1 << 4UL),                                                   
00076                 LSG_TFT_NEAREST                                                 = (1 << 5UL),                                                   
00077         };
00078 
00082         enum LSG_TEXTURE_BLENDING_MODES {
00083                 LSG_TBM_TRANSLUCENT                                             = 0UL,                                                                  
00084                 LSG_TBM_ADDITIVE                                                = 1UL,                                                                  
00085                 LSG_TBM_MODULATE                                                = 2UL,                                                                  
00086                 LSG_TBM_MODULATE2                                               = 3UL,                                                                  
00087                 LSG_TBM_OVER                                                    = 4UL,                                                                  
00088         };
00089 
00093         enum LSG_TEXTURE_METRICS {
00094                 LSG_TM_MAX_SLOTS                                                = 8UL,                                                                  
00095         };
00096 
00097 
00098         // == Types.
00102         typedef struct LSG_TEX_PARMS {
00106                 LSUINT32                                                                ui32Usage;
00107 
00111                 LSBOOL                                                                  bMipMaps;
00112 
00116                 LSG_WRAP_MODE                                                   wmWrapMode;
00117         } * LPLSG_TEX_PARMS, * const LPCLSG_TEX_PARMS;
00118 
00119 
00126         class CTextureBase : public CRenderTargetInterface {
00127                 friend class                                                    COpenGlRenderTarget;
00128         public :
00129                 // == Various constructors.
00130                 LSE_CALLCTOR                                                    CTextureBase();
00131                 virtual LSE_CALLCTOR                                    ~CTextureBase();
00132 
00133 
00134                 // == Functions.
00140                 LSE_INLINE LSG_TEXTURE_USAGE_FORMAT LSE_CALL
00141                                                                                                 GetUsageFormat() const;
00142 
00148                 LSE_INLINE LSUINT32 LSE_CALL                    GetUsageType() const;
00149 
00153                 virtual LSVOID LSE_CALL                                 Reset();
00154 
00161                 virtual LSBOOL LSE_CALL                                 Activate( LSUINT32 _ui32Slot );
00162 
00168                 LSE_INLINE LSBOOL LSE_CALL                              Finalized() const;
00169 
00170 
00171                 // == Members.
00176                 static const LSG_TEX_PARMS                              m_tpStandardPreset;
00177 
00182                 static const LSG_TEX_PARMS                              m_tpStandardHighQualityPreset;
00183 
00188                 static const LSG_TEX_PARMS                              m_tpSpritePreset;
00189 
00194                 static const LSG_TEX_PARMS                              m_tpSpriteSoftPreset;
00195 
00199                 static CMatrix4x4                                               m_mTextureMatrix[LSG_MAX_TEXTURE_UNITS];
00200 
00201         protected :
00202                 // == Members.
00206                 LSUINT32                                                                m_ui32PhysicalWidth;
00207 
00211                 LSUINT32                                                                m_ui32PhysicalHeight;
00212 
00216                 LSG_TEXTURE_USAGE_FORMAT                                m_tufUsageFormat;
00217 
00221                 LSG_WRAP_MODE                                                   m_wmWrap;
00222 
00226                 LSUINT32                                                                m_ui32Usage;
00227 
00231                 LSBOOL                                                                  m_bMipMaps;
00232 
00236                 LSUINT32                                                                m_ui32Lock;
00237 
00241                 LSBOOL                                                                  m_bFinalized;
00242 
00246                 static LSUINT32                                                 m_ui32LastTextures[LSG_TM_MAX_SLOTS];
00247 
00251                 static LSUINT32                                                 m_ui32LastCubeTextures[LSG_TM_MAX_SLOTS];
00252         };
00253 
00254 
00255         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00256         // DEFINITIONS
00257         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00258         // == Functions.
00264         LSE_INLINE LSG_TEXTURE_USAGE_FORMAT LSE_CALL CTextureBase::GetUsageFormat() const {
00265                 return m_tufUsageFormat;
00266         }
00267 
00273         LSE_INLINE LSUINT32 LSE_CALL CTextureBase::GetUsageType() const {
00274                 return m_ui32Usage;
00275         }
00276 
00282         LSE_INLINE LSBOOL LSE_CALL CTextureBase::Finalized() const {
00283                 return m_bFinalized;
00284         }
00285 
00286 }       // namespace lsg
00287 
00288 #endif  // __LSG_TEXTUREBASE_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator