Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

orxonox/bsp_model: Material should support multiple Textures now

File:
1 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);
Note: See TracChangeset for help on using the changeset viewer.