"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSModelLib/Src/Models/LSDIntermediateDrawableMeshInstance.h

00001 
00017 #ifndef __LSD_INTEMEDIATEDRAWABLEMESHINSTANCE_H__
00018 #define __LSD_INTEMEDIATEDRAWABLEMESHINSTANCE_H__
00019 
00020 #include "../LSDModelLib.h"
00021 #include "../ModelTextures/LSDModelTexture.h"
00022 #include "../Shaders/LSDModelShaderManager.h"
00023 #include "IndexBuffer/LSGIndexBuffer.h"
00024 #include "LSDIntermediateMeshInstance.h"
00025 #include "LSDIntermediateSharedMesh.h"
00026 #include "LSDMaterial.h"
00027 #include "LSDSharedModel.h"
00028 #include "Vector/LSTLVector.h"
00029 #include "VertexBuffer/LSGVertexBuffer.h"
00030 
00031 namespace lsd {
00032 
00040         class CIntermediateDrawableMeshInstance {
00041         public :
00042                 // == Various constructors.
00043                 LSE_CALLCTOR                                                                    CIntermediateDrawableMeshInstance();
00044                 LSE_CALLCTOR                                                                    ~CIntermediateDrawableMeshInstance();
00045 
00046 
00047                 // == Types.
00051                 typedef struct LSD_RENDER_LAYER {
00055                         CSharedStdTexPtr                                                        sstpDiffuseTex;
00056 
00060                         CSharedStdTexPtr                                                        sstpAlphaTex;
00061 
00065                         CSharedStdTexPtr                                                        sstpSpecularTex;
00066 
00070                         CSharedStdTexPtr                                                        sstpAmbientTex;
00071 
00075                         CSharedStdTexPtr                                                        sstpEmissiveTex;
00076 
00080                         CSharedStdTexPtr                                                        sstpNormalTex;
00081 
00082 
00083                         // == Various constructors.
00084                         LSE_CALLCTOR                                                            LSD_RENDER_LAYER();
00085 
00086 
00087                         // == Operators.
00094                         LSD_RENDER_LAYER & LSE_CALL                                     operator = ( const LSD_RENDER_LAYER &_rlOther );
00095                 } * LPLSD_RENDER_LAYER, * const LPCLSD_RENDER_LAYER;
00096 
00101                 typedef struct LSD_RENDER_TYPE_DATA {
00105                         CSharedShaderPtr                                                        sspShader;
00106 
00110                         CModelShaderManager::LSD_SHADER_FLAGS           sfFlags;
00111 
00115                         CModelShaderManager::LSD_SHADER_FLAGS           sfPrevFlags;
00116                         
00121                         LSBOOL                                                                          bShaderIsCustom;
00122 
00126                         LSBOOL                                                                          bVertexLight;
00127 
00128 
00129                         // == Various constructors.
00130                         LSE_CALLCTOR                                                            LSD_RENDER_TYPE_DATA();
00131                         
00132 
00133                         // == Operators.
00140                         LSD_RENDER_TYPE_DATA & LSE_CALL                         operator = ( const LSD_RENDER_TYPE_DATA &_rtsOther );
00141                 } * LPLSD_RENDER_TYPE_DATA, * const LPCLSD_RENDER_TYPE_DATA;
00142 
00146                 typedef struct LSD_RENDER_PART {
00150                         CVertexBuffer                                                           vbVertexBuffer;
00151 
00155                         CVertexBuffer                                                           vbVertexVertexBuffer;
00156 
00160                         CIndexBuffer                                                            ibIndexBuffer;
00161 
00165                         CVectorPoD<LSUINT32>                                            vMaterialIndex;
00166 
00170                         CVector4                                                                        vMatDiffuse;
00171 
00175                         CVector4                                                                        vMatAmbient;
00176 
00180                         CVector4                                                                        vMatEmissive;
00181 
00185                         CVector4                                                                        vMatSpecular;
00186 
00190                         LSREAL                                                                          fPower;
00191 
00195                         LSREAL                                                                          fRoughness;
00196 
00200                         LSREAL                                                                          fReflectanceAtNormalIncidence;
00201 
00205                         CVector2                                                                        vAniso;
00206 
00210                         LSUINT32                                                                        ui32Primitives;
00211 
00215                         LSD_RENDER_TYPE_DATA                                            rtdDefaultPass;
00216 
00220                         LSD_RENDER_TYPE_DATA                                            rtdAmbientPass;
00221 
00225                         LSD_RENDER_TYPE_DATA                                            rtdLightingPass;
00226 
00230                         LSD_RENDER_TYPE_DATA                                            rtdShadowMapPass;
00231 
00235                         CVector<LSD_RENDER_LAYER>                                       vTextureLayers;
00236 
00237 
00238                         // == Various constructors.
00239                         LSE_CALLCTOR                                                            LSD_RENDER_PART();
00240 
00241 
00242                         // == Operators.
00249                         LSD_RENDER_PART & LSE_CALL                                      operator = ( const LSD_RENDER_PART &_rpOther );
00250                 } * LPLSD_RENDER_PART, * const LPCLSD_RENDER_PART;
00251 
00252 
00253                 // == Operators.
00260                 CIntermediateDrawableMeshInstance & LSE_CALL    operator = ( const CIntermediateDrawableMeshInstance &_idmiOther );
00261 
00262 
00263                 // == Functions.
00276                 LSSTD_ERRORS LSE_CALL                                                   CreateGraphicsData( const CIntermediateMeshInstance &_imiInstance, const CIntermediateSharedMesh ** _ppismMeshes,
00277                         const CMaterial ** _ppmMaterials, LSUINT32 _ui32TotalMaterials,
00278                         const CModelTexture * _pmtTextures, LSUINT32 _ui32TotalTextures,
00279                         const CVector<CSharedModel::LSD_MODEL_IMAGE> &_vModelImages );
00280 
00286                 LSVOID LSE_CALL                                                                 SetAllocator( CAllocator * _paAllocator );
00287 
00293                 LSE_INLINE CVector<LSD_RENDER_PART, LSUINT32> & LSE_CALL
00294                                                                                                                 GetRenderParts();
00295 
00302                 LSVOID LSE_CALL                                                                 DebugRender( CModelTexture * _pmtTextures, LSBOOL _bOpaque );
00303 
00304         protected :
00305                 // == Types.
00311                 typedef struct LSD_INTERM_MAT_LIST {
00315                         CVector<CString, LSUINT8>                                       vMaterials;
00316 
00317 
00318                         // == Operators.
00325                         LSD_INTERM_MAT_LIST & LSE_CALL                          operator = ( const LSD_INTERM_MAT_LIST &_imlOther );
00326 
00333                         LSBOOL LSE_CALL                                                         operator < ( const LSD_INTERM_MAT_LIST &_imlOther ) const;
00334 
00341                         LSBOOL LSE_CALL                                                         operator == ( const LSD_INTERM_MAT_LIST &_imlOther ) const;
00342                 } * LPLSD_INTERM_MAT_LIST, * const LPCLSD_INTERM_MAT_LIST;
00343 
00344 
00345                 // == Members.
00349                 CVector<LSD_RENDER_PART, LSUINT32>                              m_vRenderParts;
00350 
00351 
00352                 // == Functions.
00361                 LSUINT32 LSE_CALL                                                               FindTextureByName( const CModelTexture * _pmtTextures, LSUINT32 _ui32Total, const CString &_sName );
00362 
00370                 LSUINT32 LSE_CALL                                                               FindImageByFileName( const CVector<CSharedModel::LSD_MODEL_IMAGE> &_vModelImages, const CString &_sFileName );
00371 
00379                 LSVOID LSE_CALL                                                                 ComputeTangentBinormal( LSD_RENDER_PART &_rpPart, LSUINT32 _ui32Index, LSUINT32 _ui32Slot = 0UL );
00380         };
00381 
00382 
00383         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00384         // DEFINITIONS
00385         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00391         LSE_INLINE CVector<CIntermediateDrawableMeshInstance::LSD_RENDER_PART, LSUINT32> & LSE_CALL CIntermediateDrawableMeshInstance::GetRenderParts() {
00392                 return m_vRenderParts;
00393         }
00394 
00395 }       // namespace lsd
00396 
00397 #endif  // __LSD_INTEMEDIATEDRAWABLEMESHINSTANCE_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator