[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 |
|
---|
[2304] | 42 | protected:
|
---|
| 43 | void trimMesh(unsigned int originalAtlasTexCoordIndex);
|
---|
| 44 |
|
---|
[2197] | 45 | public:
|
---|
| 46 | Mesh( PathMapEffect* pathMapEffect,
|
---|
| 47 | DWORD fileFormat,
|
---|
| 48 | LPCWSTR xFileName,
|
---|
| 49 | LPCWSTR ogreFileName,
|
---|
| 50 | int prmAtlasSize,
|
---|
| 51 | const char* name,
|
---|
| 52 | unsigned int nDesiredPartitions,
|
---|
| 53 | bool generateUV,
|
---|
[2304] | 54 | bool generateTBN,
|
---|
| 55 | unsigned int originalAtlasTexCoordIndex);
|
---|
[2197] | 56 | ~Mesh(void);
|
---|
| 57 |
|
---|
| 58 | void saveMesh();
|
---|
| 59 |
|
---|
| 60 | const char* getName();
|
---|
| 61 |
|
---|
| 62 | static HRESULT loadMeshFromOgreXML(
|
---|
| 63 | LPCWSTR filename,
|
---|
| 64 | DWORD options,
|
---|
| 65 | LPDIRECT3DDEVICE9 device,
|
---|
| 66 | LPD3DXBUFFER *materialBuffer,
|
---|
| 67 | LPD3DXBUFFER *shaderBuffer,
|
---|
| 68 | DWORD *nMaterials,
|
---|
| 69 | XMLNode& xMaterials,
|
---|
| 70 | wchar_t**& materialNames,
|
---|
| 71 | LPD3DXMESH *mesh);
|
---|
| 72 |
|
---|
| 73 | static const DWORD OgreXMLMesh;
|
---|
| 74 | static const DWORD DirectXMesh;
|
---|
| 75 |
|
---|
| 76 | void saveSceneInfo(std::ofstream& psf);
|
---|
| 77 | };
|
---|