Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8369 in orxonox.OLD for trunk/src/lib/graphics/importer/objModel.cc


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.