#ifndef CMODELLOADER_H #define CMODELLOADER_H #include "../model/CBasicModel.h" #include "../model/CModel.h" #include "../EFormatVersion.h" #include "CBlockMgrIn.h" #include #include #include #include class CModelLoader { public: enum EModelFlags { eNoFlags = 0x0, eShortPositions = 0x1, eShortNormals = 0x2, eHasTex1 = 0x4, eHasVisGroups = 0x8 }; private: CModel *mpModel; std::vector mMaterials; CBlockMgrIn *mpBlockMgr; CAABox mAABox; EGame mVersion; u32 mNumVertices; std::vector mPositions; std::vector mNormals; std::vector mColors; std::vector mTex0; std::vector mTex1; bool mSurfaceUsingTex1; u32 mSurfaceCount; std::vector mSurfaceOffsets; EModelFlags mFlags; CModelLoader(); ~CModelLoader(); void LoadWorldMeshHeader(CInputStream& Model); void LoadAttribArrays(CInputStream& Model); void LoadAttribArraysDKCR(CInputStream& Model); void LoadSurfaceOffsets(CInputStream& Model); SSurface* LoadSurface(CInputStream& Model); void LoadSurfaceHeaderPrime(CInputStream& Model, SSurface *pSurf); void LoadSurfaceHeaderDKCR(CInputStream& Model, SSurface *pSurf); SSurface* LoadAssimpMesh(const aiMesh *pMesh, CMaterialSet *pSet); public: static CModel* LoadCMDL(CInputStream& CMDL); static CModel* LoadWorldModel(CInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, EGame Version); static CModel* LoadCorruptionWorldModel(CInputStream& MREA, CBlockMgrIn& BlockMgr, CMaterialSet& MatSet, u32 HeaderSecNum, u32 GPUSecNum, EGame Version); static CModel* ImportAssimpNode(const aiNode *pNode, const aiScene *pScene, CMaterialSet& matSet); static EGame GetFormatVersion(u32 Version); }; DEFINE_ENUM_FLAGS(CModelLoader::EModelFlags) #endif // CMODELLOADER_H