Changeset 3894 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer
- Timestamp:
- Apr 19, 2005, 6:48:49 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/material.cc
r3803 r3894 34 34 \param mtlName Name of the Material to be added to the Material List 35 35 */ 36 Material::Material (c har* mtlName)36 Material::Material (const char* mtlName) 37 37 { 38 38 PRINTF(4)("initializing new Material.\n"); 39 39 this->nextMat = NULL; 40 this->name = "";40 this->name = NULL; 41 41 this->setIllum(3); 42 42 this->setDiffuse(0,0,0); … … 55 55 this->specularTextureSet = false; 56 56 57 if (mtlName) 58 this->setName (mtlName); 59 else 60 this->setName(""); 57 this->setName(mtlName); 61 58 } 62 59 … … 80 77 \param mtlName The name of the Material to be added. 81 78 */ 82 Material* Material::addMaterial(c har* mtlName)79 Material* Material::addMaterial(const char* mtlName) 83 80 { 84 81 PRINTF(4)("adding Material %s.\n", mtlName); … … 98 95 \returns Material named mtlName if it is found. NULL otherwise. 99 96 */ 100 Material* Material::search(c har* mtlName)97 Material* Material::search(const char* mtlName) 101 98 { 102 99 PRINTF(5)("Searching for material %s", mtlName); … … 168 165 \param mtlName the Name of the Material to be set. 169 166 */ 170 void Material::setName (char* mtlName) 171 { 172 PRINTF(4)("setting Material Name to %s.\n", this->name); 173 this->name = new char [strlen(mtlName)+1]; 174 strcpy(this->name, mtlName); 167 void Material::setName (const char* mtlName) 168 { 169 if (this->name) 170 delete this->name; 171 if (mtlName) 172 { 173 this->name = new char [strlen(mtlName)+1]; 174 strcpy(this->name, mtlName); 175 } 176 else 177 { 178 this->name = new char[2]; 179 strcpy(this->name, ""); 180 } 175 181 } 176 182 -
orxonox/trunk/src/lib/graphics/importer/material.h
r3803 r3894 14 14 #endif /* HAVE_CONFIG_H */ 15 15 16 #ifndef NULL 17 #define NULL 0 18 #endif 19 16 20 // FORWARD DEFINITIONS // 17 21 class Texture; … … 22 26 { 23 27 public: 24 Material (c har* mtlName = "");25 Material* addMaterial(c har* mtlName);28 Material (const char* mtlName = NULL); 29 Material* addMaterial(const char* mtlName); 26 30 ~Material (); 27 31 28 Material* search(c har* mtlName);32 Material* search(const char* mtlName); 29 33 bool select (void); 30 34 31 void setName (c har* mtlName);35 void setName (const char* mtlName); 32 36 char* getName (void); 33 37 void setIllum (int illum); -
orxonox/trunk/src/lib/graphics/importer/model.cc
r3801 r3894 323 323 With it you should be able to import .obj-files with more than one Models inside. 324 324 */ 325 bool Model::addGroup (c har* groupString)325 bool Model::addGroup (const char* groupString) 326 326 { 327 327 PRINTF(5)("Read Group: %s.\n", groupString); … … 366 366 367 367 */ 368 bool Model::addVertex( const float x, const float y, constfloat z)368 bool Model::addVertex(float x, float y, float z) 369 369 { 370 370 PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z); … … 441 441 \param type 0: vertex only, 1: vertex and normal, 2: vertex and Texture, 3 vertex, normal and texture 442 442 */ 443 bool Model::addFace( const float faceElemCount, int type, ...)443 bool Model::addFace(int faceElemCount, int type, ...) 444 444 { 445 445 if (this->currentGroup->faceCount > 0) … … 496 496 If a vertexNormal line is found this function will inject it into the vertexNormal-Array 497 497 */ 498 bool Model::addVertexNormal( const float x, const float y, constfloat z)498 bool Model::addVertexNormal(float x, float y, float z) 499 499 { 500 500 PRINTF(3)("found vertex-Normal %f, %f, %f\n", x, y, z); … … 527 527 If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array 528 528 */ 529 bool Model::addVertexTexture( const float u, constfloat v)530 { 531 PRINTF( 3)("found vertex-Texture %f, %f\n", u, v);529 bool Model::addVertexTexture(float u, float v) 530 { 531 PRINTF(5)("found vertex-Texture %f, %f\n", u, v); 532 532 this->vTexture->addEntry(u); 533 533 this->vTexture->addEntry(v); … … 538 538 \param matString the Material that will be set. 539 539 */ 540 bool Model::addUseMtl (c har* matString)540 bool Model::addUseMtl (const char* matString) 541 541 { 542 542 /* -
orxonox/trunk/src/lib/graphics/importer/model.h
r3801 r3894 19 19 #define NORMAL 1 //!< If Faces are created WITH Normals (otherwise autocalculate) 20 20 #define TEXCOORD 2 //!< If Faces are created WITH TextureCoordinate 21 //! an enumerator for VERTEX_FORMAT 22 enum VERTEX_FORMAT {VERTEX_ONLY = VERTEX, 23 VERTEX_NORMAL = NORMAL, 24 VERTEX_TEXCOORD = TEXCOORD, 25 VERTEXT_TEXTURE_NORMAL = NORMAL | TEXCOORD}; 21 26 22 27 //! Class that handles 3D-Models. it can also read them in and display them. … … 96 101 97 102 public: 98 bool addGroup(c har* groupString);103 bool addGroup(const char* groupString); 99 104 bool addVertex(char* vertexString); 100 bool addVertex( const float x, const float y, constfloat z);105 bool addVertex(float x, float y, float z); 101 106 bool addFace(char* faceString); 102 bool addFace( const float faceElemCount, int type, ...);107 bool addFace(int faceElemCount, int type, ...); 103 108 bool addVertexNormal(char* normalString); 104 bool addVertexNormal( const float x, const float y, constfloat z);109 bool addVertexNormal(float x, float y, float z); 105 110 bool addVertexTexture(char* vTextureString); 106 bool addVertexTexture( const float u, constfloat v);107 bool addUseMtl(c har* mtlString);111 bool addVertexTexture(float u, float v); 112 bool addUseMtl(const char* mtlString); 108 113 bool addUseMtl(Material* mtl); 109 114 void finalize(void);
Note: See TracChangeset
for help on using the changeset viewer.