home *** CD-ROM | disk | FTP | other *** search
- #ifndef __Mesh_h__
- #define __Mesh_h__
-
- #include "Texture.h"
- #include "Material.h"
- #include "Face.h"
- //#include "LightEffectsParticleClusters.h"
-
- //#include "shader.h"
- class Shader;
- class Model;
-
- enum meshRenderModes_e{
- MESH_RENDER_MODE_DO_NOT_RENDER=0,
- MESH_RENDER_MODE_SINGLE_POLYGON,
- MESH_RENDER_MODE_SINGLE_TRIANGLE,
- MESH_RENDER_MODE_TRIANGLE_ARRAY,
-
- NUM_MESH_RENDER_MODES
- };
-
-
- //#define MESH_MAX_DYNAMIC_LIGHTS 4
-
-
- //class DynamicLightParticleCluster;
-
- class Mesh{
- public:
- char* name;
- Mesh* parent;
- Mesh** childs;
- int numChilds;
-
- GLfloat* vertices;
- GLfloat* colors;
- GLfloat* secondaryColors;
- GLfloat* normals;
- GLfloat* texCoords1;
- GLfloat* texCoords2;
- GLuint* indices;
- int numVertices;
- int numColors;
- int numSecondaryColors;
- int numNormals;
- int numTexCoords;
- int numIndices;
- GLuint vertexVBOName;
- GLuint colorVBOName;
- GLuint secondaryColorVBOName;
- GLuint normalVBOName;
- GLuint texCoord1VBOName;
- GLuint texCoord2VBOName;
- GLuint indexVBOName;
-
-
- Face** faces;
- Material** materials;
- int numFaces;
- int numMaterials;
-
- GLfloat transformationMatrix[16];
-
- int renderMode;
- bool hasTransparentFaces;
- bool isTriangulation;
- bool hasLightmapsForAllFaces;
- bool hasSecondMappingChannel;
-
- // DynamicLightParticleCluster* dynamicLightParticleClusters[MESH_MAX_DYNAMIC_LIGHTS];
-
- Mesh();
- Mesh(File* f, Model* model);
- ~Mesh();
- void clearMesh();
-
- int addMaterial(Material* mat);
- int addArrayElement(GLfloat v[3], GLfloat c[3], GLfloat n[3], GLfloat t1[2], GLfloat t2[2]);
- int addFace(Face *face);
- int addChild(Mesh* child);
-
- // void addDynamicLightParticleCluster(DynamicLightParticleCluster* pc);
- // void removeDynamicLightParticleCluster(DynamicLightParticleCluster* pc);
-
-
- void setRenderMode();
- void createVBOs();
- void freeVBOs();
- void createSecondaryColors();
- void updateSecondaryColorVBO();
- int getMaterialId(Material* m);
- void swapFaces(int i, int j);
- void sortFacesByMaterial();
-
- bool readFromFile(File* f, Model* model);
- void dump();
- };
-
-
-
- #endif /* __Mesh_h__ */
-