Changeset 3790 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer
- Timestamp:
- Apr 13, 2005, 12:33:07 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
r3672 r3790 30 30 using namespace std; 31 31 32 33 /**34 \brief creates a default Material with no Name35 normally you call this to create a material List (for an obj-file) and then append with addMaterial()36 */37 Material::Material()38 {39 this->init();40 41 this->setName ("");42 }43 44 32 /** 45 33 \brief creates a Material. … … 48 36 Material::Material (char* mtlName) 49 37 { 50 this->init(); 51 52 this->setName (mtlName); 38 PRINTF(4)("initializing new Material.\n"); 39 this->nextMat = NULL; 40 this->name =""; 41 this->setIllum(3); 42 this->setDiffuse(0,0,0); 43 this->setAmbient(0,0,0); 44 this->setSpecular(.5,.5,.5); 45 this->setShininess(2.0); 46 this->setTransparency(1.0); 47 48 49 this->diffuseTexture = NULL; 50 this->ambientTexture = NULL; 51 this->specularTexture = NULL; 52 53 this->diffuseTextureSet = false; 54 this->ambientTextureSet = false; 55 this->specularTextureSet = false; 56 57 if (mtlName) 58 this->setName (mtlName); 59 else 60 this->setName(""); 53 61 } 54 62 … … 86 94 87 95 /** 88 \brief initializes a new Material with its default Values89 */90 void Material::init(void)91 {92 PRINTF(4)("initializing new Material.\n");93 this->nextMat = NULL;94 this->name ="";95 this->setIllum(3);96 this->setDiffuse(0,0,0);97 this->setAmbient(0,0,0);98 this->setSpecular(.5,.5,.5);99 this->setShininess(2.0);100 this->setTransparency(0.0);101 102 103 this->diffuseTexture = NULL;104 this->ambientTexture = NULL;105 this->specularTexture = NULL;106 107 this->diffuseTextureSet = false;108 this->ambientTextureSet = false;109 this->specularTextureSet = false;110 }111 112 /**113 96 \brief Search for a Material called mtlName 114 97 \param mtlName the Name of the Material to search for … … 151 134 glMaterialf(GL_FRONT, GL_SHININESS, this->shininess); 152 135 136 // setting the transparency 137 if (this->transparency == 1.0) 138 { 139 glDisable(GL_BLEND); 140 } 141 else 142 { 143 glEnable(GL_BLEND); 144 glColor4f(1.0f, 1.0f, 1.0f, this->transparency); 145 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 146 } 147 153 148 // setting illumination Model 154 149 if (this->illumModel == 1) //! \todo make this work, if no vertex-normals are read. -
orxonox/trunk/src/lib/graphics/importer/material.h
r3590 r3790 22 22 { 23 23 public: 24 Material (); 25 Material (char* mtlName); 24 Material (char* mtlName = ""); 26 25 Material* addMaterial(char* mtlName); 27 26 ~Material (); 28 void init(void);29 27 30 28 Material* search(char* mtlName); -
orxonox/trunk/src/lib/graphics/importer/texture.cc
r3660 r3790 98 98 } 99 99 100 #ifdef HAVE_SDL_ SDL_IMAGE_H100 #ifdef HAVE_SDL_IMAGE_H 101 101 bool Texture::loadImage(const char* imageName) 102 102 { … … 118 118 pImage->format = GL_RGB; 119 119 else if (pImage->bpp == 4) 120 pImage->format = GL_RGBA; 121 120 { 121 pImage->format = GL_RGBA; 122 SDL_SetAlpha(this->map, 0, 0); 123 } 124 122 125 if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb"))) 123 126 for (int i=0;i<map->h * map->w *3;i+=3) … … 146 149 147 150 148 #else /* HAVE_SDL_ SDL_IMAGE_H */151 #else /* HAVE_SDL_IMAGE_H */ 149 152 /** 150 153 \brief Makes the Programm ready to Read-in a texture-File … … 832 835 833 836 } 834 #endif /* HAVE_SDL_ SDL_IMAGE_H */837 #endif /* HAVE_SDL_IMAGE_H */ -
orxonox/trunk/src/lib/graphics/importer/texture.h
r3660 r3790 14 14 #include "debug.h" 15 15 16 #ifdef HAVE_SDL_ SDL_IMAGE_H17 #include <SDL /SDL_image.h>16 #ifdef HAVE_SDL_IMAGE_H 17 #include <SDL_image.h> 18 18 #else 19 19 // IMAGE LIBS // … … 26 26 #include <png.h> 27 27 #endif /* HAVE_PNG_H */ 28 #endif /* HAVE_SDL_ SDL_IMAGE_H */28 #endif /* HAVE_SDL_IMAGE_H */ 29 29 30 30 //! A Class, that reads in Textures from different fileformats. … … 57 57 58 58 bool loadImage(const char* imageName); 59 #ifndef HAVE_SDL_ SDL_IMAGE_H59 #ifndef HAVE_SDL_IMAGE_H 60 60 61 61 bool loadBMP (char* bmpName); … … 74 74 75 75 }; 76 77 78 79 76 #endif /* _TEXTURE_H */
Note: See TracChangeset
for help on using the changeset viewer.