Changeset 6308 in orxonox.OLD for trunk/src/lib/graphics/importer
- Timestamp:
- Dec 27, 2005, 1:51:26 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/Makefile.am
r6100 r6308 5 5 6 6 libORXimporter_a_SOURCES = model.cc \ 7 tc.c \ 7 8 vertex_array_model.cc \ 8 9 static_model.cc \ … … 18 19 19 20 noinst_HEADERS = model.h \ 21 tc.h \ 20 22 vertex_array_model.h \ 21 23 static_model.h \ … … 28 30 height_map.h \ 29 31 anorms.h \ 30 anormtab.h 32 anormtab.h -
trunk/src/lib/graphics/importer/model.h
r6222 r6308 32 32 typedef struct 33 33 { 34 unsigned int indexToVertices[3]; //!< index to the vert eces of the triangle34 unsigned int indexToVertices[3]; //!< index to the vertices of the triangle 35 35 unsigned int indexToNormals[3]; //!< index to the normals of the triangle 36 36 unsigned int indexToTexCoor[3]; //!< index to the texture coordinates … … 83 83 inline sTriangleExt* getTriangles() const { return this->pModelInfo.pTriangles; }; 84 84 /** @returns the Count of Faces of this Model */ 85 inline unsigned int get FaceCount() const { return this->pModelInfo.numTriangles; };85 inline unsigned int getTriangleCount() const { return this->pModelInfo.numTriangles; }; 86 86 87 87 -
trunk/src/lib/graphics/importer/vertex_array_model.cc
r6038 r6308 21 21 #include <stdarg.h> 22 22 23 #include "tc.h" 24 23 25 using namespace std; 24 26 … … 39 41 } 40 42 41 42 /** 43 * @brief deletes an VertexArrayModel. 43 /** 44 * @brief special copy constructor for converting Models to VertexArray-Stripes 45 * @param model the Model to produce a VertexArray model from. 46 * 47 * Code that uses Brad Granthams 48 * excelent TC-code for generating stripes out of a mix of ModelCoordinates. 49 */ 50 VertexArrayModel::VertexArrayModel(const Model& model) 51 { 52 this->setClassID(CL_MODEL, "VertexArrayModel"); 53 this->bFinalized = false; 54 this->newStripe(); 55 56 for (unsigned int i = 0; i < model.getVertexCount(); i+=3) 57 this->addVertex(model.getVertexArray()[i], model.getVertexArray()[i+1], model.getVertexArray()[i+2]); 58 for (unsigned int i = 0; i < model.getNormalsCount(); i+=3) 59 this->addNormal(model.getNormalsArray()[i], model.getNormalsArray()[i+1], model.getNormalsArray()[i+2]); 60 for (unsigned int i = 0; i < model.getTexCoordCount(); i+=2) 61 this->addTexCoor(model.getTexCoordArray()[i], model.getTexCoordArray()[i+1]); 62 63 // The acTC object generating this Model. // 64 ACTCData *tc; 65 tc = actcNew(); 66 if(tc == NULL) { 67 /* memory allocation failed */ 68 /* print error here and exit or whatever */ 69 } 70 71 // inputing the data of model to the tc 72 actcBeginInput(tc); 73 for(unsigned int i = 0; i < model.getTriangleCount(); i++) 74 actcAddTriangle(tc, model.getTriangles()[i].indexToVertices[0], model.getTriangles()[i].indexToVertices[1], model.getTriangles()[i].indexToVertices[2]); 75 actcEndInput(tc); 76 77 // importing the data to the new Model. 78 int prim; 79 unsigned int v1, v2, v3; 80 81 actcBeginOutput(tc); 82 while((prim = actcStartNextPrim(tc, &v1, &v2) != ACTC_DATABASE_EMPTY)) 83 { 84 this->addIndice(v1); 85 this->addIndice(v2); 86 /* start a primitive of type "prim" with v1 and v2 */ 87 while(actcGetNextVert(tc, &v3) != ACTC_PRIM_COMPLETE) 88 { 89 /* continue primitive using v3 */ 90 this->addIndice(v3); 91 } 92 this->newStripe(); 93 } 94 actcEndOutput(tc); 95 96 this->finalize(); 97 } 98 99 /** 100 * @brief deletes a VertexArrayModel. 44 101 * 45 102 * Looks if any from model allocated space is still in use, and if so deleted it. … … 75 132 glVertexPointer(3, GL_FLOAT, 0, this->vertices.getArray()); 76 133 glNormalPointer(GL_FLOAT, 0, this->normals.getArray()); 77 glTexCoordPointer(2, GL_FLOAT, 0, this->texCoords.getArray()); 134 glTexCoordPointer(2, GL_FLOAT, 0, this->texCoords.getArray()); 78 135 79 136 for (GLuint i = 1; i < this->stripes.size(); ++i) -
trunk/src/lib/graphics/importer/vertex_array_model.h
r6037 r6308 29 29 public: 30 30 VertexArrayModel(); 31 VertexArrayModel(const Model& model); 31 32 virtual ~VertexArrayModel(); 32 33 … … 43 44 void finalize(); 44 45 45 // 46 // 46 47 void planeModel(); 47 48
Note: See TracChangeset
for help on using the changeset viewer.