Changeset 6470 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 11, 2006, 12:21:42 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/environments/water.cc
r6467 r6470 25 25 #include "resource_manager.h" 26 26 #include "shader.h" 27 28 #include "skybox.h" 27 29 28 30 … … 103 105 void Water::draw() const 104 106 { 105 this->waterShader->activateShader(); 107 //SkyBox::enableCubeMap(); 108 109 // this->waterShader->activateShader(); 106 110 // this->waterMaterial->select(); 107 111 WorldEntity::draw(); 108 Shader::deactivateShader(); 112 //Shader::deactivateShader(); 113 114 //SkyBox::disableCubeMap(); 109 115 } 110 116 -
trunk/src/world_entities/skybox.cc
r6341 r6470 21 21 #include "factory.h" 22 22 #include "static_model.h" 23 23 24 #include "material.h" 25 #include "texture.h" 26 24 27 #include "network_game_manager.h" 25 28 #include "converter.h" … … 77 80 this->material[i]->setSpecular(0.0,0.0,0.0); 78 81 this->material[i]->setAmbient(2.0, 2.0, 2.0); 82 83 this->texture[i] = NULL; 79 84 } 80 85 this->setParentMode(PNODE_MOVEMENT); … … 145 150 * @param back the back texture. 146 151 */ 147 void SkyBox::setTextures(const char* top, const char* bottom, const char* left, const char* right, const char* front, const char* back) 152 void SkyBox::setTextures(const char* top, const char* bottom, const char* left, 153 const char* right, const char* front, const char* back) 148 154 { 149 155 this->material[0]->setDiffuseMap(top); … … 153 159 this->material[4]->setDiffuseMap(front); 154 160 this->material[5]->setDiffuseMap(back); 155 } 161 this->loadCubeMapTextures(top, bottom, left, right, front, back); 162 //this->enableCubeMap(); 163 } 164 165 void 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 176 void 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 187 void 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 156 196 157 197 /** -
trunk/src/world_entities/skybox.h
r6341 r6470 15 15 /* FORWARD DECLARATION */ 16 16 class Material; 17 class Texture; 17 18 18 19 //! A Class to handle a SkyBox … … 41 42 const char* right, const char* front, const char* back); 42 43 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 43 50 virtual int writeBytes(const byte* data, int length, int sender); 44 51 virtual int readBytes(byte* data, int maxLength, int * reciever); … … 50 57 51 58 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 52 61 float size; //!< Size of the SkyBox. This should match the frustum maximum range. 53 62 char* textureName; //!< Name of the Texture
Note: See TracChangeset
for help on using the changeset viewer.