Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2853 in orxonox.OLD for orxonox/trunk/src/material.cc


Ignore:
Timestamp:
Nov 14, 2004, 6:41:02 AM (21 years ago)
Author:
bensch
Message:

orxonox/trunk/src: merged importer to trunk again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/material.cc

    r2835 r2853  
    1616#include "material.h"
    1717
     18/**
     19   \brief creates a default Material with no Name
     20   normally you call this to create a material List (for an obj-file) and then append with addMaterial()
     21*/
    1822Material::Material()
    1923{
     
    2327}
    2428
     29/**
     30   \brief creates a Material.
     31   \param mtlName Name of the Material to be added to the Material List
     32*/
    2533Material::Material (char* mtlName)
    2634{
     
    3038}
    3139
     40/**
     41    \brief deletes a Material
     42*/
     43Material::~Material()
     44{
     45  if (verbose >= 2)
     46    printf ("delete Material %s\n", name);
     47  if (nextMat != NULL)
     48    delete nextMat;
     49}
     50
     51/**
     52   \brief adds a new Material to the List.
     53   this Function will append a new Material to the end of a Material List.
     54   \param mtlName The name of the Material to be added.
     55*/
    3256Material* Material::addMaterial(char* mtlName)
    3357{
     
    4569}
    4670
     71/**
     72   \brief initializes a new Material with its default Values
     73*/
    4774void Material::init(void)
    4875{
     
    5582  setAmbient(0,0,0);
    5683  setSpecular(0,0,0);
     84  setShininess(2.0);
    5785  setTransparency(0.0);
    58 }
    59 
    60 
     86 
     87}
     88
     89/**
     90   \brief Set the Name of the Material. (Important for searching)
     91   \param mtlName the Name of the Material to be set.
     92*/
    6193void Material::setName (char* mtlName)
    6294{
     
    6799
    68100}
     101/**
     102   \returns The Name of The Material
     103*/
    69104char* Material::getName (void)
    70105{
     
    72107}
    73108
    74 
     109/**
     110   \brief Sets the Material Illumination Model.
     111   \brief illu illumination Model in int form
     112*/
    75113void Material::setIllum (int illum)
    76114{
     
    80118  //  printf ("setting illumModel to: %i\n", illumModel);
    81119}
    82 void Material::setIllum (char* illum)
     120/**
     121   \brief Sets the Material Illumination Model.
     122   \brief illu illumination Model in char* form
     123*/void Material::setIllum (char* illum)
    83124{
    84125  setIllum (atoi(illum));
    85126}
    86127
     128/**
     129   \brief Sets the Material Diffuse Color.
     130   \param r Red Color Channel.
     131   \param g Green Color Channel.
     132   \param b Blue Color Channel.
     133*/
    87134void Material::setDiffuse (float r, float g, float b)
    88135{
     
    95142
    96143}
     144/**
     145   \brief Sets the Material Diffuse Color.
     146   \param rgb The red, green, blue channel in char format (with spaces between them)
     147*/
    97148void Material::setDiffuse (char* rgb)
    98149{
     
    102153}
    103154
     155/**
     156   \brief Sets the Material Ambient Color.
     157   \param r Red Color Channel.
     158   \param g Green Color Channel.
     159   \param b Blue Color Channel.
     160*/
    104161void Material::setAmbient (float r, float g, float b)
    105162{
     
    111168  ambient[3] = 1.0;
    112169}
     170/**
     171   \brief Sets the Material Ambient Color.
     172   \param rgb The red, green, blue channel in char format (with spaces between them)
     173*/
    113174void Material::setAmbient (char* rgb)
    114175{
     
    118179}
    119180
     181/**
     182   \brief Sets the Material Specular Color.
     183   \param r Red Color Channel.
     184   \param g Green Color Channel.
     185   \param b Blue Color Channel.
     186*/
    120187void Material::setSpecular (float r, float g, float b)
    121188{
     
    127194  specular[3] = 1.0;
    128195 }
     196/**
     197   \brief Sets the Material Specular Color.
     198   \param rgb The red, green, blue channel in char format (with spaces between them)
     199*/
    129200void Material::setSpecular (char* rgb)
    130201{
     
    134205}
    135206
    136 
     207/**
     208   \brief Sets the Material Shininess.
     209   \param shini stes the Shininess from float.
     210*/
     211void Material::setShininess (float shini)
     212{
     213  shininess = shini;
     214}
     215/**
     216   \brief Sets the Material Shininess.
     217   \param shini stes the Shininess from char*.
     218*/
     219void Material::setShininess (char* shini)
     220{
     221  setShininess (atof(shini));
     222}
     223
     224/**
     225   \brief Sets the Material Transparency.
     226   \param trans stes the Transparency from int.
     227*/
    137228void Material::setTransparency (float trans)
    138229{
     
    141232  transparency = trans;
    142233}
     234/**
     235   \brief Sets the Material Transparency.
     236   \param trans stes the Transparency from char*.
     237*/
    143238void Material::setTransparency (char* trans)
    144239{
     
    148243}
    149244
    150 
     245/**
     246   \brief Search for a Material called mtlName
     247   \param mtlName the Name of the Material to search for
     248   \returns Material named mtlName if it is found. NULL otherwise.
     249*/
    151250Material* Material::search (char* mtlName)
    152251{
     
    169268}
    170269
     270/**
     271   \brief sets the material with which the following Faces will be painted
     272*/
    171273bool Material::select (void)
    172274{
     
    180282  // setting up Sprecular
    181283  glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
     284
     285  // setting up Shininess
     286  glMaterialf(GL_FRONT, GL_SHININESS, shininess);
    182287 
    183288  // setting illumination Model
Note: See TracChangeset for help on using the changeset viewer.