1 2 #ifndef __MESH_H_ 3 #define __MESH_H_ 4 5 6 #include <osg/Vec3f> 7 #include <osg/StateSet> 8 9 #include "MDLLimits.h" 10 11 12 namespace mdl 13 { 14 15 16 struct MDLMeshVertexData 17 { 18 // Used by the Source engine for cache purposes. This value is allocated 19 // in the file, but no meaningful data is stored there 20 int model_vertex_data_ptr; 21 22 // Indicates the number of vertices used by each LOD of this mesh 23 int num_lod_vertices[MAX_LODS]; 24 }; 25 26 27 struct MDLMesh 28 { 29 int material_index; 30 int model_index; 31 32 int num_vertices; 33 int vertex_offset; 34 35 int num_flexes; 36 int flex_offset; 37 38 int material_type; 39 int material_param; 40 41 int mesh_id; 42 43 osg::Vec3f mesh_center; 44 45 MDLMeshVertexData vertex_data; 46 47 int unused_array[8]; 48 }; 49 50 51 class Mesh 52 { 53 protected: 54 55 MDLMesh * my_mesh; 56 57 osg::ref_ptr<osg::StateSet> state_set; 58 59 public: 60 61 Mesh(MDLMesh * myMesh); 62 virtual ~Mesh(); 63 64 void setStateSet(osg::StateSet * stateSet); 65 osg::StateSet * getStateSet(); 66 67 MDLMesh * getMesh(); 68 69 int getNumLODVertices(int lodNum); 70 }; 71 72 73 } 74 75 #endif 76 77