- Timestamp:
- Jun 14, 2006, 11:04:24 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/material.cc
r8362 r8369 196 196 197 197 /** 198 * Sets the Material Illumination Model.199 * illu illumination Model in char* form200 */201 void Material::setIllum (char* illum)202 {203 this->setIllum (atoi(illum));204 }205 206 /**207 198 * Sets the Material Diffuse Color. 208 199 * @param r Red Color Channel.a … … 220 211 } 221 212 222 /**223 * Sets the Material Diffuse Color.224 * @param rgb The red, green, blue channel in char format (with spaces between them)225 */226 void Material::setDiffuse (char* rgb)227 {228 float r,g,b;229 sscanf (rgb, "%f %f %f", &r, &g, &b);230 this->setDiffuse (r, g, b);231 }232 213 233 214 /** … … 247 228 248 229 /** 249 * Sets the Material Ambient Color.250 * @param rgb The red, green, blue channel in char format (with spaces between them)251 */252 void Material::setAmbient (char* rgb)253 {254 float r,g,b;255 sscanf (rgb, "%f %f %f", &r, &g, &b);256 this->setAmbient (r, g, b);257 }258 259 /**260 230 * Sets the Material Specular Color. 261 231 * @param r Red Color Channel. … … 273 243 274 244 /** 275 * Sets the Material Specular Color.276 * @param rgb The red, green, blue channel in char format (with spaces between them)277 */278 void Material::setSpecular (char* rgb)279 {280 float r,g,b;281 sscanf (rgb, "%f %f %f", &r, &g, &b);282 this->setSpecular (r, g, b);283 }284 285 /**286 245 * Sets the Material Shininess. 287 246 * @param shini stes the Shininess from float. … … 291 250 this->shininess = shini; 292 251 } 293 /**294 * Sets the Material Shininess.295 * @param shini stes the Shininess from char*.296 */297 void Material::setShininess (char* shini)298 {299 this->setShininess (atof(shini));300 }301 252 302 253 /** … … 308 259 PRINTF(4)("setting Transparency of Material %s to %f.\n", this->getName(), trans); 309 260 this->transparency = trans; 310 }311 /**312 * Sets the Material Transparency.313 * @param trans stes the Transparency from char*.314 */315 void Material::setTransparency (char* trans)316 {317 this->setTransparency (atof(trans));318 261 } 319 262 -
trunk/src/lib/graphics/importer/material.h
r8316 r8369 42 42 void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; }; 43 43 44 45 // TODO Move them out of here46 void setIllum (char* illum);47 void setDiffuse (char* rgb);48 void setAmbient (char* rgb);49 void setSpecular (char* rgb);50 void setShininess (char* shini);51 void setTransparency (char* trans);52 53 44 void getDiffuseColor(float& r, float& g, float& b) const { r = diffuse[0], g = diffuse[1], b = diffuse[2]; } 54 45 -
trunk/src/lib/graphics/importer/objModel.cc
r7677 r8369 28 28 29 29 /** 30 * Crates a 3D-Model, loads in a File and scales it.30 * @brief Crates a 3D-Model, loads in a File and scales it. 31 31 * @param fileName file to parse and load (must be a .obj file) 32 32 * @param scaling The factor that the model will be scaled with. … … 47 47 48 48 /** 49 * deletes an OBJModel. 50 51 Looks if any from model allocated space is still in use, and if so deleted it. 52 */ 49 * @brief deletes an OBJModel. 50 */ 53 51 OBJModel::~OBJModel() 54 52 { } … … 86 84 87 85 /** 88 * Reads in the .obj File and sets all the Values. 89 This function does read the file, parses it for the occurence of things like vertices, faces and so on, and executes the specific tasks 90 */ 86 * @brief Reads in the .obj File and sets all the Values. 87 * @param fileName the FileName of the Model. 88 * 89 * This function does read the file, parses it for the occurence of things like vertices, faces and so on, and executes the specific tasks 90 */ 91 91 bool OBJModel::readFromObjFile(const std::string& fileName) 92 92 { … … 153 153 154 154 /** 155 * Function to read in a mtl File.155 * @brief Function to read in a mtl File. 156 156 * @param mtlFile The .mtl file to read 157 157 * … … 191 191 { 192 192 if (likely(tmpMat != NULL)) 193 tmpMat->setIllum(buffer+6);193 setIllum(tmpMat, buffer+6); 194 194 195 195 } … … 198 198 { 199 199 if (likely(tmpMat != NULL)) 200 tmpMat->setDiffuse(buffer+3);200 setDiffuse(tmpMat, buffer+3); 201 201 } 202 202 // setting Ambient Color … … 204 204 { 205 205 if (likely(tmpMat != NULL)) 206 tmpMat->setAmbient(buffer+3);206 setAmbient(tmpMat, buffer+3); 207 207 } 208 208 // setting Specular Color … … 210 210 { 211 211 if (likely(tmpMat != NULL)) 212 tmpMat->setSpecular(buffer+3);212 setSpecular(tmpMat, buffer+3); 213 213 } 214 214 // setting The Specular Shininess … … 216 216 { 217 217 if (likely(tmpMat != NULL)) 218 tmpMat->setShininess(buffer+3);218 setShininess(tmpMat, buffer+3); 219 219 } 220 220 // setting up transparency … … 222 222 { 223 223 if (likely(tmpMat != NULL)) 224 tmpMat->setTransparency(buffer+2);224 setTransparency(tmpMat, buffer+2); 225 225 } 226 226 else if (!strncmp(buffer, "Tf ", 3)) 227 227 { 228 228 if (likely(tmpMat != NULL)) 229 tmpMat->setTransparency(buffer+3);229 setTransparency(tmpMat, buffer+3); 230 230 } 231 231 … … 256 256 return true; 257 257 } 258 259 260 /** 261 * @brief Sets the Material Illumination Model. 262 * @param material: the Material to apply the change to. 263 * @param illu: illumination Model in char* form 264 */ 265 void OBJModel::setIllum (Material* material, const char* illum) 266 { 267 material->setIllum (atoi(illum)); 268 } 269 270 /** 271 * @brief Sets the Material Diffuse Color. 272 * @param material: the Material to apply the change to. 273 * @param rgb The red, green, blue channel in char format (with spaces between them) 274 */ 275 void OBJModel::setDiffuse (Material* material, const char* rgb) 276 { 277 float r,g,b; 278 sscanf (rgb, "%f %f %f", &r, &g, &b); 279 material->setDiffuse (r, g, b); 280 } 281 282 /** 283 * @brief Sets the Material Ambient Color. 284 * @param material: the Material to apply the change to. 285 * @param rgb The red, green, blue channel in char format (with spaces between them) 286 */ 287 void OBJModel::setAmbient (Material* material, const char* rgb) 288 { 289 float r,g,b; 290 sscanf (rgb, "%f %f %f", &r, &g, &b); 291 material->setAmbient (r, g, b); 292 } 293 294 /** 295 * @brief Sets the Material Specular Color. 296 * @param material: the Material to apply the change to. 297 * @param rgb The red, green, blue channel in char format (with spaces between them) 298 */ 299 void OBJModel::setSpecular (Material* material, const char* rgb) 300 { 301 float r,g,b; 302 sscanf (rgb, "%f %f %f", &r, &g, &b); 303 material->setSpecular (r, g, b); 304 } 305 306 /** 307 * @brief Sets the Material Shininess. 308 * @param material: the Material to apply the change to. 309 * @param shini stes the Shininess from char*. 310 */ 311 void OBJModel::setShininess (Material* material, const char* shini) 312 { 313 material->setShininess (atof(shini)); 314 } 315 316 /** 317 * @brief Sets the Material Transparency. 318 * @param material: the Material to apply the change to. 319 * @param trans stes the Transparency from char*. 320 */ 321 void OBJModel::setTransparency (Material* material, const char* trans) 322 { 323 material->setTransparency (atof(trans)); 324 } -
trunk/src/lib/graphics/importer/objModel.h
r7221 r8369 22 22 bool readMtlLib (const std::string& matFile); 23 23 24 private: 25 void setIllum (Material* material, const char* illum); 26 void setDiffuse (Material* material, const char* rgb); 27 void setAmbient (Material* material, const char* rgb); 28 void setSpecular (Material* material, const char* rgb); 29 void setShininess (Material* material, const char* shini); 30 void setTransparency (Material* material, const char* trans); 31 24 32 private: 25 33 std::string objPath; //!< The Path where the obj and mtl-file are located.
Note: See TracChangeset
for help on using the changeset viewer.