Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6470 in orxonox.OLD for trunk/src/world_entities/skybox.cc


Ignore:
Timestamp:
Jan 11, 2006, 12:21:42 PM (20 years ago)
Author:
bensch
Message:

trunk some work on cubeMap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/skybox.cc

    r6341 r6470  
    2121#include "factory.h"
    2222#include "static_model.h"
     23
    2324#include "material.h"
     25#include "texture.h"
     26
    2427#include "network_game_manager.h"
    2528#include "converter.h"
     
    7780      this->material[i]->setSpecular(0.0,0.0,0.0);
    7881      this->material[i]->setAmbient(2.0, 2.0, 2.0);
     82
     83      this->texture[i] = NULL;
    7984    }
    8085  this->setParentMode(PNODE_MOVEMENT);
     
    145150 * @param back the back texture.
    146151*/
    147 void SkyBox::setTextures(const char* top, const char* bottom, const char* left, const char* right, const char* front, const char* back)
     152void SkyBox::setTextures(const char* top, const char* bottom, const char* left,
     153                          const char* right, const char* front, const char* back)
    148154{
    149155  this->material[0]->setDiffuseMap(top);
     
    153159  this->material[4]->setDiffuseMap(front);
    154160  this->material[5]->setDiffuseMap(back);
    155 }
     161  this->loadCubeMapTextures(top, bottom, left, right, front, back);
     162  //this->enableCubeMap();
     163}
     164
     165void SkyBox::loadCubeMapTextures(const char* top, const char* bottom, const char* left,
     166                                  const char* right, const char* front, const char* back)
     167{
     168  this->texture[0] = new Texture (top, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB);
     169  this->texture[1] = new Texture (bottom, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB);
     170  this->texture[2] = new Texture (left, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
     171  this->texture[3] = new Texture (right, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB);
     172  this->texture[4] = new Texture (front, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB);
     173  this->texture[5] = new Texture (back, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB);
     174}
     175
     176void SkyBox::enableCubeMap()
     177{
     178  glEnable(GL_TEXTURE_CUBE_MAP_ARB);
     179  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
     180  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
     181  glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
     182  glEnable(GL_TEXTURE_GEN_S);
     183  glEnable(GL_TEXTURE_GEN_T);
     184  glEnable(GL_TEXTURE_GEN_R);
     185}
     186
     187void SkyBox::disableCubeMap()
     188{
     189  glDisable(GL_TEXTURE_CUBE_MAP_ARB);
     190  glDisable(GL_TEXTURE_GEN_S);
     191  glDisable(GL_TEXTURE_GEN_T);
     192  glDisable(GL_TEXTURE_GEN_R);
     193}
     194
     195
    156196
    157197/**
Note: See TracChangeset for help on using the changeset viewer.