Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3780 in orxonox.OLD for orxonox/branches/textEngine/src/lib


Ignore:
Timestamp:
Apr 11, 2005, 11:37:20 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: blening of Materials enabled

Location:
orxonox/branches/textEngine/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/lib/graphics/importer/material.cc

    r3681 r3780  
    3030using namespace std;
    3131
    32 
    33 /**
    34    \brief creates a default Material with no Name
    35    normally you call this to create a material List (for an obj-file) and then append with addMaterial()
    36 */
    37 Material::Material()
    38 {
    39   this->init();
    40  
    41   this->setName ("");
    42 }
    43 
    4432/**
    4533   \brief creates a Material.
     
    4836Material::Material (char* mtlName)
    4937{
    50   this->init();
    51  
    52   this->setName (mtlName);
     38   PRINTF(4)("initializing new Material.\n");
     39  this->nextMat = NULL;
     40  this->name ="";
     41  this->setIllum(3);
     42  this->setDiffuse(0,0,0);
     43  this->setAmbient(0,0,0);
     44  this->setSpecular(.5,.5,.5);
     45  this->setShininess(2.0);
     46  this->setTransparency(1.0);
     47
     48
     49  this->diffuseTexture = NULL;
     50  this->ambientTexture = NULL;
     51  this->specularTexture = NULL;
     52
     53  this->diffuseTextureSet = false;
     54  this->ambientTextureSet = false;
     55  this->specularTextureSet = false;
     56
     57  if (mtlName)
     58    this->setName (mtlName);
     59  else
     60    this->setName("");
    5361}
    5462
     
    8694
    8795/**
    88    \brief initializes a new Material with its default Values
    89 */
    90 void Material::init(void)
    91 {
    92   PRINTF(4)("initializing new Material.\n");
    93   this->nextMat = NULL;
    94   this->name ="";
    95   this->setIllum(3);
    96   this->setDiffuse(0,0,0);
    97   this->setAmbient(0,0,0);
    98   this->setSpecular(.5,.5,.5);
    99   this->setShininess(2.0);
    100   this->setTransparency(0.0);
    101 
    102 
    103   this->diffuseTexture = NULL;
    104   this->ambientTexture = NULL;
    105   this->specularTexture = NULL;
    106 
    107   this->diffuseTextureSet = false;
    108   this->ambientTextureSet = false;
    109   this->specularTextureSet = false;
    110 }
    111 
    112 /**
    11396   \brief Search for a Material called mtlName
    11497   \param mtlName the Name of the Material to search for
     
    151134  glMaterialf(GL_FRONT, GL_SHININESS, this->shininess);
    152135 
     136  // setting the transparency
     137  if (this->transparency == 1.0)
     138    {
     139      glDisable(GL_BLEND);
     140    }
     141  else
     142    {
     143      glEnable(GL_BLEND);
     144      glColor4f(1.0f, 1.0f, 1.0f, this->transparency);
     145      glBlendFunc(GL_SRC_ALPHA, GL_ONE);
     146    }
     147
    153148  // setting illumination Model
    154149  if (this->illumModel == 1) //! \todo make this work, if no vertex-normals are read.
  • orxonox/branches/textEngine/src/lib/graphics/importer/material.h

    r3681 r3780  
    2222{
    2323 public:
    24   Material ();
    25   Material (char* mtlName);
     24  Material (char* mtlName = "");
    2625  Material* addMaterial(char* mtlName);
    2726  ~Material ();
    28   void init(void);
    2927
    3028  Material* search(char* mtlName);
Note: See TracChangeset for help on using the changeset viewer.