Changeset 8376 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jun 14, 2006, 12:13:16 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/material.cc
r8370 r8376 132 132 133 133 // setting diffuse color 134 glColor4f (diffuse [0], diffuse[1], diffuse[2], this->transparency);134 glColor4f (diffuse.r(), diffuse.g(), diffuse.b(), diffuse.a()); 135 135 // setting ambient color 136 glMaterialfv(GL_FRONT, GL_AMBIENT, this->ambient);136 glMaterialfv(GL_FRONT, GL_AMBIENT, &this->ambient[0]); 137 137 // setting up Sprecular 138 glMaterialfv(GL_FRONT, GL_SPECULAR, this->specular);138 glMaterialfv(GL_FRONT, GL_SPECULAR, &this->specular[0]); 139 139 // setting up Shininess 140 140 glMaterialf(GL_FRONT, GL_SHININESS, this->shininess); 141 141 142 142 // setting the transparency 143 if (this-> transparency< 1.0 || /* This allows alpha blending of 2D textures with the scene */143 if (this->diffuse.a() < 1.0 || /* This allows alpha blending of 2D textures with the scene */ 144 144 (likely(!this->textures.empty() && this->textures[0].hasAlpha()))) 145 145 { … … 206 206 { 207 207 PRINTF(4)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b); 208 this->diffuse[0] = r; 209 this->diffuse[1] = g; 210 this->diffuse[2] = b; 211 this->diffuse[3] = 1.0; 212 208 this->diffuse = Color(r, g, b, this->diffuse.a() ); 213 209 } 214 210 … … 223 219 { 224 220 PRINTF(4)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b); 225 this->ambient[0] = r; 226 this->ambient[1] = g; 227 this->ambient[2] = b; 228 this->ambient[3] = 1.0; 221 this->ambient = Color(r, g, b, 1.0); 229 222 } 230 223 … … 238 231 { 239 232 PRINTF(4)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b); 240 this->specular[0] = r; 241 this->specular[1] = g; 242 this->specular[2] = b; 243 this->specular[3] = 1.0; 233 this->specular = Color (r, g, b, 1.0); 244 234 } 245 235 … … 260 250 { 261 251 PRINTF(4)("setting Transparency of Material %s to %f.\n", this->getName(), trans); 262 this-> transparency= trans;252 this->diffuse.a() = trans; 263 253 } 264 254 … … 310 300 Texture* tex = dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target)); 311 301 if (tex != NULL) 312 this->textures[textureNumber] = *tex;302 this->textures[textureNumber] = *tex; 313 303 else 314 304 this->textures[textureNumber] = Texture(); … … 373 363 * @brief Sets the Materials Ambient Map 374 364 * @todo implement this 375 */365 */ 376 366 void Material::setAmbientMap(const std::string& aMap, GLenum target) 377 367 { … … 383 373 * @brief Sets the Materials Specular Map 384 374 * @param sMap the Name of the Image to Use 385 386 */375 * @todo implement this 376 */ 387 377 void Material::setSpecularMap(const std::string& sMap, GLenum target) 388 378 { … … 395 385 * @param bump the Name of the Image to Use 396 386 * @todo implemet this 397 */387 */ 398 388 void Material::setBump(const std::string& bump) 399 389 { -
trunk/src/lib/graphics/importer/material.h
r8370 r8376 17 17 #include <vector> 18 18 #include "texture.h" 19 #include "color.h" 19 20 20 21 // FORWARD DECLARATIONS // … … 35 36 void setIllum (int illum); 36 37 int getIllumModel() const { return this->illumModel; }; 38 37 39 void setDiffuse (float r, float g, float b); 38 40 void setAmbient (float r, float g, float b); … … 42 44 void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; }; 43 45 44 void getDiffuseColor(float& r, float& g, float& b) const { r = diffuse[0], g = diffuse[1], b = diffuse[2]; }46 const Color& getDiffuseColor() const { return diffuse; }; 45 47 46 48 // MAPPING // … … 66 68 67 69 int illumModel; //!< The IlluminationModel is either flat or smooth. 68 float diffuse [4]; //!< The diffuse color of the Material.69 float ambient [4];//!< The ambient color of the Material.70 float specular [4];//!< The specular color of the Material.70 Color diffuse; //!< The diffuse color of the Material. (also transparency.) 71 Color ambient; //!< The ambient color of the Material. 72 Color specular; //!< The specular color of the Material. 71 73 float shininess; //!< The shininess of the Material. 72 float transparency; //!< The transperency of the Material.73 74 GLenum sFactor; //!< The Blending Factor for the Source. 74 75 GLenum tFactor; //!< The Blending Factor for the Destination. -
trunk/src/lib/graphics/importer/texture.cc
r8366 r8376 163 163 Texture::~Texture() 164 164 {} 165 166 /** 167 * @brief copies the Data from texture to this texture. 168 * @param texture the Texture to copy into this one. 169 * @returns the Texture. 170 */ 171 Texture& Texture::operator=(const Texture& texture) 172 { 173 this->data = texture.data; 174 175 return *this; 176 } 165 177 166 178 -
trunk/src/lib/graphics/importer/texture.h
r8363 r8376 26 26 Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D); 27 27 Texture(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D); 28 29 Texture& operator=(const Texture& texture); 28 30 29 31 virtual ~Texture();
Note: See TracChangeset
for help on using the changeset viewer.