Changeset 3910 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 21, 2005, 12:58:50 AM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/framework.cc
r3909 r3910 58 58 int main(int argc, char *argv[]) 59 59 { 60 verbose = 4;60 verbose = 3; 61 61 62 62 Uint8* keys; // This variable will be used in the keyboard routine -
orxonox/trunk/src/lib/graphics/importer/model.cc
r3909 r3910 522 522 \param matString the Material that will be set. 523 523 */ 524 bool Model::addUseMtl 524 bool Model::addUseMtl(const char* matString) 525 525 { 526 526 if (this->currentGroup->faceCount > 0) … … 538 538 \param mtl the Material that will be set. 539 539 */ 540 bool Model::addUseMtl 540 bool Model::addUseMtl(Material* mtl) 541 541 { 542 542 if (this->currentGroup->faceCount > 0) -
orxonox/trunk/src/lib/graphics/importer/model.h
r3909 r3910 12 12 class Array; 13 13 class Vector; 14 template<class T> class tList; 15 16 14 17 15 18 using namespace std; … … 28 31 class Model 29 32 { 30 public: 31 Model(const char* modelName = NULL); 32 virtual ~Model(void); 33 34 void setName(const char* name); 35 36 void draw(void) const; 37 void draw(int groupNumber) const; 38 void draw(char* groupName) const; 39 int getGroupCount() const; 40 41 protected: 42 char* name; //!< This is the name of the Model. 43 bool finalized; //!< Sets the Object to be finalized. 44 33 private: 34 ///////////// 35 // structs // 36 ///////////// 45 37 //! This is the placeholder of one Vertex beloning to a Face. 46 38 struct FaceElement … … 77 69 }; 78 70 71 char* name; //!< This is the name of the Model. 72 bool finalized; //!< Sets the Object to be finalized. 79 73 80 74 Array* vertices; //!< The Array that handles the Vertices. … … 83 77 Array* vTexture; //!< The Array that handles the VertexTextureCoordinates. 84 78 85 86 79 Group* firstGroup; //!< The first of all groups. 87 80 Group* currentGroup; //!< The currentGroup. this is the one we will work with. 88 81 int groupCount; //!< The Count of Groups. 89 82 90 Material* material; //!< Initial pointer to the Material. This can hold many materials, because Material can be added with Material::addMaterial(..)91 float scaleFactor; //!< The Factor with which the Model should be scaled. \todo maybe one wants to scale the Model after Initialisation92 93 83 bool initGroup(Group* group); 94 84 bool initFace (Face* face); 95 bool cleanup(void); 85 96 86 bool cleanupGroup(Group* group); 97 87 bool cleanupFace(Face* face); 98 88 bool cleanupFaceElement(FaceElement* faceElem); 99 89 90 bool addGLElement(FaceElement* elem); 91 92 bool buildVertexNormals(void); 93 94 protected: 95 float scaleFactor; //!< The Factor with which the Model should be scaled. \todo maybe one wants to scale the Model after Initialisation 96 Material* material; //!< Initial pointer to the Material. This can hold many materials, because Material can be added with Material::addMaterial(..) 97 98 bool importToGL(void); 99 void cubeModel(void); 100 101 bool cleanup(void); 102 100 103 public: 104 Model(const char* modelName = NULL); 105 virtual ~Model(void); 106 107 void setName(const char* name); 108 inline const char* getName() {return this->name;} 109 110 void draw(void) const; 111 void draw(int groupNumber) const; 112 void draw(char* groupName) const; 113 int getGroupCount() const; 114 101 115 bool addGroup(const char* groupString); 102 116 bool addVertex(const char* vertexString); … … 111 125 bool addUseMtl(Material* mtl); 112 126 void finalize(void); 113 114 protected:115 bool importToGL(void);116 bool addGLElement(FaceElement* elem);117 118 bool buildVertexNormals(void);119 120 void cubeModel(void);121 127 }; 122 128 -
orxonox/trunk/src/lib/graphics/importer/objModel.cc
r3909 r3910 129 129 } 130 130 131 char readLine[PARSELINELENGTH];132 131 char buffer[PARSELINELENGTH]; 133 while(fgets(readLine, PARSELINELENGTH, stream)) 134 { 135 strcpy(buffer, readLine); 132 while(fgets(buffer, PARSELINELENGTH, stream)) 133 { 134 // line termiated with \0 not \n 135 if (buffer[strlen(buffer)-1] == '\n') 136 buffer[strlen(buffer)-1] = '\0'; 137 136 138 // case vertice 137 139 if (!strncmp(buffer, "v ", 2)) … … 207 209 } 208 210 209 char readLine[PARSELINELENGTH];210 211 char buffer[PARSELINELENGTH]; 211 212 Material* tmpMat = material; 212 while(fgets( readLine, PARSELINELENGTH, stream))213 while(fgets(buffer, PARSELINELENGTH, stream)) 213 214 { 214 215 PRINTF(5)("found line in mtlFile: %s\n", buffer); 216 217 // line termiated with \0 not \n 218 if (buffer[strlen(buffer)-1] == '\n') 219 buffer[strlen(buffer)-1] = '\0'; 215 220 216 221 // create new Material
Note: See TracChangeset
for help on using the changeset viewer.