Changeset 5308 in orxonox.OLD for trunk/src/lib/graphics/importer
- Timestamp:
- Oct 8, 2005, 12:32:52 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/material.cc
r5306 r5308 57 57 Material::~Material() 58 58 { 59 PRINTF( 4)("delete Material %s.\n", this->getName());59 PRINTF(5)("delete Material %s.\n", this->getName()); 60 60 61 61 if (this->diffuseTexture != NULL) 62 { 62 63 ResourceManager::getInstance()->unload(this->diffuseTexture); 64 } 63 65 if (this->ambientTexture != NULL) 64 66 ResourceManager::getInstance()->unload(this->ambientTexture); … … 69 71 /** 70 72 * sets the material with which the following Faces will be painted 71 */72 bool Material::select () 73 */ 74 bool Material::select () const 73 75 { 74 76 // setting diffuse color … … 127 129 * Sets the Material Illumination Model. 128 130 * illu illumination Model in int form 129 */131 */ 130 132 void Material::setIllum (int illum) 131 133 { … … 133 135 this->illumModel = illum; 134 136 } 137 135 138 /** 136 139 * Sets the Material Illumination Model. 137 140 * illu illumination Model in char* form 138 */void Material::setIllum (char* illum) 141 */ 142 void Material::setIllum (char* illum) 139 143 { 140 144 this->setIllum (atoi(illum)); … … 146 150 * @param g Green Color Channel. 147 151 * @param b Blue Color Channel. 148 */152 */ 149 153 void Material::setDiffuse (float r, float g, float b) 150 154 { … … 156 160 157 161 } 162 158 163 /** 159 164 * Sets the Material Diffuse Color. 160 165 * @param rgb The red, green, blue channel in char format (with spaces between them) 161 */166 */ 162 167 void Material::setDiffuse (char* rgb) 163 168 { … … 181 186 this->ambient[3] = 1.0; 182 187 } 188 183 189 /** 184 190 * Sets the Material Ambient Color. 185 191 * @param rgb The red, green, blue channel in char format (with spaces between them) 186 */192 */ 187 193 void Material::setAmbient (char* rgb) 188 194 { … … 197 203 * @param g Green Color Channel. 198 204 * @param b Blue Color Channel. 199 */205 */ 200 206 void Material::setSpecular (float r, float g, float b) 201 207 { … … 206 212 this->specular[3] = 1.0; 207 213 } 214 208 215 /** 209 216 * Sets the Material Specular Color. … … 269 276 void Material::setDiffuseMap(const char* dMap) 270 277 { 271 PRINTF( 4)("setting Diffuse Map %s\n", dMap);278 PRINTF(5)("setting Diffuse Map %s\n", dMap); 272 279 if (this->diffuseTexture != NULL) 273 280 ResourceManager::getInstance()->unload(this->diffuseTexture); -
trunk/src/lib/graphics/importer/material.h
r4836 r5308 26 26 public: 27 27 Material (const char* mtlName = NULL); 28 ~Material ();28 virtual ~Material (); 29 29 30 bool select () ;30 bool select () const; 31 31 32 32 void setIllum (int illum); … … 58 58 float shininess; //!< The shininess of the Material. 59 59 float transparency; //!< The transperency of the Material. 60 60 public: 61 61 Texture* diffuseTexture; //!< The diffuse texture of the Material. 62 62 Texture* ambientTexture; //!< The ambient texture of the Material. -
trunk/src/lib/graphics/importer/model.cc
r5304 r5308 65 65 66 66 this->next = NULL; 67 68 67 } 69 68 … … 383 382 ////////// 384 383 /** 385 * 384 * adds a new Material to the Material List 386 385 * @param material the Material to add 387 386 * @returns the added material … … 392 391 Material* Model::addMaterial(Material* material) 393 392 { 393 if (material == NULL) 394 return NULL; 394 395 ModelMaterial* modMat = new ModelMaterial; 395 396 modMat->external = true; … … 408 409 ModelMaterial* modMat = new ModelMaterial; 409 410 modMat->external = false; 410 modMat->material = new Material(); 411 modMat->material->setName(materialName); 411 modMat->material = new Material(materialName); 412 412 413 413 // adding material to the List of materials … … 474 474 float subbuffer3; 475 475 sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 476 PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);477 476 this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor); 478 477 this->vertexCount++; … … 507 506 float subbuffer3; 508 507 sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 509 PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);510 508 this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3); 511 509 this->normalCount++; … … 543 541 float subbuffer2; 544 542 sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2); 545 PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);546 543 this->vTexture->addEntry(subbuffer1); 547 544 this->vTexture->addEntry(1 - subbuffer2); … … 659 656 660 657 /** 661 * 658 * Function that selects a material, if changed in the obj file. 662 659 * @param matString the Material that will be set. 663 660 */ … … 674 671 675 672 /** 676 * 673 * Function that selects a material, if changed in the obj file. 677 674 * @param mtl the Material that will be set. 678 675 */ … … 1106 1103 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19); 1107 1104 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23); 1108 1109 } 1105 } -
trunk/src/lib/graphics/importer/texture.h
r5304 r5308 21 21 22 22 //! A Class, that reads in Textures from different fileformats. 23 class Texture : public 23 class Texture : public BaseObject 24 24 { 25 25 public:
Note: See TracChangeset
for help on using the changeset viewer.