Changeset 10141 in orxonox.OLD for trunk/src/lib/graphics/importer/static_model_data.h
- Timestamp:
- Dec 23, 2006, 12:05:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/static_model_data.h
r9869 r10141 27 27 }; 28 28 29 ////////////////////30 /// SUB-ELEMENTS ///31 ////////////////////32 //! This is the placeholder of one Vertex beloning to a Face.33 class ModelFaceElement34 {35 public:36 ModelFaceElement();37 ~ModelFaceElement();38 29 39 int vertexNumber; //!< The number of the Vertex out of the Array* vertices, this vertex points to.40 int normalNumber; //!< The number of the Normal out of the Array* normals, this vertex points to.41 int texCoordNumber; //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.42 43 ModelFaceElement* next; //!< Point to the next FaceElement in this List.44 };45 46 //! This is the placeholder of a Face belonging to a Group of Faces.47 class ModelFace48 {49 public:50 ModelFace();51 ~ModelFace();52 53 unsigned int vertexCount; //!< The Count of vertices this Face has.54 ModelFaceElement* firstElem; //!< Points to the first Vertex (FaceElement) of this Face.55 Material* material; //!< The Material to use.56 57 ModelFace* next; //!< Pointer to the next Face.58 };59 60 //! Group to handle multiple Models per obj-file.61 class ModelGroup62 {63 public:64 ModelGroup();65 ~ModelGroup();66 67 void cleanup();68 69 std::string name; //!< the Name of the Group. this is an identifier, that can be accessed via the draw (std::string name) function.70 GLubyte* indices; //!< The indices of the Groups. Needed for vertex-arrays71 GLuint listNumber; //!< The number of the GL-List this Group gets.72 ModelFace* firstFace; //!< The first Face in this group.73 ModelFace* currentFace; //!< The current Face in this Group (the one we are currently working with.)74 int faceMode; //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material, 3 for triangle, 4 for Quad, 5+ for Poly @todo ENUM...75 int faceCount; //!< The Number of Faces this Group holds.76 77 ModelGroup* next; //!< Pointer to the next Group.78 };79 80 struct ModelMaterial81 {82 Material* material;83 bool external;84 };85 30 86 31 ///////////// … … 95 40 { 96 41 ObjectListDeclaration(StaticModelData); 42 43 private: 44 //////////////////// 45 /// SUB-ELEMENTS /// 46 //////////////////// 47 //! This is the placeholder of one Vertex beloning to a Face. 48 class FaceElement 49 { 97 50 public: 98 typedef CountPointer<StaticModelData> Pointer; 51 FaceElement(); 52 53 int vertexNumber; //!< The number of the Vertex out of the Array* vertices, this vertex points to. 54 int normalNumber; //!< The number of the Normal out of the Array* normals, this vertex points to. 55 int texCoordNumber; //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to. 56 }; 57 58 //! This is the placeholder of a Face belonging to a Group of Faces. 59 class Face 60 { 61 public: 62 Face(); 63 64 std::vector<FaceElement> _elements; //!< Elements of the Face. 65 Material* _material; //!< The Material to use. 66 }; 67 68 //! Group to handle multiple Models per obj-file. 69 class Group 70 { 71 public: 72 Group(); 73 ~Group(); 74 75 //! Compares the name with the groups name. 76 bool operator==(const std::string& name) const { return this->name == name; }; 77 void cleanup(); 78 79 std::string name; //!< the Name of the Group. this is an identifier, that can be accessed via the draw (std::string name) function. 80 GLubyte* indices; //!< The indices of the Groups. Needed for vertex-arrays 81 GLuint listNumber; //!< The number of the GL-List this Group gets. 82 int faceMode; //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material, 3 for triangle, 4 for Quad, 5+ for Poly @todo ENUM... 83 84 std::vector<Face> _faces; //!< Faces. 85 }; 99 86 100 87 public: 88 typedef CountPointer<StaticModelData> Pointer; 89 90 public: 101 91 StaticModelData(const std::string& modelName = ""); 102 92 virtual ~StaticModelData(); 103 93 104 94 void draw() const; 105 void draw( int groupNumber) const;95 void draw(unsigned int groupNumber) const; 106 96 void draw(const std::string& groupName) const; 107 97 108 98 void rebuild(); 109 99 110 Material* addMaterial( Material*material);100 Material* addMaterial(const Material& material); 111 101 Material* addMaterial(const std::string& materialName); 112 102 … … 151 141 bool buildTriangleList(); 152 142 153 bool addGLElement( ModelFaceElement*elem);143 bool addGLElement(const StaticModelData::FaceElement& elem); 154 144 155 145 bool cleanup(); … … 168 158 std::vector<sTriangleExt> triangles; //!< The Triangles if built. 169 159 170 ModelGroup* firstGroup; //!< The first of all groups.171 ModelGroup* currentGroup; //!< The currentGroup. this is the one we will work with.172 int groupCount; //!< The Count of Groups.173 160 174 std::list<ModelMaterial*> materialList; //!< A list for all the Materials in this Model 161 std::vector<Group> _modelGroups; 162 163 std::list<Material> materialList; //!< A list for all the Materials in this Model 175 164 }; 176 165
Note: See TracChangeset
for help on using the changeset viewer.