[2197] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | #include <vector>
|
---|
| 4 | #include "Vector.hpp"
|
---|
| 5 | #include "KDTree.hpp"
|
---|
| 6 | #include "xmlParser.h"
|
---|
| 7 |
|
---|
| 8 | class Material;
|
---|
| 9 | class TriangleMesh;
|
---|
| 10 | class PathMapEffect;
|
---|
| 11 |
|
---|
| 12 | class Mesh
|
---|
| 13 | {
|
---|
| 14 | friend class SubMesh;
|
---|
| 15 | friend class SubEntity;
|
---|
| 16 | friend class Entity;
|
---|
| 17 | friend class FinalCompositionRenderStrategy;
|
---|
| 18 |
|
---|
| 19 | PathMapEffect* pathMapEffect;
|
---|
| 20 |
|
---|
| 21 | char name[256];
|
---|
| 22 | wchar_t ogreFileName[256];
|
---|
| 23 |
|
---|
| 24 | int prmAtlasSize;
|
---|
| 25 |
|
---|
| 26 | std::vector<SubMesh*> subMeshes;
|
---|
| 27 |
|
---|
| 28 | LPD3DXMESH mesh; //!< D3D mesh
|
---|
| 29 | LPDIRECT3DVERTEXBUFFER9 edgeVertexBuffer; //!< a set of line primitives for atlas (PRM) rendering
|
---|
| 30 |
|
---|
| 31 | int nEdges; //!< number of line primitives in edgeVertexBuffer
|
---|
| 32 |
|
---|
| 33 | HRESULT setVertexFormat(DWORD fvf); //!< rebuild D3D to have different vertex format
|
---|
| 34 | void buildEdgeVertexBuffer(); //!< compute line primitives to edgeVertexBuffer
|
---|
| 35 | HRESULT partitionMesh(unsigned int nDesiredPartitions, LPD3DXBUFFER& partitioningBuffer, unsigned int& nPartitions); //!< partition mesh
|
---|
| 36 | HRESULT computeTangentFrame();
|
---|
| 37 |
|
---|
| 38 | unsigned int nSubsets; //!< number of submeshes (with possible different material)
|
---|
| 39 |
|
---|
| 40 | static void addShaderString(D3DXEFFECTINSTANCE& e, LPCSTR name, LPCSTR value);
|
---|
| 41 |
|
---|
| 42 | public:
|
---|
| 43 | Mesh( PathMapEffect* pathMapEffect,
|
---|
| 44 | DWORD fileFormat,
|
---|
| 45 | LPCWSTR xFileName,
|
---|
| 46 | LPCWSTR ogreFileName,
|
---|
| 47 | int prmAtlasSize,
|
---|
| 48 | const char* name,
|
---|
| 49 | unsigned int nDesiredPartitions,
|
---|
| 50 | bool generateUV,
|
---|
| 51 | bool generateTBN);
|
---|
| 52 | ~Mesh(void);
|
---|
| 53 |
|
---|
| 54 | void saveMesh();
|
---|
| 55 |
|
---|
| 56 | const char* getName();
|
---|
| 57 |
|
---|
| 58 | static HRESULT loadMeshFromOgreXML(
|
---|
| 59 | LPCWSTR filename,
|
---|
| 60 | DWORD options,
|
---|
| 61 | LPDIRECT3DDEVICE9 device,
|
---|
| 62 | LPD3DXBUFFER *materialBuffer,
|
---|
| 63 | LPD3DXBUFFER *shaderBuffer,
|
---|
| 64 | DWORD *nMaterials,
|
---|
| 65 | XMLNode& xMaterials,
|
---|
| 66 | wchar_t**& materialNames,
|
---|
| 67 | LPD3DXMESH *mesh);
|
---|
| 68 |
|
---|
| 69 | static const DWORD OgreXMLMesh;
|
---|
| 70 | static const DWORD DirectXMesh;
|
---|
| 71 |
|
---|
| 72 | void saveSceneInfo(std::ofstream& psf);
|
---|
| 73 | };
|
---|