Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6470 in orxonox.OLD for trunk/src


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

trunk some work on cubeMap

Location:
trunk/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/environments/water.cc

    r6467 r6470  
    2525#include "resource_manager.h"
    2626#include "shader.h"
     27
     28#include "skybox.h"
    2729
    2830
     
    103105void Water::draw() const
    104106{
    105   this->waterShader->activateShader();
     107  //SkyBox::enableCubeMap();
     108
     109 // this->waterShader->activateShader();
    106110//  this->waterMaterial->select();
    107111  WorldEntity::draw();
    108   Shader::deactivateShader();
     112  //Shader::deactivateShader();
     113
     114  //SkyBox::disableCubeMap();
    109115}
    110116
  • 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/**
  • trunk/src/world_entities/skybox.h

    r6341 r6470  
    1515/* FORWARD DECLARATION */
    1616class Material;
     17class Texture;
    1718
    1819//! A Class to handle a SkyBox
     
    4142                   const char* right, const char* front, const char* back);
    4243
     44  void loadCubeMapTextures(const char* top, const char* bottom, const char* left,
     45                           const char* right, const char* front, const char* back);
     46
     47  static void enableCubeMap();
     48  static void disableCubeMap();
     49
    4350  virtual int       writeBytes(const byte* data, int length, int sender);
    4451  virtual int       readBytes(byte* data, int maxLength, int * reciever);
     
    5057
    5158  Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
     59  Texture*        texture[6];      //!< Textures for the CubeMap.
     60
    5261  float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
    5362  char*           textureName;     //!< Name of the Texture
Note: See TracChangeset for help on using the changeset viewer.