source: GTP/trunk/App/Demos/Illum/pathmap/MeshExploder.h @ 2197

Revision 2197, 1.2 KB checked in by szirmay, 17 years ago (diff)
Line 
1#pragma once
2
3struct Tri;
4
5class MeshExploder
6{
7        LPDIRECT3DDEVICE9 device;
8
9        LPD3DXMESH originalMesh;
10        D3DXMATERIAL* originalMaterials;
11        D3DXEFFECTINSTANCE* originalShaders;
12
13        wchar_t** materialNames;
14
15        unsigned int nPieces;
16        LPD3DXMESH* fragmentMeshes;
17        DWORD* fragmentAttribIndices;
18
19public:
20        LPD3DXMESH composedMesh;
21        D3DXMATERIAL* composedMaterials;
22        D3DXEFFECTINSTANCE* composedShaders;
23
24        wchar_t** composedMaterialNames;
25
26        MeshExploder(LPDIRECT3DDEVICE9 device,
27                LPD3DXMESH originalMesh,
28                D3DXMATERIAL* originalMaterials,
29                wchar_t** materialNames,
30                D3DXEFFECTINSTANCE* originalShaders,
31                unsigned int nPieces);
32        ~MeshExploder(void);
33
34        //create #nPieces partial meshes
35        //attributes are kept for every face
36        void explode();
37
38        //generate atlas for all fragment meshes
39        //attributes are kept
40        void generateAtlas(int atlasSize);
41
42        //combine all fragment meshes into one
43        //attributes are (original x fragmentIndex)
44        //new material buffer
45        void merge();
46
47        void saveFragMeshes();
48        void saveComposedMesh(LPCSTR name);
49
50        void saveComposedMeshToOgreXML(LPCSTR name);
51
52        static void clusterTrisKMeans(Tri* triArray, int nTris, int nClusters, int* clusterLenghts);
53};
Note: See TracBrowser for help on using the repository browser.