Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7510 in orxonox.OLD for branches/bsp_model/src/lib


Ignore:
Timestamp:
May 3, 2006, 2:37:13 PM (19 years ago)
Author:
bensch
Message:

orxonox/bsp_model: Material should support multiple Textures now

Location:
branches/bsp_model/src/lib/graphics
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/bsp_file.cc

    r7507 r7510  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
     
    222222      PRINTF(4)("BSP FILE: Texture 0: %s. \n", &this->textures[8+ 72*i]);
    223223    this->load_textures();
    224    
     224
    225225    // Load the lightMaps
    226226    this->glLightMapTextures = new GLuint[this->numLightMaps];
    227227    for(int i = 0; i < this->numLightMaps; i++)
    228228      this->glLightMapTextures[i] = this->loadLightMapToGL(this->lightMaps[i]);
    229    
     229
    230230    //Create white texture for if no lightmap specified
    231231    glGenTextures(1, &this->whiteLightMap);
    232232    glBindTexture(GL_TEXTURE_2D, this->whiteLightMap);
    233         //Create texture
     233        //Create texture
    234234    this->whiteTexture[0]=255;
    235235    this->whiteTexture[1]=255;
    236236    this->whiteTexture[2]=255;
    237    
     237
    238238    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    239239    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
     
    244244
    245245
    246  
     246
    247247    /* control the mipmap levels */
    248248    glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5);
     
    260260                 (const GLvoid *)&(this->whiteTexture));
    261261
    262     gluBuild2DMipmaps(  GL_TEXTURE_2D, GL_RGBA8, 1, 1,
     262    gluBuild2DMipmaps(  GL_TEXTURE_2D, GL_RGBA8, 1, 1,
    263263                       GL_RGB, GL_FLOAT,(const GLvoid *) &(this->whiteTexture));
    264    
    265    
     264
     265
    266266
    267267    // Get the number of patches
     
    324324  float z1 =(((plane *) this->planes) [planeIndex]).z;
    325325  thisNode->leafIndex = 0;
    326   thisNode->d          = (((plane *) this->planes) [planeIndex]).d;
     326  thisNode->d          = (((plane *) this->planes) [planeIndex]).d;
    327327
    328328  thisNode->plane = Vector(x1,y1,z1);
     
    464464      PRINTF(0)("BSP FILE: gefunden . \n");
    465465      this->Materials[i] =this->loadMat(fileName);
    466      
     466
    467467    }
    468468
     
    480480      continue;
    481481    }
    482     //  Default Material
     482    //  Default Material
    483483    this->Materials[i].mat = new Material();
    484484    this->Materials[i].mat->setDiffuse(0.1,0.1,0.1);
     
    503503  if(this->testSurf != NULL) {
    504504    if(this->testSurf->format->Amask != 0 ) tmpAMat.alpha = true;
    505     else                                       tmpAMat.alpha = false;
     505    else                                       tmpAMat.alpha = false;
    506506  } else   tmpAMat.alpha = false;
    507507
     
    510510  tmp->setAmbient(1.0,1.0,1.0 );
    511511  tmp->setSpecular(1.0,1.0,1.0);
    512   //    tmp->setShininess(.5);
    513   //    tmp->setTransparency(1.0);
     512  //    tmp->setShininess(.5);
     513  //    tmp->setTransparency(1.0);
    514514
    515515  tmp->setDiffuseMap(mat);
     
    539539  scale*=255.0;
    540540  sc*=scale;
    541     ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc; 
    542    
    543  
     541    ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc;
     542
     543
    544544  }
    545  
     545
    546546  glGenTextures(1, &lightMap);
    547547  glBindTexture(GL_TEXTURE_2D,  lightMap);
     
    569569                   (const GLvoid *)&lightMapTexture);
    570570
    571    
     571
    572572   // build the MipMaps automaticaly
    573573   errorCode = gluBuild2DMipmaps(GL_TEXTURE_2D,
     
    579579                                 (const GLvoid *)&lightMapTexture
    580580                                );
    581    
     581
    582582
    583583
     
    715715
    716716
    717           //Vertice[u*(tesselation+1)+v]=       temp[0]*((1.0f-px)*(1.0f-px))+ temp[1]*((1.0f-px)*px*2)+ temp[2]*(px*px);
     717          //Vertice[u*(tesselation+1)+v]=       temp[0]*((1.0f-px)*(1.0f-px))+ temp[1]*((1.0f-px)*px*2)+ temp[2]*(px*px);
    718718          Vertice[u*(level1)+v].position[0]=temp[0].position[0]*((1.0f-px)*(1.0f-px))+temp[1].position[0]*((1.0f-px)*px*2)+temp[2].position[0]*(px*px);
    719719          Vertice[u*(level1)+v].position[1]=temp[0].position[1]*((1.0f-px)*(1.0f-px))+temp[1].position[1]*((1.0f-px)*px*2)+temp[2].position[1]*(px*px);
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r7465 r7510  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
     
    5151  // Draw Debug Terrain
    5252  /*
    53   this->bspFile->Materials[0]->select(); 
     53  this->bspFile->Materials[0]->select();
    5454  for(int i = 0; i <  this->bspFile->numPatches ; i++)
    55         {
    56                 this->bspFile->VertexArrayModels[i]->draw();
    57    
    58         }
     55        {
     56                this->bspFile->VertexArrayModels[i]->draw();
     57
     58        }
    5959  */
    6060
     
    103103        if (f >=0 && !this->isAlreadyVisible(f)) {
    104104          this->alreadyVisible[f] = true;
    105           /*    if(ActLeaf->leafIndex == i)public final double readLEDouble()
    106                 {
    107                         this->alreadyVisible[i] = false;
    108                         this->draw_debug_face(f);
    109                         this->alreadyVisible[i] = true;
    110                 } 
     105          /*    if(ActLeaf->leafIndex == i)public final double readLEDouble()
     106                {
     107                        this->alreadyVisible[i] = false;
     108                        this->draw_debug_face(f);
     109                        this->alreadyVisible[i] = true;
     110                }
    111111                else */
    112112          addFace(f); // "visibleFaces.append(f)"
     
    131131      leaf& curLeaf =  (this->bspFile->leaves)[i] ;
    132132      cluster =  curLeaf.cluster;
    133      
     133
    134134      if(cluster <0) continue;
    135135      v = ((viscluster *  ( ((int *)this->bspFile->visData)[1]) ) + (cluster / 8));
    136136      visSet =((unsigned char*) (this->bspFile->visData))[v+8];
    137    
    138      
     137
     138
    139139      if( ((visSet) & ((unsigned char)1 <<(unsigned char) (cluster &  7))) == 0 )
    140140      {
     
    191191  // if(this->bspFile->Materials[curFace.texture] != NULL)
    192192  //if(this->lastTex != curFace.texture) {
    193     this->bspFile->Materials[curFace.texture].mat->select0();
     193    this->bspFile->Materials[curFace.texture].mat->select();
    194194  //   this->lastTex = curFace.texture;
    195195  //}
    196    
    197     if(curFace.lm_index < 0) 
     196
     197    if(curFace.lm_index < 0)
    198198    {
    199199      glActiveTextureARB(GL_TEXTURE1_ARB);
     
    207207    glEnable(GL_TEXTURE_2D);
    208208    }
    209    
     209
    210210    glColor4f(3.0,3.0,3.0,0.9);
    211211  glEnableClientState(GL_VERTEX_ARRAY );
     
    213213  glEnableClientState(GL_NORMAL_ARRAY );
    214214  //  glEnableClientState(GL_COLOR_ARRAY);
    215  
     215
    216216
    217217  glVertexPointer(3, GL_FLOAT, stride, &(curVertex[offset].position[0]));
    218  
     218
    219219  glClientActiveTextureARB(GL_TEXTURE0_ARB);
    220220  glTexCoordPointer(2, GL_FLOAT, stride, &(curVertex[offset].texcoord[0]));
    221221  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    222  
     222
    223223  glClientActiveTextureARB(GL_TEXTURE1_ARB);
    224224  glTexCoordPointer(2, GL_FLOAT, stride, &(curVertex[offset].texcoord[1]));
    225225  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    226226
    227  
     227
    228228  glNormalPointer( GL_FLOAT, stride, &(curVertex[offset].normal[0]));
    229229  // glColorPointer(4, GL_BYTE, stride, &(curVertex[offset].color[0]));
     
    288288{
    289289  if(this->lastTex != Face->texture) {
    290     this->bspFile->Materials[Face->texture].mat->select0();
     290    this->bspFile->Materials[Face->texture].mat->select();
    291291    this->lastTex = Face->texture;
    292292  }
    293  
    294  
    295  
    296   if(Face->lm_index < 0) 
     293
     294
     295
     296  if(Face->lm_index < 0)
    297297  {
    298298    glActiveTextureARB(GL_TEXTURE1_ARB);
     
    307307}
    308308    glColor4f(3.0,3.0,3.0,0.9);
    309  
     309
    310310  glEnable( GL_AUTO_NORMAL);
    311311  glEnableClientState(GL_VERTEX_ARRAY );
     
    314314    glFrontFace(GL_CW);
    315315    //PRINTF(0)("BSP Manager: Face->size[0]: %i . \n", Face->size[0]);
    316  
    317  
     316
     317
    318318    glEnableClientState(GL_NORMAL_ARRAY );
    319319
    320320    glVertexPointer(3, GL_FLOAT,44, &((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).position[0]));
    321    
    322    
     321
     322
    323323    glClientActiveTextureARB(GL_TEXTURE0_ARB);
    324324    glTexCoordPointer(2, GL_FLOAT, 44, &((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).texcoord[0][0]));
    325325    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    326326
    327    
     327
    328328    glClientActiveTextureARB(GL_TEXTURE1_ARB);
    329329    glTexCoordPointer(2, GL_FLOAT, 44, &((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).texcoord[1][0]));
    330330    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    331331
    332    
     332
    333333    glNormalPointer( GL_FLOAT, 44,&((((BspVertex*)(this->bspFile->patchVertice))[8*8*(Face->meshvert+i)]).normal[0]) );
    334334
     
    344344                     & (     (((GLuint*)  (this->bspFile->patchIndexes))[7*8*2*(Face->meshvert+i)+ row*2*8]  ))  );
    345345    }
    346    
     346
    347347    glFrontFace(GL_CCW);
    348348  }
     
    352352  glDisableClientState(GL_VERTEX_ARRAY );
    353353  glDisableClientState(GL_TEXTURE_COORD_ARRAY );
    354  
     354
    355355  glBegin(GL_QUADS);
    356  
     356
    357357  glEnd();
    358358}
     
    406406
    407407    /*
    408         for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ )
    409         {
    410                 brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes];
    411                 if(curBrush.n_brushsides < 0) return;
    412                 for(int j = 0; j < curBrush.n_brushsides; j++)
    413                 {
    414                 float dist = -0.1;
    415                 brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides];
    416                 plane&      testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];
    417                 dist = testPlane.x * this->cam.x +  testPlane.y * this->cam.y  +  testPlane.z * this->cam.z   -testPlane.d ;
    418                
    419                 if(dist < -0.01f) dist = -1.0f *dist;
    420                 if(dist < 1.0f){
    421                                 this->drawDebugCube(&this->cam);
    422                                 return;
    423                               }
    424                 }
    425                        
    426         } */
     408        for(int i = 0; i < camLeaf.n_leafbrushes && i < 10; i++ )
     409        {
     410                brush& curBrush = ((brush*)(this->bspFile->brushes))[(camLeaf.leafbrush_first +i)%this->bspFile->numLeafBrushes];
     411                if(curBrush.n_brushsides < 0) return;
     412                for(int j = 0; j < curBrush.n_brushsides; j++)
     413                {
     414                float dist = -0.1;
     415                brushside& curBrushSide = ((brushside*)(this->bspFile->brushSides))[(curBrush.brushside +j)%this->bspFile->numBrushSides];
     416                plane&      testPlane = ((plane*)(this->bspFile->planes))[curBrushSide.plane % this->bspFile->numPlanes];
     417                dist = testPlane.x * this->cam.x +  testPlane.y * this->cam.y  +  testPlane.z * this->cam.z   -testPlane.d ;
     418
     419                if(dist < -0.01f) dist = -1.0f *dist;
     420                if(dist < 1.0f){
     421                                this->drawDebugCube(&this->cam);
     422                                return;
     423                              }
     424                }
     425
     426        } */
    427427
    428428  }
  • branches/bsp_model/src/lib/graphics/importer/material.cc

    r7465 r7510  
    4545  this->setTransparency(1.0);
    4646
    47   this->diffuseTexture = NULL;
    4847  this->ambientTexture = NULL;
    4948  this->specularTexture = NULL;
     
    6160  PRINTF(5)("delete Material %s.\n", this->getName());
    6261
    63   if (this->diffuseTexture != NULL)
    64   {
    65     ResourceManager::getInstance()->unload(this->diffuseTexture);
    66   }
     62  while(!this->textures.empty())
     63  {
     64    if (this->textures.back() != NULL)
     65      ResourceManager::getInstance()->unload(this->textures.back());
     66    this->textures.pop_back();
     67  }
     68
    6769  if (this->ambientTexture != NULL)
    6870    ResourceManager::getInstance()->unload(this->ambientTexture);
     
    7173}
    7274
    73 Material& Material::operator=(const Material& m)
    74 {
    75   this->setIllum(m.illumModel);
    76   this->setDiffuse(m.diffuse[0],m.diffuse[1],m.diffuse[2]);
    77   this->setAmbient(m.ambient[0],m.ambient[1],m.ambient[2]);
    78   this->setSpecular(m.specular[0],m.specular[1],m.specular[2]);
    79   this->setShininess(m.shininess);
    80   this->setTransparency(m.transparency);
    81 
    82   if (this->diffuseTexture != NULL)
    83     ResourceManager::getInstance()->unload(this->diffuseTexture);
    84   if (m.diffuseTexture != NULL)
    85     this->diffuseTexture = (Texture*)ResourceManager::getInstance()->copy(m.diffuseTexture);
    86   this->ambientTexture = NULL; /// FIXME
    87   this->specularTexture = NULL; /// FIXME
    88 
    89   this->setName(m.getName());
    90 }
    91  
    92 bool Material::select0() const
    93 {
    94   glActiveTextureARB(GL_TEXTURE0_ARB);
    95   glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
    96   glEnable(GL_TEXTURE_2D);
    97  
    98 }
     75
     76/// TODO FIX THIS
     77// Material& Material::operator=(const Material& m)
     78// {
     79//   this->setIllum(m.illumModel);
     80//   this->setDiffuse(m.diffuse[0],m.diffuse[1],m.diffuse[2]);
     81//   this->setAmbient(m.ambient[0],m.ambient[1],m.ambient[2]);
     82//   this->setSpecular(m.specular[0],m.specular[1],m.specular[2]);
     83//   this->setShininess(m.shininess);
     84//   this->setTransparency(m.transparency);
     85//
     86//   if (this->diffuseTexture != NULL)
     87//     ResourceManager::getInstance()->unload(this->diffuseTexture);
     88//   if (m.diffuseTexture != NULL)
     89//     this->diffuseTexture = (Texture*)ResourceManager::getInstance()->copy(m.diffuseTexture);
     90//   this->ambientTexture = NULL; /// FIXME
     91//   this->specularTexture = NULL; /// FIXME
     92//
     93//   this->setName(m.getName());
     94// }
     95
     96const GLenum Material::glTextureArbs[] =
     97  {
     98    GL_TEXTURE0_ARB,
     99    GL_TEXTURE1_ARB,
     100    GL_TEXTURE2_ARB,
     101    GL_TEXTURE3_ARB,
     102    GL_TEXTURE4_ARB,
     103    GL_TEXTURE5_ARB,
     104    GL_TEXTURE6_ARB,
     105    GL_TEXTURE7_ARB
     106  };
     107
    99108
    100109/**
    101110 *  sets the material with which the following Faces will be painted
    102111 */
    103 bool Material::select () const
     112bool Material::select() const
    104113{
    105114  // setting diffuse color
    106115  glColor4f (diffuse[0], diffuse[1], diffuse[2], this->transparency);
    107 //  glMaterialfv(GL_FRONT, GL_DIFFUSE, this->diffuse);
    108 
    109116  // setting ambient color
    110117  glMaterialfv(GL_FRONT, GL_AMBIENT, this->ambient);
    111 
    112118  // setting up Sprecular
    113119  glMaterialfv(GL_FRONT, GL_SPECULAR, this->specular);
    114 
    115120  // setting up Shininess
    116121  glMaterialf(GL_FRONT, GL_SHININESS, this->shininess);
    117122
     123
    118124  // setting the transparency
    119125  if (this->transparency < 1.0 ||       /* This allows alpha blending of 2D textures with the scene */
    120       (this->diffuseTexture && this->diffuseTexture->hasAlpha()))
     126      (likely(!this->textures.empty() && this->textures[0] != NULL) && this->textures[0]->hasAlpha()))
    121127  {
    122128    glEnable(GL_BLEND);
     
    124130  }
    125131  else
    126     {
    127       glDisable(GL_BLEND);
    128       //glColor4f(*(this->diffuse), *(this->diffuse+1), *(this->diffuse+2), 1);
    129     }
     132  {
     133    glDisable(GL_BLEND);
     134  }
    130135
    131136
     
    136141    glShadeModel(GL_SMOOTH);
    137142
    138   if (this->diffuseTexture != NULL)
     143
     144  for(unsigned int i = 0; i < this->textures.size(); ++i)
     145  {
     146    if (likely(this->textures[i] != NULL))
    139147    {
     148      glActiveTexture(Material::glTextureArbs[i]);
    140149      glEnable(GL_TEXTURE_2D);
    141       glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
     150      glBindTexture(GL_TEXTURE_2D, this->textures[i]->getTexture());
    142151    }
    143   else
    144     {
    145       glDisable(GL_TEXTURE_2D);
    146       glBindTexture(GL_TEXTURE_2D, 0);
    147     }
     152  }
     153
     154  /*  if (this->diffuseTexture != NULL)
     155      {
     156        glEnable(GL_TEXTURE_2D);
     157        glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
     158      }
     159    else
     160      {
     161        glDisable(GL_TEXTURE_2D);
     162        glBindTexture(GL_TEXTURE_2D, 0);
     163      }*/
    148164}
    149165
     
    233249  this->specular[2] = b;
    234250  this->specular[3] = 1.0;
    235  }
     251}
    236252
    237253/**
     
    296312 * @param dMap the Name of the Image to Use
    297313*/
    298 void Material::setDiffuseMap(const std::string& dMap, GLenum target)
    299 {
     314void Material::setDiffuseMap(const std::string& dMap, GLenum target, unsigned int textureNumber)
     315{
     316  assert(textureNumber < Material::getMaxTextureUnits());
     317
    300318  PRINTF(5)("setting Diffuse Map %s\n", dMap);
    301   if (this->diffuseTexture != NULL)
    302     ResourceManager::getInstance()->unload(this->diffuseTexture);
     319  if (this->textures.size() > textureNumber && this->textures[textureNumber] != NULL)
     320    ResourceManager::getInstance()->unload(this->textures[textureNumber]);
     321
     322  if (this->textures.size() <= textureNumber)
     323    this->textures.resize(textureNumber+1, NULL);
    303324
    304325  //! @todo check if RESOURCE MANAGER is availiable
    305   //! @todo Textures from .mtl-file need special care.
    306326  if (!dMap.empty())
    307     this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target);
     327  {
     328
     329    this->textures[textureNumber] = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target);
     330  }
    308331  else
    309     this->diffuseTexture = NULL;
     332  {
     333    this->textures[textureNumber] = NULL;
     334  }
    310335}
    311336
     
    339364void Material::setBump(const std::string& bump)
    340365{
    341 
    342 }
     366}
     367
     368
     369
     370int Material::getMaxTextureUnits()
     371{
     372  int maxTexUnits = 0;
     373  glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxTexUnits);
     374  return maxTexUnits;
     375}
  • branches/bsp_model/src/lib/graphics/importer/material.h

    r7465 r7510  
    1414#endif /* HAVE_CONFIG_H */
    1515
    16 #ifndef NULL
    17 #define NULL 0            //!< a pointer to NULL
    18 #endif
     16#include <vector>
     17
    1918
    2019#include "texture.h"
     
    2524class Material : public BaseObject
    2625{
    27  public:
    28   Material (const std::string& mtlName = "");
    29   virtual ~Material ();
     26  public:
     27    Material (const std::string& mtlName = "");
     28    virtual ~Material ();
    3029
    31   Material& operator=(const Material& material);
     30    Material& operator=(const Material& material);
    3231
    33   bool select () const;
    34   bool select0 () const;
    35      
    36   void setIllum (int illum);
    37   void setIllum (char* illum);
    38   int getIllumModel() const { return this->illumModel; };
    39   void setDiffuse (float r, float g, float b);
    40   void setDiffuse (char* rgb);
    41   void setAmbient (float r, float g, float b);
    42   void setAmbient (char* rgb);
    43   void setSpecular (float r, float g, float b);
    44   void setSpecular (char* rgb);
    45   void setShininess (float shini);
    46   void setShininess (char* shini);
    47   void setTransparency (float trans);
    48   void setTransparency (char* trans);
    49   void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; };
     32    bool select () const;
    5033
    51  // MAPPING //
    52   void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D);
    53   void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
    54   void setSpecularMap(const std::string& sMap, GLenum target = GL_TEXTURE_2D);
    55   void setBump(const std::string& bump);
    56   GLuint getDiffuseTexture() const { return (this->diffuseTexture)? this->diffuseTexture->getTexture() : 0; };
     34    void setIllum (int illum);
     35    int getIllumModel() const { return this->illumModel; };
     36    void setDiffuse (float r, float g, float b);
     37    void setAmbient (float r, float g, float b);
     38    void setSpecular (float r, float g, float b);
     39    void setShininess (float shini);
     40    void setTransparency (float trans);
     41    void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; };
    5742
    58   static void addTexturePath(const std::string& pathName);
     43
     44    // TODO Move them out of here
     45    void setIllum (char* illum);
     46    void setDiffuse (char* rgb);
     47    void setAmbient (char* rgb);
     48    void setSpecular (char* rgb);
     49    void setShininess (char* shini);
     50    void setTransparency (char* trans);
     51
     52
     53    // MAPPING //
     54    void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
     55
     56    void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
     57    void setSpecularMap(const std::string& sMap, GLenum target = GL_TEXTURE_2D);
     58    void setBump(const std::string& bump);
     59    GLuint getDiffuseTexture(unsigned int i = 0) const { return (this->textures.size() > i)? this->textures[i]->getTexture() : 0; };
     60
     61    static void addTexturePath(const std::string& pathName);
     62
     63  public:
     64    static const GLenum glTextureArbs[];  //!< The Texture ARB's
     65
     66    static int getMaxTextureUnits();
    5967
    6068  private:
     
    6876    GLenum      tFactor;
    6977
    70     Texture*    diffuseTexture;   //!< The diffuse texture of the Material.
     78    std::vector<Texture*> textures; //!< An Array of Textures.
     79
    7180    Texture*    ambientTexture;   //!< The ambient texture of the Material.
    7281    Texture*    specularTexture;  //!< The specular texture of the Material.
     82
     83
    7384};
    7485#endif
  • branches/bsp_model/src/lib/graphics/render2D/billboard.cc

    r7221 r7510  
    7878void Billboard::loadParams(const TiXmlElement* root)
    7979{
    80   LoadParam(root, "texture", this->material, Material, setDiffuseMap)
     80  LoadParam(root, "texture", this, Billboard, setTexture)
    8181      .describe("the texture-file to load onto the Billboard");
    8282
Note: See TracChangeset for help on using the changeset viewer.