- Timestamp:
- Dec 3, 2004, 8:22:38 PM (20 years ago)
- Location:
- orxonox/trunk/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/importer/framework.cc
r3069 r3070 87 87 glLightfv(GL_LIGHT1, GL_SPECULAR, whiteLight); 88 88 89 90 glEnable(GL_TEXTURE_2D); 89 91 rotatorP = .0; 90 92 rotatorV = .0; -
orxonox/trunk/importer/material.cc
r3069 r3070 84 84 setShininess(2.0); 85 85 setTransparency(0.0); 86 87 diffuseTextureSet = false; 88 ambientTextureSet = false; 89 specularTextureSet = false; 90 86 91 87 92 } … … 243 248 setTransparency (atof(tr)); 244 249 } 250 251 // MAPPING // 252 253 /** 254 \brief Sets the Materials Diffuse Map 255 \param dMap the Name of the Image to Use 256 */ 257 void Material::setDiffuseMap(char* dMap) 258 { 259 if (verbose>=2) 260 printf ("setting Diffuse Map %s\n", dMap); 261 262 diffuseTextureSet = loadBMP(dMap, &diffuseTexture); 263 264 } 265 266 /** 267 \brief Sets the Materials Ambient Map 268 \param aMap the Name of the Image to Use 269 */ 270 void Material::setAmbientMap(char* aMap) 271 { 272 SDL_Surface* ambientMap; 273 274 } 275 276 /** 277 \brief Sets the Materials Specular Map 278 \param sMap the Name of the Image to Use 279 */ 280 void Material::setSpecularMap(char* sMap) 281 { 282 SDL_Surface* specularMap; 283 284 } 285 286 /** 287 \brief Sets the Materials Bumpiness 288 \param bump the Name of the Image to Use 289 */ 290 void Material::setBump(char* bump) 291 { 292 293 } 294 295 /** 296 \brief reads in a Windows BMP-file, and imports it to openGL. 297 \param bmpName The name of the Image to load. 298 \param texture A pointer to the Texture which should be read to. 299 */ 300 bool Material::loadBMP (char* bmpName, GLuint* texture) 301 { 302 SDL_Surface* map; 303 if (map = SDL_LoadBMP(bmpName)) 304 { 305 306 glGenTextures( 1, texture ); 307 /* Typical Texture Generation Using Data From The Bitmap */ 308 glBindTexture( GL_TEXTURE_2D, *texture ); 309 310 /* Generate The Texture */ 311 glTexImage2D( GL_TEXTURE_2D, 0, 3, map->w, 312 map->h, 0, GL_BGR, 313 GL_UNSIGNED_BYTE, map->pixels ); 314 315 /* Linear Filtering */ 316 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); 317 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); 318 if ( map ) 319 SDL_FreeSurface( map ); 320 321 return true; 322 } 323 else 324 return false; 325 } 326 327 328 245 329 246 330 /** … … 294 378 else if (illumModel >= 2) 295 379 glShadeModel(GL_SMOOTH); 296 } 380 381 if (diffuseTextureSet) 382 glBindTexture(GL_TEXTURE_2D, diffuseTexture); 383 384 } -
orxonox/trunk/importer/material.h
r3069 r3070 11 11 #include <GL/gl.h> 12 12 #include <GL/glu.h> 13 #include <SDL/SDL.h> 13 14 #include <stdlib.h> 14 15 #include <fstream> … … 25 26 ~Material (); 26 27 28 GLuint diffuseTexture; 29 GLuint ambientTexture; 30 GLuint specularTexture; 31 32 bool diffuseTextureSet; 33 bool ambientTextureSet; 34 bool specularTextureSet; 27 35 28 36 void setName (char* mtlName); … … 40 48 void setTransparency (float trans); 41 49 void setTransparency (char* trans); 50 51 // MAPPING // 52 void setDiffuseMap(char* dMap); 53 void setAmbientMap(char* aMap); 54 void setSpecularMap(char* sMap); 55 void setBump(char* bump); 56 57 bool loadBMP (char* bmpName, GLuint* texture); 58 42 59 43 60 Material* search (char* mtlName); -
orxonox/trunk/importer/object.cc
r3069 r3070 575 575 tmpMat->setTransparency(Buffer+2); 576 576 } 577 else if (!strnc py(Buffer, "Tf ", 3))577 else if (!strncmp(Buffer, "Tf ", 3)) 578 578 { 579 579 tmpMat->setTransparency(Buffer+3); 580 580 } 581 582 else if (!strncmp(Buffer, "map_Kd ", 7)) 583 { 584 tmpMat->setDiffuseMap(Buffer+7); 585 } 586 else if (!strncmp(Buffer, "map_Ka ", 7)) 587 { 588 tmpMat->setAmbientMap(Buffer+7); 589 } 590 else if (!strncmp(Buffer, "map_Ks ", 7)) 591 { 592 tmpMat->setSpecularMap(Buffer+7); 593 } 594 else if (!strncmp(Buffer, "bump ", 5)) 595 { 596 tmpMat->setBump(Buffer+7); 597 } 598 581 599 582 600 }
Note: See TracChangeset
for help on using the changeset viewer.