Changeset 9818 in orxonox.OLD for branches/new_class_id/src/world_entities
- Timestamp:
- Sep 25, 2006, 12:10:07 PM (18 years ago)
- Location:
- branches/new_class_id/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/world_entities/environments/mapped_water.cc
r9757 r9818 77 77 MappedWater::~MappedWater() 78 78 { 79 delete shader;80 79 delete cam_uni; 81 80 delete color_uni; … … 165 164 { 166 165 // load shader files 167 shader = newShader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");168 169 this->shader ->activateShader();166 shader = Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag"); 167 168 this->shader.activateShader(); 170 169 // Set the variable "reflection" to correspond to the first texture unit 171 170 Shader::Uniform(shader, "reflection").set(0); … … 199 198 cam_uni = new Shader::Uniform(shader, "cameraPos"); 200 199 201 this->shader ->deactivateShader();200 this->shader.deactivateShader(); 202 201 } 203 202 … … 225 224 void MappedWater::resetWaterColor(float r, float g, float b) 226 225 { 227 this->shader ->activateShader();226 this->shader.activateShader(); 228 227 this->waterColor = Vector(r, g, b); 229 228 … … 231 230 color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f); 232 231 233 this->shader ->deactivateShader();232 this->shader.deactivateShader(); 234 233 } 235 234 … … 240 239 void MappedWater::resetShineSize(float shine) 241 240 { 242 this->shader ->activateShader();241 this->shader.activateShader(); 243 242 this->shineSize = shine; 244 243 … … 246 245 shineSize_uni->set(this->shineSize); 247 246 248 this->shader ->deactivateShader();247 this->shader.deactivateShader(); 249 248 } 250 249 … … 255 254 void MappedWater::resetShineStrength(float strength) 256 255 { 257 this->shader ->activateShader();256 this->shader.activateShader(); 258 257 this->shineStrength = strength; 259 258 … … 261 260 shineStrength_uni->set(this->shineStrength); 262 261 263 this->shader ->deactivateShader();262 this->shader.deactivateShader(); 264 263 } 265 264 … … 270 269 void MappedWater::resetReflStrength(float strength) 271 270 { 272 this->shader ->activateShader();271 this->shader.activateShader(); 273 272 this->reflStrength = strength; 274 273 … … 276 275 reflStrength_uni->set(this->reflStrength); 277 276 278 this->shader ->deactivateShader();277 this->shader.deactivateShader(); 279 278 } 280 279 … … 285 284 void MappedWater::resetRefraction(float refraction) 286 285 { 287 this->shader ->activateShader();286 this->shader.activateShader(); 288 287 this->refraction = refraction; 289 288 … … 291 290 refr_uni->set(this->refraction); 292 291 293 this->shader ->deactivateShader();292 this->shader.deactivateShader(); 294 293 } 295 294 … … 302 301 void MappedWater::resetLightPos(float x, float y, float z) 303 302 { 304 this->shader ->activateShader();303 this->shader.activateShader(); 305 304 this->lightPos = Vector(x, y, z); 306 305 … … 308 307 light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f); 309 308 310 this->shader ->deactivateShader();309 this->shader.deactivateShader(); 311 310 } 312 311 … … 556 555 mat.select(); 557 556 558 this->shader ->activateShader();557 this->shader.activateShader(); 559 558 560 559 // reset the camera uniform to the current cam position … … 595 594 glEnd(); 596 595 597 this->shader ->deactivateShader();596 this->shader.deactivateShader(); 598 597 599 598 mat.unselect(); -
branches/new_class_id/src/world_entities/environments/mapped_water.h
r9715 r9818 107 107 private: 108 108 Material mat; 109 Shader *shader;109 Shader shader; 110 110 OrxGui::GLGuiBox* box; 111 111 -
branches/new_class_id/src/world_entities/weather_effects/cloud_effect.cc
r9760 r9818 76 76 if (glIsTexture(noise3DTexName)) 77 77 glDeleteTextures(1, &noise3DTexName); 78 79 delete shader;80 78 } 81 79 … … 122 120 this->skydome->setTexture(noise3DTexName); 123 121 124 this->shader = newShader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert",122 this->shader = Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert", 125 123 ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.frag"); 126 124 127 this->shader ->activateShader();125 this->shader.activateShader(); 128 126 129 127 Shader::Uniform(shader, "Noise").set(0); … … 133 131 this->cloudcolor = new Shader::Uniform(shader, "CloudColor"); 134 132 135 this->shader ->deactivateShader();136 137 this->skydome->setShader( shader);133 this->shader.deactivateShader(); 134 135 this->skydome->setShader(&shader); 138 136 } 139 137 … … 163 161 164 162 // Can only be set after the loadParams call 165 this->shader ->activateShader();163 this->shader.activateShader(); 166 164 Shader::Uniform(shader, "Scale").set(this->scale); 167 165 this->skycolor->set … … 169 167 this->cloudcolor->set 170 168 (cloudColor.x, cloudColor.y, cloudColor.z); 171 this->shader ->deactivateShader();169 this->shader.deactivateShader(); 172 170 173 171 this->skydome->generateSkyPlane(this->divs, this->planetRadius, this->atmosphericRadius, 1, 1); … … 192 190 this->offsetZ += 0.05 * dt * this->animationSpeed; 193 191 194 this->shader ->activateShader();192 this->shader.activateShader(); 195 193 this->offset->set 196 194 (0.0f, 0.0f, offsetZ); … … 258 256 } 259 257 260 this->shader ->deactivateShader();258 this->shader.deactivateShader(); 261 259 } 262 260 } -
branches/new_class_id/src/world_entities/weather_effects/cloud_effect.h
r9760 r9818 143 143 144 144 // SHADER STUFF 145 Shader *shader;145 Shader shader; 146 146 Shader::Uniform* offset; 147 147 Shader::Uniform* skycolor;
Note: See TracChangeset
for help on using the changeset viewer.