1 | //========================================
|
---|
2 | // Class abstracting the geometric mesh.
|
---|
3 | // Nicolau Sunyer & Sergi Funtané (10/13/2005).
|
---|
4 | // Universitat de Girona.
|
---|
5 | //========================================
|
---|
6 |
|
---|
7 | #ifndef CMESH_H
|
---|
8 | #define CMESH_H
|
---|
9 |
|
---|
10 | //Includes.
|
---|
11 | #include "Ogre.h"
|
---|
12 | #include "OgreXMLMeshSerializer.h"
|
---|
13 | #include "OgreMeshSerializer.h"
|
---|
14 | #include "OgreXMLSkeletonSerializer.h"
|
---|
15 | #include "OgreSkeletonSerializer.h"
|
---|
16 | #include "OgreXMLPrerequisites.h"
|
---|
17 | #include "OgreDefaultHardwareBufferManager.h"
|
---|
18 | #include <iostream>
|
---|
19 | #include <sys/stat.h>
|
---|
20 | #include <cmath>
|
---|
21 | //#include <glut.h>
|
---|
22 | //#include <ctime>
|
---|
23 | //#include "structsVisualCAD.h"
|
---|
24 | #include "SNStr.h"
|
---|
25 |
|
---|
26 | //progress bar
|
---|
27 | #include <wx/progdlg.h>
|
---|
28 | //End Includes.
|
---|
29 |
|
---|
30 | using namespace std;
|
---|
31 | using namespace Ogre;
|
---|
32 |
|
---|
33 | struct XmlOptions
|
---|
34 | {
|
---|
35 | String source;
|
---|
36 | String dest;
|
---|
37 | String sourceExt;
|
---|
38 | String destExt;
|
---|
39 | String logFile;
|
---|
40 | bool interactiveMode;
|
---|
41 | unsigned short numLods;
|
---|
42 | Real lodDist;
|
---|
43 | Real lodPercent;
|
---|
44 | size_t lodFixed;
|
---|
45 | bool usePercent;
|
---|
46 | bool generateEdgeLists;
|
---|
47 | bool generateTangents;
|
---|
48 | bool reorganiseBuffers;
|
---|
49 | bool optimiseAnimations;
|
---|
50 | bool quietMode;
|
---|
51 | bool d3d;
|
---|
52 | bool gl;
|
---|
53 | Serializer::Endian endian;
|
---|
54 | };
|
---|
55 |
|
---|
56 |
|
---|
57 | class CVert // Vert Class.
|
---|
58 | {
|
---|
59 | public:
|
---|
60 | float x; // X Component
|
---|
61 | float y; // Y Component
|
---|
62 | float z; // Z Component
|
---|
63 | };
|
---|
64 | typedef CVert CVec; // Synonimous Definitions.
|
---|
65 |
|
---|
66 | class CColor // Color Class.
|
---|
67 | {
|
---|
68 | public:
|
---|
69 | unsigned char r; // R Component
|
---|
70 | unsigned char g; // G Component
|
---|
71 | unsigned char b; // B Component
|
---|
72 | };
|
---|
73 |
|
---|
74 | class CColorf // Color2 Class.
|
---|
75 | {
|
---|
76 | public:
|
---|
77 | float r; // R Component.
|
---|
78 | float g; // G Component.
|
---|
79 | float b; // B Component.
|
---|
80 | };
|
---|
81 |
|
---|
82 | class CTexCoord //TexCoord Class.
|
---|
83 | {
|
---|
84 | public:
|
---|
85 | float u; // U Component.
|
---|
86 | float v; // V Component.
|
---|
87 | };
|
---|
88 |
|
---|
89 | class CSphere //Sphere Class.
|
---|
90 | {
|
---|
91 |
|
---|
92 | public:
|
---|
93 | CVert center; // Center.
|
---|
94 | float radius; // Radius.
|
---|
95 | };
|
---|
96 |
|
---|
97 |
|
---|
98 | //Class Definition.
|
---|
99 | class CMesh
|
---|
100 | {
|
---|
101 | public:
|
---|
102 | CMesh(); // Mesh Constructor
|
---|
103 | ~CMesh(); // Mesh Destructor
|
---|
104 |
|
---|
105 | void LoadMesh(char *argv);
|
---|
106 | void FreeMem();
|
---|
107 | void ShowMesh(char *filename);
|
---|
108 |
|
---|
109 | snObject m_pObject; //Internal Format.
|
---|
110 |
|
---|
111 | private:
|
---|
112 | void parseArgs(char *argv, XmlOptions &opts);
|
---|
113 | void meshToXML(XmlOptions opts);
|
---|
114 | float getValue(const char *string, int &i);
|
---|
115 | void XMLToSNStr(char *name);
|
---|
116 | void NormalizeIt(wxProgressDialog &dialog);
|
---|
117 |
|
---|
118 | LogManager* logMgr;
|
---|
119 | Math* mth;
|
---|
120 | MaterialManager* matMgr;
|
---|
121 | SkeletonManager* skelMgr;
|
---|
122 | MeshSerializer* meshSerializer;
|
---|
123 | XMLMeshSerializer* xmlMeshSerializer;
|
---|
124 | SkeletonSerializer* skeletonSerializer;
|
---|
125 | XMLSkeletonSerializer* xmlSkeletonSerializer;
|
---|
126 | DefaultHardwareBufferManager *bufferManager;
|
---|
127 | MeshManager* meshMgr;
|
---|
128 | ResourceGroupManager* rgm;
|
---|
129 |
|
---|
130 |
|
---|
131 | };
|
---|
132 |
|
---|
133 |
|
---|
134 | #endif // CMESH_H |
---|