Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8369 in orxonox.OLD


Ignore:
Timestamp:
Jun 14, 2006, 11:04:24 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: finaly moved the *#\!3i& chars out of Material

Location:
trunk/src/lib/graphics/importer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/material.cc

    r8362 r8369  
    196196
    197197/**
    198  *  Sets the Material Illumination Model.
    199  *  illu illumination Model in char* form
    200  */
    201 void Material::setIllum (char* illum)
    202 {
    203   this->setIllum (atoi(illum));
    204 }
    205 
    206 /**
    207198 *  Sets the Material Diffuse Color.
    208199 * @param r Red Color Channel.a
     
    220211}
    221212
    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 }
    232213
    233214/**
     
    247228
    248229/**
    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 /**
    260230 *  Sets the Material Specular Color.
    261231 * @param r Red Color Channel.
     
    273243
    274244/**
    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 /**
    286245 *  Sets the Material Shininess.
    287246 * @param shini stes the Shininess from float.
     
    291250  this->shininess = shini;
    292251}
    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 }
    301252
    302253/**
     
    308259  PRINTF(4)("setting Transparency of Material %s to %f.\n", this->getName(), trans);
    309260  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));
    318261}
    319262
  • trunk/src/lib/graphics/importer/material.h

    r8316 r8369  
    4242    void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; };
    4343
    44 
    45     // TODO Move them out of here
    46     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 
    5344    void getDiffuseColor(float& r, float& g, float& b) const { r = diffuse[0], g = diffuse[1], b = diffuse[2]; }
    5445
  • trunk/src/lib/graphics/importer/objModel.cc

    r7677 r8369  
    2828
    2929/**
    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.
    3131 * @param fileName file to parse and load (must be a .obj file)
    3232 * @param scaling The factor that the model will be scaled with.
     
    4747
    4848/**
    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 */
    5351OBJModel::~OBJModel()
    5452{ }
     
    8684
    8785/**
    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 */
    9191bool OBJModel::readFromObjFile(const std::string& fileName)
    9292{
     
    153153
    154154/**
    155  * Function to read in a mtl File.
     155 * @brief Function to read in a mtl File.
    156156 * @param mtlFile The .mtl file to read
    157157 *
     
    191191        {
    192192          if (likely(tmpMat != NULL))
    193             tmpMat->setIllum(buffer+6);
     193            setIllum(tmpMat, buffer+6);
    194194
    195195        }
     
    198198        {
    199199          if (likely(tmpMat != NULL))
    200             tmpMat->setDiffuse(buffer+3);
     200            setDiffuse(tmpMat, buffer+3);
    201201        }
    202202      // setting Ambient Color
     
    204204        {
    205205          if (likely(tmpMat != NULL))
    206             tmpMat->setAmbient(buffer+3);
     206            setAmbient(tmpMat, buffer+3);
    207207        }
    208208      // setting Specular Color
     
    210210        {
    211211          if (likely(tmpMat != NULL))
    212             tmpMat->setSpecular(buffer+3);
     212            setSpecular(tmpMat, buffer+3);
    213213        }
    214214      // setting The Specular Shininess
     
    216216        {
    217217          if (likely(tmpMat != NULL))
    218             tmpMat->setShininess(buffer+3);
     218            setShininess(tmpMat, buffer+3);
    219219        }
    220220      // setting up transparency
     
    222222        {
    223223          if (likely(tmpMat != NULL))
    224             tmpMat->setTransparency(buffer+2);
     224            setTransparency(tmpMat, buffer+2);
    225225        }
    226226      else if (!strncmp(buffer, "Tf ", 3))
    227227        {
    228228          if (likely(tmpMat != NULL))
    229             tmpMat->setTransparency(buffer+3);
     229            setTransparency(tmpMat, buffer+3);
    230230        }
    231231
     
    256256  return true;
    257257}
     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 */
     265void 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 */
     275void 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 */
     287void 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 */
     299void 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 */
     311void 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 */
     321void OBJModel::setTransparency (Material* material, const char* trans)
     322{
     323  material->setTransparency (atof(trans));
     324}
  • trunk/src/lib/graphics/importer/objModel.h

    r7221 r8369  
    2222   bool readMtlLib (const std::string& matFile);
    2323
     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
    2432 private:
    2533   std::string       objPath;     //!< The Path where the obj and mtl-file are located.
Note: See TracChangeset for help on using the changeset viewer.