home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 March / ENTER.ISO / files / fwp-0.0.6-win32-installer.exe / Mesh.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-12-06  |  2.1 KB  |  102 lines

  1. #ifndef __Mesh_h__
  2. #define __Mesh_h__
  3.  
  4. #include "Texture.h"
  5. #include "Material.h"
  6. #include "Face.h"
  7. //#include "LightEffectsParticleClusters.h"
  8.  
  9. //#include "shader.h"
  10. class Shader;
  11. class Model;
  12.  
  13. enum meshRenderModes_e{
  14.     MESH_RENDER_MODE_DO_NOT_RENDER=0,
  15.     MESH_RENDER_MODE_SINGLE_POLYGON,
  16.     MESH_RENDER_MODE_SINGLE_TRIANGLE,
  17.     MESH_RENDER_MODE_TRIANGLE_ARRAY,
  18.  
  19.     NUM_MESH_RENDER_MODES
  20. };
  21.  
  22.  
  23. //#define MESH_MAX_DYNAMIC_LIGHTS    4
  24.  
  25.  
  26. //class DynamicLightParticleCluster;
  27.  
  28. class Mesh{
  29. public:
  30.     char* name;
  31.     Mesh* parent;
  32.     Mesh** childs;
  33.     int numChilds;
  34.  
  35.     GLfloat* vertices;
  36.     GLfloat* colors;
  37.     GLfloat* secondaryColors;
  38.     GLfloat* normals;
  39.     GLfloat* texCoords1;
  40.     GLfloat* texCoords2;
  41.     GLuint* indices;
  42.     int numVertices;
  43.     int numColors;
  44.     int numSecondaryColors;
  45.     int numNormals;
  46.     int numTexCoords;
  47.     int numIndices;
  48.     GLuint vertexVBOName;
  49.     GLuint colorVBOName;
  50.     GLuint secondaryColorVBOName;
  51.     GLuint normalVBOName;
  52.     GLuint texCoord1VBOName;
  53.     GLuint texCoord2VBOName;
  54.     GLuint indexVBOName;
  55.  
  56.  
  57.     Face** faces;
  58.     Material** materials;
  59.     int numFaces;
  60.     int numMaterials;
  61.  
  62.     GLfloat transformationMatrix[16];
  63.  
  64.     int renderMode;
  65.     bool hasTransparentFaces;
  66.     bool isTriangulation;
  67.     bool hasLightmapsForAllFaces;
  68.     bool hasSecondMappingChannel;
  69.  
  70. //    DynamicLightParticleCluster* dynamicLightParticleClusters[MESH_MAX_DYNAMIC_LIGHTS];
  71.  
  72.     Mesh();
  73.     Mesh(File* f, Model* model);
  74.     ~Mesh();
  75.     void clearMesh();
  76.  
  77.     int addMaterial(Material* mat);
  78.     int addArrayElement(GLfloat v[3], GLfloat c[3], GLfloat n[3], GLfloat t1[2], GLfloat t2[2]);
  79.     int addFace(Face *face);
  80.     int addChild(Mesh* child);
  81.  
  82. //    void addDynamicLightParticleCluster(DynamicLightParticleCluster* pc);
  83. //    void removeDynamicLightParticleCluster(DynamicLightParticleCluster* pc);
  84.  
  85.  
  86.     void setRenderMode();
  87.     void createVBOs();
  88.     void freeVBOs();
  89.     void createSecondaryColors();
  90.     void updateSecondaryColorVBO();
  91.     int getMaterialId(Material* m);
  92.     void swapFaces(int i, int j);
  93.     void sortFacesByMaterial();
  94.  
  95.     bool readFromFile(File* f, Model* model);
  96.     void dump();
  97. };
  98.  
  99.  
  100.  
  101. #endif    /* __Mesh_h__ */
  102.