Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7524 in orxonox.OLD for branches


Ignore:
Timestamp:
May 3, 2006, 5:20:13 PM (19 years ago)
Author:
stefalie
Message:

branches/bsp_model: setSDLSurfaceDiffuseMap added to Material

Location:
branches/bsp_model/src/lib/graphics/importer
Files:
3 edited

Legend:

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

    r7511 r7524  
    4545  int size;
    4646  struct stat results;
    47   name = "/root/data/Kanti175.bsp";
     47  name = "/home/stefalie/svn/orxonox/data/Kanti175.bsp";
    4848
    4949  if (stat( name , &results) == 0) {
     
    384384    // Check for tga
    385385    strcpy(fileName, &this->textures[8+ 72*i]);
    386     strcpy (absFileName,"/root/data/trunk/");
     386    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    387387    strcpy(ext, ".tga");
    388388    strncat (fileName, ext, strlen(fileName));
     
    397397    // Check for TGA
    398398    strcpy(fileName, &this->textures[8+ 72*i]);
    399     strcpy (absFileName,"/root/data/trunk/");
     399    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    400400    strcpy(ext, ".TGA");
    401401    strncat (fileName, ext, strlen(fileName));
     
    410410    // Check for jpg
    411411    strcpy(fileName, &this->textures[8+ 72*i]);
    412     strcpy (absFileName,"/root/data/trunk/");
     412    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    413413    strcpy(ext, ".jpg");
    414414    strncat (fileName, ext, strlen(fileName));
     
    424424    // Check for JPG
    425425    strcpy(fileName, &this->textures[8+ 72*i]);
    426     strcpy (absFileName,"/root/data/trunk/");
     426    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    427427    strcpy(ext, ".JPG");
    428428    strncat (fileName, ext, strlen(fileName));
     
    437437    // Check for jpeg
    438438    strcpy(fileName, &this->textures[8+ 72*i]);
    439     strcpy (absFileName,"/root/data/trunk/");
     439    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    440440    strcpy(ext, ".jpeg");
    441441    strncat (fileName, ext, strlen(fileName));
     
    451451    // Check for JPEG
    452452    strcpy(fileName, &this->textures[8+ 72*i]);
    453     strcpy (absFileName,"/root/data/trunk/");
     453    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    454454    strcpy(ext, ".JPEG");
    455455    strncat (fileName, ext, strlen(fileName));
     
    465465    // Check for bmp
    466466    strcpy(fileName, &this->textures[8+ 72*i]);
    467     strcpy (absFileName,"/root/data/trunk/");
     467    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    468468    strcpy(ext, ".bmp");
    469469    strncat (fileName, ext, strlen(fileName));
     
    479479    // Check for BMP
    480480    strcpy(fileName, &this->textures[8+ 72*i]);
    481     strcpy (absFileName,"/root/data/trunk/");
     481    strcpy (absFileName,"/home/stefalie/svn/orxonox/data/trunk/");
    482482    strcpy(ext, ".BMP");
    483483    strncat (fileName, ext, strlen(fileName));
     
    485485    // absFileName = ResourceManager::getFullName(fileName);
    486486
    487     if(stat( absFileName , &results) == 0) {
     487    if(false /*stat( absFileName , &results) == 0*/) {
    488488      PRINTF(0)("BSP FILE: gefunden . \n");
    489489      this->Materials[i] = this->loadMat(fileName);
  • branches/bsp_model/src/lib/graphics/importer/material.cc

    r7513 r7524  
    167167      glActiveTexture(Material::glTextureArbs[i]);
    168168      glEnable(GL_TEXTURE_2D);
     169      if(this->textures[i]->hasAlpha())
     170      {
     171        glEnable(GL_BLEND);
     172      }
    169173      glBindTexture(GL_TEXTURE_2D, this->textures[i]->getTexture());
    170174    }
     
    355359
    356360/**
     361 *  Sets the Materials Diffuse Map
     362 * @param surface pointer to SDL_Surface which shall be used as texture
     363*/
     364void Material::setSDLDiffuseMap(SDL_Surface *surface, GLenum target, unsigned int textureNumber)
     365{
     366  assert(textureNumber < Material::getMaxTextureUnits());
     367
     368 
     369  if (this->textures.size() > textureNumber && this->textures[textureNumber] != NULL)
     370    ResourceManager::getInstance()->unload(this->textures[textureNumber]);
     371
     372  if (this->textures.size() <= textureNumber)
     373    this->textures.resize(textureNumber+1, NULL);
     374
     375  if(surface != NULL)
     376  {
     377    this->textures[textureNumber] = &Texture(surface, GL_TEXTURE_2D);
     378  }
     379  else
     380  {
     381    this->textures[textureNumber] = NULL;
     382  }
     383
     384}
     385
     386
     387/**
    357388 *  Sets the Materials Ambient Map
    358389 * @param aMap the Name of the Image to Use
  • branches/bsp_model/src/lib/graphics/importer/material.h

    r7513 r7524  
    1010#include "base_object.h"
    1111
     12
    1213#if HAVE_CONFIG_H
    1314#include <config.h>
     
    1516
    1617#include <vector>
    17 
     18#include "SDL_image.h"
    1819
    1920#include "texture.h"
     
    5354    // MAPPING //
    5455    void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
     56    void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
    5557
    5658    void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
Note: See TracChangeset for help on using the changeset viewer.