- Timestamp:
- Jul 2, 2006, 2:11:59 PM (18 years ago)
- Location:
- trunk/src
- Files:
-
- 2 deleted
- 19 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Makefile.am
r8271 r9006 46 46 lib/graphics/effects/snow_effect.cc \ 47 47 lib/graphics/effects/cloud_effect.cc \ 48 lib/graphics/effects/light ening_effect.cc \48 lib/graphics/effects/lightning_effect.cc \ 49 49 lib/graphics/effects/lense_flare.cc \ 50 50 \ -
trunk/src/defs/class_id.h
r9003 r9006 336 336 CL_SNOW_EFFECT = 0x00000a14, 337 337 CL_CLOUD_EFFECT = 0x00000a15, 338 CL_LIGHT ENING_EFFECT = 0x00000a16,338 CL_LIGHTNING_EFFECT = 0x00000a16, 339 339 CL_EXPLOSION = 0x00000a20, 340 340 CL_LIGHTNING_BOLT = 0x00000a21, -
trunk/src/lib/graphics/Makefile.am
r8751 r9006 29 29 effects/snow_effect.cc \ 30 30 effects/cloud_effect.cc \ 31 effects/light ening_effect.cc \31 effects/lightning_effect.cc \ 32 32 effects/lense_flare.cc 33 33 … … 58 58 effects/snow_effect.h \ 59 59 effects/cloud_effect.h \ 60 effects/light ening_effect.h \60 effects/lightning_effect.h \ 61 61 effects/lense_flare.h 62 62 -
trunk/src/lib/graphics/effects/cloud_effect.cc
r8793 r9006 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler 13 13 14 14 INSPIRED BY http://www.codesampler.com/usersrc/usersrc_6.htm#oglu_sky_dome_shader 15 15 */ … … 26 26 #include "shader.h" 27 27 #include "shell_command.h" 28 #include "t_animation.h" 29 #include "script_class.h" 28 30 29 31 #include "parser/tinyxml/tinyxml.h" 30 32 31 Vector CloudEffect::cloudColor; 32 Vector CloudEffect::skyColor; 33 Vector CloudEffect::newCloudColor; 34 Vector CloudEffect::newSkyColor; 33 Vector CloudEffect::cloudColor; 34 Vector CloudEffect::skyColor; 35 Vector CloudEffect::newCloudColor; 36 Vector CloudEffect::newSkyColor; 37 38 bool CloudEffect::fadeSky; 39 bool CloudEffect::fadeCloud; 40 float CloudEffect::fadeTime; 41 bool CloudEffect::flashSkyActivate; 42 float CloudEffect::localTimer; 43 float CloudEffect::flashTime; 35 44 36 45 using namespace std; … … 38 47 SHELL_COMMAND(activate, CloudEffect, activateCloud); 39 48 SHELL_COMMAND(deactivate, CloudEffect, deactivateCloud); 49 SHELL_COMMAND(skyColor, CloudEffect, shellSkyColor); 50 SHELL_COMMAND(cloudColor, CloudEffect, shellCloudColor); 51 52 53 CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT, 54 addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor)) 55 ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor)) 56 ); 57 40 58 41 59 CREATE_FACTORY(CloudEffect, CL_CLOUD_EFFECT); 42 60 43 CloudEffect::CloudEffect(const TiXmlElement* root) 44 { 45 this->setClassID(CL_CLOUD_EFFECT, "CloudEffect"); 46 47 this->init(); 48 49 if (root != NULL) 50 this->loadParams(root); 51 52 if(cloudActivate) 53 this->activate(); 54 } 55 56 CloudEffect::~CloudEffect() 57 { 58 this->deactivate(); 59 60 if (glIsTexture(noise3DTexName)) 61 glDeleteTextures(1, &noise3DTexName); 62 63 delete shader; 64 } 65 66 67 void CloudEffect::init() 68 { 69 PRINTF(0)("Initializing CloudEffect\n"); 70 71 this->offsetZ = 0; 72 this->animationSpeed = 2; 73 this->scale = 0.0004f; 74 this->atmosphericRadius = 4000; 75 this->planetRadius = 1500; 76 this->divs = 50; 77 78 skyColor = Vector(0.0f, 0.0f, 0.8f); 79 cloudColor = Vector(0.8f, 0.8f, 0.8f); 80 newSkyColor = skyColor; 81 newCloudColor = cloudColor; 82 this->fadeTime = 3; 83 84 this->noise3DTexSize = 128; 85 this->noise3DTexName = 0; 86 87 this->make3DNoiseTexture(); 88 89 glGenTextures(1, &noise3DTexName); 90 glBindTexture(GL_TEXTURE_3D, noise3DTexName); 91 92 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); 93 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); 94 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); 95 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 96 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 97 98 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 99 noise3DTexSize, noise3DTexSize, noise3DTexSize, 100 0, GL_RGBA, GL_UNSIGNED_BYTE, noise3DTexPtr); 101 102 this->skydome = new Skydome(); 103 this->skydome->setTexture(noise3DTexName); 104 105 this->shader = new Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert", 106 ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.frag"); 107 108 this->shader->activateShader(); 109 110 Shader::Uniform(shader, "Noise").set(0); 111 112 this->offset = new Shader::Uniform(shader, "Offset"); 113 this->skycolor = new Shader::Uniform(shader, "SkyColor"); 114 this->cloudcolor = new Shader::Uniform(shader, "CloudColor"); 115 116 this->shader->deactivateShader(); 117 118 this->skydome->setShader(shader); 119 } 120 121 122 void CloudEffect::loadParams(const TiXmlElement* root) 123 { 124 WeatherEffect::loadParams(root); 125 126 LoadParam(root, "speed", this, CloudEffect, setAnimationSpeed); 127 LoadParam(root, "scale", this, CloudEffect, setCloudScale); 128 LoadParam(root, "cloudcolor", this, CloudEffect, setCloudColor); 129 LoadParam(root, "skycolor", this, CloudEffect, setSkyColor); 130 131 LoadParam(root, "planetRadius", this, CloudEffect, setPlanetRadius); 132 LoadParam(root, "atmosphericRadius", this, CloudEffect, setAtmosphericRadius); 133 LoadParam(root, "divisions", this, CloudEffect, setDivisions); 134 135 LOAD_PARAM_START_CYCLE(root, element); 136 { 137 LoadParam_CYCLE(element, "option", this, CloudEffect, setCloudOption); 138 } 139 LOAD_PARAM_END_CYCLE(element); 140 } 141 142 143 void CloudEffect::activate() 144 { 145 PRINTF(0)( "Activating\n"); 146 147 // Can only be set after the loadParams call 148 this->shader->activateShader(); 149 Shader::Uniform(shader, "Scale").set(this->scale); 150 this->skycolor->set(skyColor.x, skyColor.y, skyColor.z); 151 this->cloudcolor->set(cloudColor.x, cloudColor.y, cloudColor.z); 152 this->shader->deactivateShader(); 153 154 this->skydome->generateSkyPlane(this->divs, this->planetRadius, this->atmosphericRadius, 1, 1); 155 156 this->cloudActivate = true; 157 } 158 159 void CloudEffect::deactivate() 160 { 161 PRINTF(0)("Deactivating CloudEffect\n"); 162 163 this->cloudActivate = false; 164 } 165 166 void CloudEffect::draw() const 167 {} 168 169 void CloudEffect::tick (float dt) 170 { 171 if (this->cloudActivate) 172 { 173 this->offsetZ += 0.05 * dt * this->animationSpeed; 61 CloudEffect::CloudEffect(const TiXmlElement* root) { 62 this->setClassID(CL_CLOUD_EFFECT, "CloudEffect"); 63 64 this->init(); 65 66 if (root != NULL) 67 this->loadParams(root); 68 69 if(cloudActivate) 70 this->activate(); 71 } 72 73 CloudEffect::~CloudEffect() { 74 this->deactivate(); 75 76 if (glIsTexture(noise3DTexName)) 77 glDeleteTextures(1, &noise3DTexName); 78 79 delete shader; 80 } 81 82 83 void CloudEffect::init() { 84 PRINTF(0)("Initializing CloudEffect\n"); 85 86 // default values 87 this->offsetZ = 0; 88 this->animationSpeed = 2; 89 this->scale = 0.0004f; 90 this->atmosphericRadius = 4000; 91 this->planetRadius = 1500; 92 this->divs = 15; 93 fadeSky = false; 94 fadeCloud = false; 95 96 flashSkyActivate = false; 97 localTimer = 0; 98 flashTime = 0; 99 100 skyColor = Vector(0.0f, 0.0f, 0.8f); 101 cloudColor = Vector(0.8f, 0.8f, 0.8f); 102 newSkyColor = skyColor; 103 newCloudColor = cloudColor; 104 105 this->noise3DTexSize = 128; 106 this->noise3DTexName = 0; 107 108 this->make3DNoiseTexture(); 109 110 glGenTextures(1, &noise3DTexName); 111 glBindTexture(GL_TEXTURE_3D, noise3DTexName); 112 113 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); 114 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); 115 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); 116 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 117 glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 118 119 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 120 noise3DTexSize, noise3DTexSize, noise3DTexSize, 121 0, GL_RGBA, GL_UNSIGNED_BYTE, noise3DTexPtr); 122 123 this->skydome = new Skydome(); 124 this->skydome->setTexture(noise3DTexName); 125 126 this->shader = new Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert", 127 ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.frag"); 174 128 175 129 this->shader->activateShader(); 176 this->offset->set(0.0f, 0.0f, offsetZ); 177 178 //if(cloudColor != newCloudColor) 179 //{ 180 // TODO: fade from cloudColor to newCloudColor 181 cloudColor = newCloudColor; 182 this->cloudcolor->set(this->cloudColor.x, this->cloudColor.y, this->cloudColor.z); 183 //} 184 //if(cloudColor != newCloudColor) 185 //{ 186 // TODO: fade from skyColor to newSkyColor 187 skyColor = newSkyColor; 188 this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z); 189 //} 190 130 131 Shader::Uniform(shader, "Noise").set(0); 132 133 this->offset = new Shader::Uniform(shader, "Offset"); 134 this->skycolor = new Shader::Uniform(shader, "SkyColor"); 135 this->cloudcolor = new Shader::Uniform(shader, "CloudColor"); 136 191 137 this->shader->deactivateShader(); 192 } 193 } 194 195 196 void CloudEffect::changeSkyColor(Vector color) 197 { 198 newSkyColor = color; 199 } 200 201 202 void CloudEffect::changeCloudColor(Vector color) 203 { 204 newCloudColor = color; 205 } 206 207 208 void CloudEffect::make3DNoiseTexture() 209 { 210 int f, i, j, k, inc; 211 int startFrequency = 4; 212 int numOctaves = 4; 213 double ni[3]; 214 double inci, incj, inck; 215 int frequency = startFrequency; 216 GLubyte *ptr; 217 double amp = 0.5; 218 219 if ((noise3DTexPtr = (GLubyte *) malloc(noise3DTexSize * 220 noise3DTexSize * 221 noise3DTexSize * 4)) == NULL) 222 PRINTF(0)("ERROR: Could not allocate 3D noise texture\n"); 223 224 for (f=0, inc=0; f < numOctaves; 225 ++f, frequency *= 2, ++inc, amp *= 0.5) 226 { 227 SetNoiseFrequency(frequency); 228 ptr = noise3DTexPtr; 229 ni[0] = ni[1] = ni[2] = 0; 230 231 inci = 1.0 / (noise3DTexSize / frequency); 232 for (i=0; i<noise3DTexSize; ++i, ni[0] += inci) 138 139 this->skydome->setShader(shader); 140 } 141 142 143 void CloudEffect::loadParams(const TiXmlElement* root) { 144 WeatherEffect::loadParams(root); 145 146 LoadParam(root, "speed", this, CloudEffect, setAnimationSpeed); 147 LoadParam(root, "scale", this, CloudEffect, setCloudScale); 148 LoadParam(root, "cloudcolor", this, CloudEffect, setCloudColor); 149 LoadParam(root, "skycolor", this, CloudEffect, setSkyColor); 150 151 LoadParam(root, "planetRadius", this, CloudEffect, setPlanetRadius); 152 LoadParam(root, "atmosphericRadius", this, CloudEffect, setAtmosphericRadius); 153 LoadParam(root, "divisions", this, CloudEffect, setDivisions); 154 155 LOAD_PARAM_START_CYCLE(root, element); 233 156 { 234 incj = 1.0 / (noise3DTexSize / frequency); 235 for (j=0; j<noise3DTexSize; ++j, ni[1] += incj) 236 { 237 inck = 1.0 / (noise3DTexSize / frequency); 238 for (k=0; k<noise3DTexSize; ++k, ni[2] += inck, ptr+= 4) 239 { 240 *(ptr+inc) = (GLubyte) (((noise3(ni)+1.0) * amp)*128.0); 157 LoadParam_CYCLE(element, "option", this, CloudEffect, setCloudOption); 158 } 159 LOAD_PARAM_END_CYCLE(element); 160 } 161 162 163 void CloudEffect::activate() { 164 PRINTF(0)( "Activating\n"); 165 166 // Can only be set after the loadParams call 167 this->shader->activateShader(); 168 Shader::Uniform(shader, "Scale").set(this->scale); 169 this->skycolor->set 170 (skyColor.x, skyColor.y, skyColor.z); 171 this->cloudcolor->set 172 (cloudColor.x, cloudColor.y, cloudColor.z); 173 this->shader->deactivateShader(); 174 175 this->skydome->generateSkyPlane(this->divs, this->planetRadius, this->atmosphericRadius, 1, 1); 176 this->skydome->activate(); 177 178 this->cloudActivate = true; 179 } 180 181 void CloudEffect::deactivate() { 182 PRINTF(0)("Deactivating CloudEffect\n"); 183 184 this->skydome->deactivate(); 185 this->cloudActivate = false; 186 } 187 188 void CloudEffect::draw() const {} 189 190 void CloudEffect::tick (float dt) { 191 192 if (this->cloudActivate) { 193 194 localTimer += dt; 195 196 this->offsetZ += 0.05 * dt * this->animationSpeed; 197 198 this->shader->activateShader(); 199 this->offset->set(0.0f, 0.0f, offsetZ); 200 201 if (flashSkyActivate) { 202 203 this->skycolor->set(1, 1, 1); 204 PRINTF(0)("SkyColor set to white\n"); 205 206 if (localTimer > flashTime) { 207 flashSkyActivate = false; 208 this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z); 209 PRINTF(0)("SkyColor reset\n"); 210 } 211 212 } else { 213 214 if(cloudColor != newCloudColor) { 215 216 if(fadeCloud) { 217 218 this->cloudColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudX); 219 this->cloudColorFadeX->setInfinity(ANIM_INF_CONSTANT); 220 this->cloudColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudY); 221 this->cloudColorFadeY->setInfinity(ANIM_INF_CONSTANT); 222 this->cloudColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudZ); 223 this->cloudColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 224 225 this->cloudColorFadeX->addKeyFrame(cloudColor.x, fadeTime, ANIM_LINEAR); 226 this->cloudColorFadeX->addKeyFrame(newCloudColor.x, 0, ANIM_LINEAR); 227 228 this->cloudColorFadeY->addKeyFrame(cloudColor.y, fadeTime, ANIM_LINEAR); 229 this->cloudColorFadeY->addKeyFrame(newCloudColor.y, 0, ANIM_LINEAR); 230 231 this->cloudColorFadeZ->addKeyFrame(cloudColor.z, fadeTime, ANIM_LINEAR); 232 this->cloudColorFadeZ->addKeyFrame(newCloudColor.z, 0, ANIM_LINEAR); 233 234 fadeCloud = false; 235 236 this->cloudColorFadeX->replay(); 237 this->cloudColorFadeY->replay(); 238 this->cloudColorFadeZ->replay(); 239 } 240 241 this->cloudcolor->set(this->cloudColor.x, this->cloudColor.y, this->cloudColor.z); 242 } 243 244 if(skyColor != newSkyColor) { 245 246 if(fadeSky) { 247 248 this->skyColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyX); 249 this->skyColorFadeX->setInfinity(ANIM_INF_CONSTANT); 250 this->skyColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyY); 251 this->skyColorFadeY->setInfinity(ANIM_INF_CONSTANT); 252 this->skyColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyZ); 253 this->skyColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 254 255 this->skyColorFadeX->addKeyFrame(skyColor.x, fadeTime, ANIM_LINEAR); 256 this->skyColorFadeX->addKeyFrame(newSkyColor.x, 0, ANIM_LINEAR); 257 258 this->skyColorFadeY->addKeyFrame(skyColor.y, fadeTime, ANIM_LINEAR); 259 this->skyColorFadeY->addKeyFrame(newSkyColor.y, 0, ANIM_LINEAR); 260 261 this->skyColorFadeZ->addKeyFrame(skyColor.z, fadeTime, ANIM_LINEAR); 262 this->skyColorFadeZ->addKeyFrame(newSkyColor.z, 0, ANIM_LINEAR); 263 264 fadeSky = false; 265 266 this->skyColorFadeX->replay(); 267 this->skyColorFadeY->replay(); 268 this->skyColorFadeZ->replay(); 269 } 270 271 this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z); 272 } 241 273 } 242 } 243 } 244 } 245 } 246 247 void CloudEffect::initNoise() 248 { 249 int i, j, k; 250 251 srand(30757); 252 for (i = 0 ; i < B ; i++) 253 { 254 p[i] = i; 255 g1[i] = (double)((rand() % (B + B)) - B) / B; 256 257 for (j = 0 ; j < 2 ; j++) 258 g2[i][j] = (double)((rand() % (B + B)) - B) / B; 259 normalize2(g2[i]); 260 261 for (j = 0 ; j < 3 ; j++) 262 g3[i][j] = (double)((rand() % (B + B)) - B) / B; 263 normalize3(g3[i]); 264 } 265 266 while (--i) 267 { 268 k = p[i]; 269 p[i] = p[j = rand() % B]; 270 p[j] = k; 271 } 272 273 for (i = 0 ; i < B + 2 ; i++) 274 { 275 p[B + i] = p[i]; 276 g1[B + i] = g1[i]; 277 for (j = 0 ; j < 2 ; j++) 278 g2[B + i][j] = g2[i][j]; 279 for (j = 0 ; j < 3 ; j++) 280 g3[B + i][j] = g3[i][j]; 281 } 282 } 283 284 void CloudEffect::SetNoiseFrequency( int frequency) 285 { 286 start = 1; 287 B = frequency; 288 BM = B-1; 289 } 290 291 double CloudEffect::noise3( double vec[3]) 292 { 293 int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11; 294 double rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v; 295 int i, j; 296 297 if (start) 298 { 299 start = 0; 300 initNoise(); 301 } 302 303 setup(0, bx0,bx1, rx0,rx1); 304 setup(1, by0,by1, ry0,ry1); 305 setup(2, bz0,bz1, rz0,rz1); 306 307 i = p[ bx0 ]; 308 j = p[ bx1 ]; 309 310 b00 = p[ i + by0 ]; 311 b10 = p[ j + by0 ]; 312 b01 = p[ i + by1 ]; 313 b11 = p[ j + by1 ]; 314 315 t = s_curve(rx0); 316 sy = s_curve(ry0); 317 sz = s_curve(rz0); 318 319 q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0); 320 q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0); 321 a = lerp(t, u, v); 322 323 q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0); 324 q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0); 325 b = lerp(t, u, v); 326 327 c = lerp(sy, a, b); 328 329 q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1); 330 q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1); 331 a = lerp(t, u, v); 332 333 q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1); 334 q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1); 335 b = lerp(t, u, v); 336 337 d = lerp(sy, a, b); 338 339 return lerp(sz, c, d); 340 } 341 342 void CloudEffect::normalize2( double v[2]) 343 { 344 double s; 345 346 s = sqrt(v[0] * v[0] + v[1] * v[1]); 347 v[0] = v[0] / s; 348 v[1] = v[1] / s; 349 } 350 351 void CloudEffect::normalize3( double v[3]) 352 { 353 double s; 354 355 s = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); 356 v[0] = v[0] / s; 357 v[1] = v[1] / s; 358 v[2] = v[2] / s; 359 } 360 274 275 this->shader->deactivateShader(); 276 } 277 } 278 279 280 void CloudEffect::setColorSkyX(float color) { 281 skyColor.x = color; 282 } 283 void CloudEffect::setColorSkyY(float color) { 284 skyColor.y = color; 285 } 286 void CloudEffect::setColorSkyZ(float color) { 287 skyColor.z = color; 288 } 289 void CloudEffect::setColorCloudX(float color) { 290 cloudColor.x = color; 291 } 292 void CloudEffect::setColorCloudY(float color) { 293 cloudColor.y = color; 294 } 295 void CloudEffect::setColorCloudZ(float color) { 296 cloudColor.z = color; 297 } 298 299 void CloudEffect::changeSkyColor(Vector color, float time) { 300 newSkyColor = color; 301 fadeSky = true; 302 fadeTime = time; 303 } 304 305 306 void CloudEffect::changeCloudColor(Vector color, float time) { 307 newCloudColor = color; 308 fadeCloud = true; 309 fadeTime = time; 310 } 311 312 void CloudEffect::shellSkyColor(float colorX, float colorY, float colorZ, float time) { 313 changeSkyColor( Vector(colorX, colorY, colorZ), time); 314 } 315 316 void CloudEffect::shellCloudColor(float colorX, float colorY, float colorZ, float time) { 317 changeCloudColor( Vector(colorX, colorY, colorZ), time); 318 } 319 320 void CloudEffect::flashSky( float time ) { 321 322 flashSkyActivate = true; 323 localTimer = 0; 324 flashTime = time; 325 326 } 327 328 329 330 void CloudEffect::make3DNoiseTexture() { 331 int f, i, j, k, inc; 332 int startFrequency = 4; 333 int numOctaves = 4; 334 double ni[3]; 335 double inci, incj, inck; 336 int frequency = startFrequency; 337 GLubyte *ptr; 338 double amp = 0.5; 339 340 if ((noise3DTexPtr = (GLubyte *) malloc(noise3DTexSize * 341 noise3DTexSize * 342 noise3DTexSize * 4)) == NULL) 343 PRINTF(0)("ERROR: Could not allocate 3D noise texture\n"); 344 345 for (f=0, inc=0; f < numOctaves; 346 ++f, frequency *= 2, ++inc, amp *= 0.5) { 347 SetNoiseFrequency(frequency); 348 ptr = noise3DTexPtr; 349 ni[0] = ni[1] = ni[2] = 0; 350 351 inci = 1.0 / (noise3DTexSize / frequency); 352 for (i=0; i<noise3DTexSize; ++i, ni[0] += inci) { 353 incj = 1.0 / (noise3DTexSize / frequency); 354 for (j=0; j<noise3DTexSize; ++j, ni[1] += incj) { 355 inck = 1.0 / (noise3DTexSize / frequency); 356 for (k=0; k<noise3DTexSize; ++k, ni[2] += inck, ptr+= 4) { 357 *(ptr+inc) = (GLubyte) (((noise3(ni)+1.0) * amp)*128.0); 358 } 359 } 360 } 361 } 362 } 363 364 void CloudEffect::initNoise() { 365 int i, j, k; 366 367 srand(30757); 368 for (i = 0 ; i < B ; i++) { 369 p[i] = i; 370 g1[i] = (double)((rand() % (B + B)) - B) / B; 371 372 for (j = 0 ; j < 2 ; j++) 373 g2[i][j] = (double)((rand() % (B + B)) - B) / B; 374 normalize2(g2[i]); 375 376 for (j = 0 ; j < 3 ; j++) 377 g3[i][j] = (double)((rand() % (B + B)) - B) / B; 378 normalize3(g3[i]); 379 } 380 381 while (--i) { 382 k = p[i]; 383 p[i] = p[j = rand() % B]; 384 p[j] = k; 385 } 386 387 for (i = 0 ; i < B + 2 ; i++) { 388 p[B + i] = p[i]; 389 g1[B + i] = g1[i]; 390 for (j = 0 ; j < 2 ; j++) 391 g2[B + i][j] = g2[i][j]; 392 for (j = 0 ; j < 3 ; j++) 393 g3[B + i][j] = g3[i][j]; 394 } 395 } 396 397 void CloudEffect::SetNoiseFrequency( int frequency) { 398 start = 1; 399 B = frequency; 400 BM = B-1; 401 } 402 403 double CloudEffect::noise3( double vec[3]) { 404 int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11; 405 double rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v; 406 int i, j; 407 408 if (start) { 409 start = 0; 410 initNoise(); 411 } 412 413 setup(0, bx0,bx1, rx0,rx1); 414 setup(1, by0,by1, ry0,ry1); 415 setup(2, bz0,bz1, rz0,rz1); 416 417 i = p[ bx0 ]; 418 j = p[ bx1 ]; 419 420 b00 = p[ i + by0 ]; 421 b10 = p[ j + by0 ]; 422 b01 = p[ i + by1 ]; 423 b11 = p[ j + by1 ]; 424 425 t = s_curve(rx0); 426 sy = s_curve(ry0); 427 sz = s_curve(rz0); 428 429 q = g3[ b00 + bz0 ] ; 430 u = at3(rx0,ry0,rz0); 431 q = g3[ b10 + bz0 ] ; 432 v = at3(rx1,ry0,rz0); 433 a = lerp(t, u, v); 434 435 q = g3[ b01 + bz0 ] ; 436 u = at3(rx0,ry1,rz0); 437 q = g3[ b11 + bz0 ] ; 438 v = at3(rx1,ry1,rz0); 439 b = lerp(t, u, v); 440 441 c = lerp(sy, a, b); 442 443 q = g3[ b00 + bz1 ] ; 444 u = at3(rx0,ry0,rz1); 445 q = g3[ b10 + bz1 ] ; 446 v = at3(rx1,ry0,rz1); 447 a = lerp(t, u, v); 448 449 q = g3[ b01 + bz1 ] ; 450 u = at3(rx0,ry1,rz1); 451 q = g3[ b11 + bz1 ] ; 452 v = at3(rx1,ry1,rz1); 453 b = lerp(t, u, v); 454 455 d = lerp(sy, a, b); 456 457 return lerp(sz, c, d); 458 } 459 460 void CloudEffect::normalize2( double v[2]) { 461 double s; 462 463 s = sqrt(v[0] * v[0] + v[1] * v[1]); 464 v[0] = v[0] / s; 465 v[1] = v[1] / s; 466 } 467 468 void CloudEffect::normalize3( double v[3]) { 469 double s; 470 471 s = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); 472 v[0] = v[0] / s; 473 v[1] = v[1] / s; 474 v[2] = v[2] / s; 475 } 476 -
trunk/src/lib/graphics/effects/cloud_effect.h
r8793 r9006 1 1 /** 2 2 * @file cloud_effect.h 3 * Create sclouds3 * Create clouds 4 4 */ 5 5 … … 32 32 #define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] ) 33 33 34 // FORWARD DECLARATION 35 template <class T> 36 class tAnimation; 34 37 35 class CloudEffect : public WeatherEffect 36 { 38 class CloudEffect : public WeatherEffect { 39 37 40 public: 38 CloudEffect(const TiXmlElement* root = NULL);39 virtual ~CloudEffect();40 41 41 virtual void loadParams(const TiXmlElement* root); 42 CloudEffect(const TiXmlElement* root = NULL); 43 virtual ~CloudEffect(); 42 44 43 virtual void init();45 virtual void loadParams(const TiXmlElement* root); 44 46 45 virtual void activate(); 46 virtual void deactivate(); 47 virtual void init(); 47 48 48 inline void activateCloud()49 { this->activate(); }49 virtual void activate(); 50 virtual void deactivate(); 50 51 51 inline void deactivateCloud() 52 { this->deactivate(); } 52 void activateCloud() { 53 this->activate(); 54 } 55 void deactivateCloud() { 56 this->deactivate(); 57 } 53 58 54 inline void setCloudOption(const std::string& option) 55 { 56 if (option == "activate") 57 this->cloudActivate = true; 58 } 59 void setCloudOption(const std::string& option) { 60 if (option == "activate") 61 this->cloudActivate = true; 62 } 59 63 60 inline void setAnimationSpeed(float speed) 61 { this->animationSpeed = speed; } 64 void setAnimationSpeed(float speed) { 65 this->animationSpeed = speed; 66 } 62 67 63 inline void setCloudScale(float scale) 64 { this->scale = scale; } 68 void setCloudScale(float scale) { 69 this->scale = scale; 70 } 65 71 66 inline void setCloudColor(float colorX, float colorY, float colorZ) 67 { this->cloudColor = Vector(colorX, colorY, colorZ); } 72 void setCloudColor(float colorX, float colorY, float colorZ) { 73 this->cloudColor = Vector(colorX, colorY, colorZ); 74 } 68 75 69 inline void setSkyColor(float colorX, float colorY, float colorZ) 70 { this->skyColor = Vector(colorX, colorY, colorZ); } 76 void setSkyColor(float colorX, float colorY, float colorZ) { 77 this->skyColor = Vector(colorX, colorY, colorZ); 78 } 71 79 72 inline void setPlanetRadius(float planetRadius) 73 { this->planetRadius = planetRadius; } 80 void setPlanetRadius(float planetRadius) { 81 this->planetRadius = planetRadius; 82 } 74 83 75 inline void setAtmosphericRadius(float atmosphericRadius) 76 { this->atmosphericRadius = atmosphericRadius; } 84 void setAtmosphericRadius(float atmosphericRadius) { 85 this->atmosphericRadius = atmosphericRadius; 86 } 77 87 78 inline void setDivisions(int divs) 79 { this->divs = divs; } 88 void setDivisions(int divs) { 89 this->divs = divs; 90 } 80 91 81 virtual void draw() const;82 virtual void tick(float dt);92 virtual void draw() const; 93 virtual void tick(float dt); 83 94 84 static void changeSkyColor(Vector color); 85 static void changeCloudColor(Vector color); 86 87 static Vector cloudColor; 88 static Vector skyColor; 95 static void changeSkyColor(Vector color, float time); 96 static void changeCloudColor(Vector color, float time); 89 97 90 void make3DNoiseTexture();91 void initNoise();92 void SetNoiseFrequency(int frequency);93 double noise3(double vec[3]);94 void normalize2(double v[2]);95 void normalize3(double v[3]);98 void setColorSkyX(float color); 99 void setColorSkyY(float color); 100 void setColorSkyZ(float color); 101 void setColorCloudX(float color); 102 void setColorCloudY(float color); 103 void setColorCloudZ(float color); 96 104 97 void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius, 98 float hTile, float vTile); 105 static Vector cloudColor; 106 static Vector skyColor; 107 108 void make3DNoiseTexture(); 109 void initNoise(); 110 void SetNoiseFrequency(int frequency); 111 double noise3(double vec[3]); 112 void normalize2(double v[2]); 113 void normalize3(double v[3]); 114 115 void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius, 116 float hTile, float vTile); 117 118 void shellSkyColor(float colorX, float colorY, float colorZ, float time); 119 void shellCloudColor(float colorX, float colorY, float colorZ, float time); 120 121 static void flashSky(float time); 122 99 123 private: 100 124 101 bool cloudActivate; 102 float animationSpeed; 103 float fadeTime; 104 105 static Vector newSkyColor; 106 static Vector newCloudColor; 125 bool cloudActivate; 126 float animationSpeed; 107 127 108 // Material cloudMaterial;109 Skydome* skydome;128 static Vector newSkyColor; 129 static Vector newCloudColor; 110 130 111 // SHADER STUFF 112 Shader* shader; 113 Shader::Uniform* offset; 114 Shader::Uniform* skycolor; 115 Shader::Uniform* cloudcolor; 116 float offsetZ; 117 float scale; 118 float planetRadius; 119 float atmosphericRadius; 120 int divs; 131 // Material cloudMaterial; 132 Skydome* skydome; 121 133 122 // NOISE STUFF 123 int noise3DTexSize; 124 GLuint noise3DTexName; 125 GLubyte *noise3DTexPtr; 134 tAnimation<CloudEffect>* skyColorFadeX; 135 tAnimation<CloudEffect>* skyColorFadeY; 136 tAnimation<CloudEffect>* skyColorFadeZ; 137 tAnimation<CloudEffect>* cloudColorFadeX; 138 tAnimation<CloudEffect>* cloudColorFadeY; 139 tAnimation<CloudEffect>* cloudColorFadeZ; 140 static bool fadeSky; 141 static bool fadeCloud; 142 static float fadeTime; 126 143 127 int p[MAXB + MAXB + 2]; 128 double g3[MAXB + MAXB + 2][3]; 129 double g2[MAXB + MAXB + 2][2]; 130 double g1[MAXB + MAXB + 2]; 144 // SHADER STUFF 145 Shader* shader; 146 Shader::Uniform* offset; 147 Shader::Uniform* skycolor; 148 Shader::Uniform* cloudcolor; 149 float offsetZ; 150 float scale; 151 float planetRadius; 152 float atmosphericRadius; 153 int divs; 131 154 132 int start; 133 int B; 134 int BM; 155 // NOISE STUFF 156 int noise3DTexSize; 157 GLuint noise3DTexName; 158 GLubyte *noise3DTexPtr; 159 160 int p[MAXB + MAXB + 2]; 161 double g3[MAXB + MAXB + 2][3]; 162 double g2[MAXB + MAXB + 2][2]; 163 double g1[MAXB + MAXB + 2]; 164 165 int start; 166 int B; 167 int BM; 168 169 static bool flashSkyActivate; 170 static float localTimer; 171 static float flashTime; 172 135 173 }; 136 174 -
trunk/src/lib/graphics/effects/fog_effect.cc
r8793 r9006 103 103 */ 104 104 void FogEffect::activate() { 105 PRINTF( 0)( "Activating FogEffect\n");105 PRINTF(3)( "Activating FogEffect\n"); 106 106 107 107 // init fogGL … … 123 123 */ 124 124 void FogEffect::deactivate() { 125 PRINTF( 0)("Deactivating FogEffect\n");125 PRINTF(3)("Deactivating FogEffect\n"); 126 126 127 127 this->fogFadeInActivate = false; -
trunk/src/lib/graphics/effects/lense_flare.cc
r8619 r9006 64 64 65 65 this->lightSource = (LightManager::getInstance())->getLight(0); 66 PRINTF( 0)("light is: %p\n", this->lightSource);66 PRINTF(4)("light is: %p\n", this->lightSource); 67 67 68 68 if (root != NULL) { -
trunk/src/lib/graphics/effects/rain_effect.cc
r8793 r9006 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler 13 13 */ 14 15 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS 14 16 15 17 #include "rain_effect.h" … … 43 45 * @brief standard constructor 44 46 */ 45 RainEffect::RainEffect(const TiXmlElement* root) 46 { 47 this->setClassID(CL_RAIN_EFFECT, "RainEffect"); 48 49 this->init(); 50 51 if (root != NULL) 52 this->loadParams(root); 53 54 //load rain sound 55 if (this->rainBuffer != NULL) 56 ResourceManager::getInstance()->unload(this->rainBuffer); 57 this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.wav", WAV); 58 59 //load wind sound 60 if (this->rainWindForce != 0) 61 { 47 RainEffect::RainEffect(const TiXmlElement* root) { 48 this->setClassID(CL_RAIN_EFFECT, "RainEffect"); 49 50 this->init(); 51 52 if (root != NULL) 53 this->loadParams(root); 54 55 //load rain sound 56 if (this->rainBuffer != NULL) 57 ResourceManager::getInstance()->unload(this->rainBuffer); 58 this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.wav", WAV); 59 60 //load wind sound 61 if (this->rainWindForce != 0) { 62 if (this->windBuffer != NULL) 63 ResourceManager::getInstance()->unload(this->windBuffer); 64 this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV); 65 } 66 67 if(rainActivate) { 68 this->activate(); 69 RainEffect::rainParticles->precache((int)this->rainLife * 2); 70 } 71 } 72 73 /** 74 * @brief standard deconstructor 75 */ 76 RainEffect::~RainEffect() { 77 this->deactivate(); 78 79 if (this->rainBuffer != NULL) 80 ResourceManager::getInstance()->unload(this->rainBuffer); 81 62 82 if (this->windBuffer != NULL) 63 ResourceManager::getInstance()->unload(this->windBuffer); 64 this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV); 65 } 66 67 if(rainActivate) 68 { 69 this->activate(); 70 RainEffect::rainParticles->precache((int)this->rainLife * 2); 71 } 72 } 73 74 /** 75 * @brief standard deconstructor 76 */ 77 RainEffect::~RainEffect() 78 { 79 this->deactivate(); 80 81 if (this->rainBuffer != NULL) 82 ResourceManager::getInstance()->unload(this->rainBuffer); 83 84 if (this->windBuffer != NULL) 85 ResourceManager::getInstance()->unload(this->windBuffer); 83 ResourceManager::getInstance()->unload(this->windBuffer); 86 84 } 87 85 … … 89 87 * @brief initalizes the rain effect with default values 90 88 */ 91 void RainEffect::init() 92 { 93 //Default values94 this->rainActivate = false;95 this->rainMove = false;96 this->rainCoord = Vector(500, 500, 500); 97 this->rainSize = Vector2D(1000, 1000);98 this->rainRate = 4000;99 this->rainVelocity = -300;100 this->rainLife = 4;101 this->rainWindForce =0;102 this->rainFadeInDuration = 0;103 this->rainFadeOutDuration= 0;104 105 this->cloudColor = Vector(0.8f, 0.8f, 0.8f);106 this->skyColor = Vector(0.0f, 0.0f, 0.0f); 107 108 this->rainMaxParticles = this->rainRate * this->rainLife;109 this->localTimer = 0; 110 this->soundRainVolume = 0.3f;111 this->emitter = new PlaneEmitter(this->rainSize);112 113 lightMan = LightManager::getInstance();114 this->rainAmbient = lightMan->getAmbientColor(); 89 void RainEffect::init() { 90 //Default values 91 this->rainActivate = false; 92 this->rainFadeInActivate = false; 93 this->rainFadeOutActivate = false; 94 95 this->rainMove = false; 96 this->rainCoord = Vector(500, 500, 500); 97 this->rainSize = Vector2D(1000, 1000); 98 this->rainRate = 4000; 99 this->rainVelocity = -300; 100 this->rainLife = 4; 101 this->rainWindForce = 0; 102 this->rainFadeInDuration = 10; 103 this->rainFadeOutDuration = 10; 104 105 this->cloudColor = Vector(0.6f, 0.6f, 0.6f); 106 this->skyColor = Vector(0.0f, 0.0f, 0.0f); 107 108 this->rainMaxParticles = this->rainRate * this->rainLife; 109 this->localTimer = 0; 110 this->soundRainVolume = 0.3f; 111 this->emitter = new PlaneEmitter(this->rainSize); 112 115 113 } 116 114 … … 119 117 * @param root: the XML-Element to load the data from 120 118 */ 121 void RainEffect::loadParams(const TiXmlElement* root) 122 { 123 WeatherEffect::loadParams(root); 124 125 LoadParam(root, "coord", this, RainEffect, setRainCoord); 126 LoadParam(root, "size", this, RainEffect, setRainSize); 127 LoadParam(root, "rate", this, RainEffect, setRainRate); 128 LoadParam(root, "velocity", this, RainEffect, setRainVelocity); 129 LoadParam(root, "life", this, RainEffect, setRainLife); 130 LoadParam(root, "wind", this, RainEffect, setRainWind); 131 LoadParam(root, "fadeinduration", this, RainEffect, setRainFadeIn); 132 LoadParam(root, "fadeoutduration", this, RainEffect, setRainFadeOut); 133 LoadParam(root, "cloudcolor", this, RainEffect, setCloudColor); 134 LoadParam(root, "skycolor", this, RainEffect, setSkyColor); 135 136 LOAD_PARAM_START_CYCLE(root, element); 137 { 138 LoadParam_CYCLE(element, "option", this, RainEffect, setRainOption); 139 } 140 LOAD_PARAM_END_CYCLE(element); 119 void RainEffect::loadParams(const TiXmlElement* root) { 120 WeatherEffect::loadParams(root); 121 122 LoadParam(root, "coord", this, RainEffect, setRainCoord); 123 LoadParam(root, "size", this, RainEffect, setRainSize); 124 LoadParam(root, "rate", this, RainEffect, setRainRate); 125 LoadParam(root, "velocity", this, RainEffect, setRainVelocity); 126 LoadParam(root, "life", this, RainEffect, setRainLife); 127 LoadParam(root, "wind", this, RainEffect, setRainWind); 128 LoadParam(root, "fadeinduration", this, RainEffect, setRainFadeIn); 129 LoadParam(root, "fadeoutduration", this, RainEffect, setRainFadeOut); 130 LoadParam(root, "cloudcolor", this, RainEffect, setCloudColor); 131 LoadParam(root, "skycolor", this, RainEffect, setSkyColor); 132 133 LOAD_PARAM_START_CYCLE(root, element); 134 { 135 LoadParam_CYCLE(element, "option", this, RainEffect, setRainOption); 136 } 137 LOAD_PARAM_END_CYCLE(element); 141 138 } 142 139 … … 146 143 * @brief activates the rain effect 147 144 */ 148 void RainEffect::activate() 149 { 150 PRINTF(0)( "Activating RainEffect, coord: %f, %f, %f, size: %f, %f, rate: %f, velocity: %f, moveRain: %s\n", this->rainCoord.x, this->rainCoord.y, this->rainCoord.z, this->rainSize.x, this-> rainSize.y, this->rainRate, this->rainVelocity, this->rainMove ? "true" : "false" ); 151 152 this->rainActivate = true; 153 154 if (unlikely(RainEffect::rainParticles == NULL)) 155 { 156 RainEffect::rainParticles = new SparkParticles((int) this->rainMaxParticles); 157 RainEffect::rainParticles->setName("RainParticles"); 158 RainEffect::rainParticles->setLifeSpan(this->rainLife, 2); 159 RainEffect::rainParticles->setRadius(0, 0.03); 160 RainEffect::rainParticles->setRadius(0.2, 0.02); 161 RainEffect::rainParticles->setRadius(1, 0.01); 162 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2); // grey blue 1 163 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2); // grey blue 2 164 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2); // light grey 165 } 166 167 this->emitter->setSystem(RainEffect::rainParticles); 168 169 this->emitter->setRelCoor(this->rainCoord); 170 171 this->emitter->setEmissionRate(this->rainRate); 172 this->emitter->setEmissionVelocity(this->rainVelocity); 173 174 this->emitter->setSpread(this->rainWindForce / 50, 0.2); 175 176 // plays the rain sound and loops it 177 this->soundSource.play(this->rainBuffer, this->soundRainVolume, true); 178 179 // if there is wind, play the wind sound 180 if (this->rainWindForce != 0) 181 this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true); 182 183 if (this->rainFadeInDuration == 0) 184 lightMan->setAmbientColor(.1,.1,.1); 185 186 // Change the cloudcolor,skycolor 187 this->oldCloudColor = CloudEffect::cloudColor; 188 this->oldSkyColor = CloudEffect::skyColor; 189 CloudEffect::changeCloudColor(this->cloudColor); 190 CloudEffect::changeSkyColor(this->skyColor); 145 void RainEffect::activate() { 146 PRINTF(3)( "Activating RainEffect, coord: %f, %f, %f, size: %f, %f, rate: %f, velocity: %f, moveRain: %s\n", this->rainCoord.x, this->rainCoord.y, this->rainCoord.z, this->rainSize.x, this-> rainSize.y, this->rainRate, this->rainVelocity, this->rainMove ? "true" : "false" ); 147 148 this->rainActivate = true; 149 150 if (unlikely(RainEffect::rainParticles == NULL)) { 151 RainEffect::rainParticles = new SparkParticles((int) this->rainMaxParticles); 152 RainEffect::rainParticles->setName("RainParticles"); 153 RainEffect::rainParticles->setLifeSpan(this->rainLife, 2); 154 RainEffect::rainParticles->setRadius(0, 0.03); 155 RainEffect::rainParticles->setRadius(0.2, 0.02); 156 RainEffect::rainParticles->setRadius(1, 0.01); 157 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2); // grey blue 1 158 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2); // grey blue 2 159 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2); // light grey 160 } 161 162 this->emitter->setSystem(RainEffect::rainParticles); 163 this->emitter->setRelCoor(this->rainCoord); 164 this->emitter->setEmissionRate(this->rainRate); 165 this->emitter->setEmissionVelocity(this->rainVelocity); 166 this->emitter->setSpread(this->rainWindForce / 50, 0.2); 167 168 // play rain sound and loop it 169 this->soundSource.play(this->rainBuffer, this->soundRainVolume, true); 170 171 // if there's wind, play wind sound 172 if (this->rainWindForce > 0) 173 this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true); 174 175 // Store cloud- and sky color before the rain; 176 this->oldCloudColor = CloudEffect::cloudColor; 177 this->oldSkyColor = CloudEffect::skyColor; 178 179 // If we're not fading, change color immediately 180 if (!this->rainFadeInActivate || !this->rainFadeOutActivate) { 181 CloudEffect::changeCloudColor(this->cloudColor, 0); 182 CloudEffect::changeSkyColor(this->skyColor, 0); 183 } 191 184 } 192 185 … … 194 187 * @brief deactivates the rain effect 195 188 */ 196 void RainEffect::deactivate() 197 { 198 PRINTF(0)("Deactivating RainEffect\n"); 199 200 this->rainActivate = false;201 this->emitter->setSystem(NULL);202 203 // Stop Sound204 this->soundSource.stop(); 205 206 // Restore Light Ambient207 lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient); 208 209 CloudEffect::changeCloudColor(this->oldCloudColor);210 CloudEffect::changeSkyColor(this->oldSkyColor);189 void RainEffect::deactivate() { 190 PRINTF(3)("Deactivating RainEffect\n"); 191 192 this->rainActivate = false; 193 this->rainFadeInActivate = false; 194 this->rainFadeOutActivate = false; 195 196 this->emitter->setSystem(NULL); 197 198 // Stop Sound 199 this->soundSource.stop(); 200 201 // Restore the old cloud- and sky color 202 CloudEffect::changeCloudColor(this->oldCloudColor, 0); 203 CloudEffect::changeSkyColor(this->oldSkyColor, 0); 211 204 } 212 205 … … 215 208 * @param dt: tick float 216 209 */ 217 void RainEffect::tick (float dt) 218 { 219 if (!this->rainActivate) 220 return; 221 222 if (this->rainMove) 223 { 224 this->rainCoord = State::getCameraNode()->getAbsCoor(); 225 this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z); 226 } 227 228 if (this->rainFadeInDuration != 0 && this->localTimer < this->rainFadeInDuration) 229 { 230 this->localTimer += dt; 231 float progress = this->localTimer / this->rainFadeInDuration; 232 233 // Dim Light 234 lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9); 235 236 // use alpha in color to fade in 237 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1 238 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2 239 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey 240 241 // increase radius for more "heavy" rain 242 RainEffect::rainParticles->setRadius(0, 0.03 * progress); 243 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress); 244 RainEffect::rainParticles->setRadius(1, 0.01 * progress); 245 246 // increase sound volume 247 if (!this->soundSource.isPlaying()) 248 this->soundSource.play(this->rainBuffer, this->soundRainVolume, true); 249 250 this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress); 251 } 252 else if ( this->rainFadeOutDuration != 0 ) 253 { 254 if ( this->localTimer < this->rainFadeOutDuration ) 255 { 256 this->localTimer += dt; 257 float progress = 1 - (this->localTimer / this->rainFadeOutDuration); 258 259 // Fade In Light 260 lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9); 261 262 // use alpha in color to fade out 263 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1 264 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2 265 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey 266 267 // decrease radius 268 RainEffect::rainParticles->setRadius(0, 0.03 * progress); 269 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress); 270 RainEffect::rainParticles->setRadius(1, 0.01 * progress); 271 272 // decrease sound volume 273 if (!this->soundSource.isPlaying()) 274 this->soundSource.play(this->rainBuffer, this->soundRainVolume, true); 275 276 this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress); 277 } 278 else 279 this->deactivate(); 280 } 210 void RainEffect::tick (float dt) { 211 if (!this->rainActivate) 212 return; 213 214 if (this->rainMove) { 215 this->rainCoord = State::getCameraNode()->getAbsCoor(); 216 this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z); 217 } 218 219 if (this->rainFadeInActivate) { 220 PRINTF(4)("tick fading IN RainEffect\n"); 221 222 this->localTimer += dt; 223 float progress = this->localTimer / this->rainFadeInDuration; 224 225 // use alpha in color to fade in rain 226 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1 227 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2 228 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey 229 230 // increase radius for more "heavy" rain 231 RainEffect::rainParticles->setRadius(0, 0.03 * progress); 232 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress); 233 RainEffect::rainParticles->setRadius(1, 0.01 * progress); 234 235 // increase sound volume 236 if (!this->soundSource.isPlaying()) 237 this->soundSource.play(this->rainBuffer, this->soundRainVolume, true); 238 this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress); 239 240 if (progress >= 1) 241 this->rainFadeInActivate = false; 242 } 243 244 if (this->rainFadeOutActivate) { 245 PRINTF(4)("tick fading OUT RainEffect\n"); 246 247 this->localTimer += dt; 248 float progress = 1 - (this->localTimer / this->rainFadeOutDuration); 249 250 // use alpha in color to fade out 251 RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1 252 RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2 253 RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey 254 255 // decrease radius 256 RainEffect::rainParticles->setRadius(0, 0.03 * progress); 257 RainEffect::rainParticles->setRadius(0.2, 0.02 * progress); 258 RainEffect::rainParticles->setRadius(1, 0.01 * progress); 259 260 // decrease sound volume 261 if (!this->soundSource.isPlaying()) 262 this->soundSource.play(this->rainBuffer, this->soundRainVolume, true); 263 this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress); 264 265 if (progress <= 0) { 266 PRINTF(4)("tick fading OUT RainEffect COMPLETED! Deactivating...\n"); 267 this->rainFadeOutActivate = false; 268 this->deactivate(); 269 } 270 } 281 271 } 282 272 … … 284 274 * @brief starts raining slowly 285 275 */ 286 void RainEffect::startRaining() 287 { 288 289 if (this->rainActivate) 290 this->deactivate(); 291 292 if (!this->rainFadeInDuration > 0) 293 this->rainFadeInDuration = 20; 294 295 this->localTimer = 0; 296 297 this->activate(); 276 void RainEffect::startRaining() { 277 PRINTF(4)("startRaining function;\n"); 278 279 // If it is already raining, do nothing 280 if (this->rainActivate) 281 return; 282 283 this->localTimer = 0; 284 this->rainFadeInActivate = true; 285 286 PRINTF(4)("startRaining function complete; fadedur: %f\n", this->rainFadeInDuration); 287 this->activate(); 288 289 CloudEffect::changeCloudColor(this->cloudColor, this->rainFadeInDuration); 290 CloudEffect::changeSkyColor(this->skyColor, this->rainFadeInDuration); 298 291 } 299 292 … … 301 294 * @brief stops raining slowly 302 295 */ 303 void RainEffect::stopRaining() 304 { 305 306 if (!this->rainActivate) 307 this->activate(); 308 309 if (!this->rainFadeOutDuration > 0) 310 this->rainFadeOutDuration = 20; 311 312 this->localTimer = 0; 296 void RainEffect::stopRaining() { 297 PRINTF(4)("stopRaining function;\n"); 298 299 // If it is not raining, do nothing 300 if (!this->rainActivate) 301 return; 302 303 this->localTimer = 0; 304 this->rainFadeOutActivate = true; 305 306 PRINTF(4)("stopRaining function completed; fadedur: %f\n", this->rainFadeOutDuration); 307 308 CloudEffect::changeCloudColor(this->oldCloudColor, this->rainFadeOutDuration); 309 CloudEffect::changeSkyColor(this->oldSkyColor, this->rainFadeOutDuration); 313 310 } 314 311 … … 316 313 * @brief hides the rain 317 314 */ 318 void RainEffect::hideRain() 319 { 320 RainEffect::rainParticles->setColor(0, 0,0,0, 0); 321 RainEffect::rainParticles->setColor(0, 0,0,0, 0); 322 } 315 void RainEffect::hideRain() { 316 RainEffect::rainParticles->setColor(0, 0,0,0, 0); 317 RainEffect::rainParticles->setColor(0, 0,0,0, 0); 318 } -
trunk/src/lib/graphics/effects/rain_effect.h
r8793 r9006 86 86 this->rainFadeOutDuration = fadeout; 87 87 } 88 88 89 89 inline void setCloudColor(float colorX, float colorY, float colorZ) 90 90 { … … 113 113 GLfloat rainFadeInDuration; 114 114 GLfloat rainFadeOutDuration; 115 bool rainFadeInActivate; 116 bool rainFadeOutActivate; 115 117 116 118 Vector rainCoord; … … 130 132 float soundRainVolume; 131 133 132 LightManager* lightMan;133 GLfloat rainAmbient;134 135 134 Vector oldSkyColor; 136 135 Vector oldCloudColor; -
trunk/src/lib/graphics/effects/snow_effect.cc
r8793 r9006 117 117 void SnowEffect::activate() 118 118 { 119 PRINTF( 0)("Activating SnowEffect\n");119 PRINTF(3)("Activating SnowEffect\n"); 120 120 121 121 this->snowActivate = true; … … 149 149 void SnowEffect::deactivate() 150 150 { 151 PRINTF( 0)("Deactivating SnowEffect\n");151 PRINTF(3)("Deactivating SnowEffect\n"); 152 152 153 153 this->snowActivate = false; -
trunk/src/lib/graphics/effects/volfog_effect.cc
r8523 r9006 74 74 75 75 void VolFogEffect::init() { 76 PRINTF( 0)("Initalize VolFogEffect\n");76 PRINTF(3)("Initalize VolFogEffect\n"); 77 77 78 78 // set fog mode … … 108 108 109 109 if (glewInit() == GLEW_OK) 110 PRINTF( 0)("glewInit OK\n");110 PRINTF(4)("glewInit OK\n"); 111 111 else 112 PRINTF( 0)("glewInit failed\n");112 PRINTF(4)("glewInit failed\n"); 113 113 114 114 if (glewGetExtension("GL_EXT_fog_coord")) 115 PRINTF( 0)("GL_EXT_fog_coord extension found\n");115 PRINTF(4)("GL_EXT_fog_coord extension found\n"); 116 116 } 117 117 118 118 119 119 void VolFogEffect::activate() { 120 PRINTF( 0)("Activating VolFogEffect\n");120 PRINTF(3)("Activating VolFogEffect\n"); 121 121 } 122 122 123 123 void VolFogEffect::deactivate() { 124 PRINTF( 0)("Deactivating VolFogEffect\n");124 PRINTF(3)("Deactivating VolFogEffect\n"); 125 125 126 126 glDisable(GL_FOG); -
trunk/src/lib/gui/gl/glgui_handler.cc
r8743 r9006 88 88 void GLGuiHandler::activate() 89 89 { 90 EventHandler::getInstance()->pushState(ES_MENU);90 //EventHandler::getInstance()->pushState(ES_MENU); 91 91 92 92 … … 96 96 void GLGuiHandler::deactivate() 97 97 { 98 EventHandler::getInstance()->popState();98 //EventHandler::getInstance()->popState(); 99 99 100 100 -
trunk/src/lib/util/executor/executor_lua.h
r8894 r9006 44 44 public: 45 45 /** 46 47 46 * @brief Constructor of a ExecutorXML 47 * @param function a Function to call 48 48 */ 49 49 ExecutorLua0(void(T::*function)()) 50 50 : Executor() 51 51 { 52 52 this->functionPointer = function; … … 91 91 public: 92 92 /** 93 94 93 * @brief Constructor of a ExecutorXML 94 * @param function a Function to call 95 95 */ 96 96 ExecutorLua1(void(T::*function)(type0)) 97 98 { 99 this->functionPointer = function; 100 this->functorType = Executor_Objective | Executor_NoLoadString; 101 } 102 103 /** 104 105 106 97 : Executor(ExecutorParamType<type0>()) 98 { 99 this->functionPointer = function; 100 this->functorType = Executor_Objective | Executor_NoLoadString; 101 } 102 103 /** 104 * @brief executes the Command on BaseObject 105 * @param object the BaseObject to execute this Executor on 106 * @param loadString ignored in this case 107 107 */ 108 108 virtual void operator()(BaseObject* object, const SubString& = SubString()) const … … 120 120 121 121 /** 122 122 * @returns a _new_ Copy of this Executor 123 123 */ 124 124 virtual Executor* clone () const … … 140 140 public: 141 141 /** 142 143 142 * @brief Constructor of a ExecutorXML 143 * @param function a Function to call 144 144 */ 145 145 ExecutorLua2(void(T::*function)(type0, type1)) 146 146 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>()) 147 147 { 148 148 this->functionPointer = function; … … 166 166 167 167 (dynamic_cast<T*>(object)->*(functionPointer))( 168 fromLua<type0>(state, 1),169 168 fromLua<type0>(state, 1), 169 fromLua<type1>(state, 2) ); 170 170 } 171 171 … … 217 217 (dynamic_cast<T*>(object)->*(functionPointer))( 218 218 fromLua<type0>(state, 1), 219 220 219 fromLua<type1>(state, 2), 220 fromLua<type2>(state, 3) ); 221 221 } 222 222 … … 268 268 (dynamic_cast<T*>(object)->*(functionPointer))( 269 269 fromLua<type0>(state, 1), 270 271 272 270 fromLua<type1>(state, 2), 271 fromLua<type2>(state, 3), 272 fromLua<type3>(state, 4) ); 273 273 } 274 274 … … 300 300 public: 301 301 /** 302 303 302 * @brief Constructor of a ExecutorXML 303 * @param function a Function to call 304 304 */ 305 305 ExecutorLua0ret(ret (T::*function)()) 306 306 : Executor() 307 307 { 308 308 this->functionPointer = function; … … 329 329 330 330 /** 331 331 * @returns a _new_ Copy of this Executor 332 332 */ 333 333 virtual Executor* clone () const … … 349 349 public: 350 350 /** 351 352 351 * @brief Constructor of a ExecutorXML 352 * @param function a Function to call 353 353 */ 354 354 ExecutorLua1ret(ret (T::*function)(type0)) 355 355 : Executor(ExecutorParamType<type0>()) 356 356 { 357 357 this->functionPointer = function; … … 375 375 376 376 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 377 377 fromLua<type0>(state, 1))); 378 378 } 379 379 … … 397 397 public: 398 398 /** 399 400 399 * @brief Constructor of a ExecutorXML 400 * @param function a Function to call 401 401 */ 402 402 ExecutorLua2ret(ret (T::*function)(type0, type1)) 403 403 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>()) 404 404 { 405 405 this->functionPointer = function; … … 423 423 424 424 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 425 426 425 fromLua<type0>(state, 1), 426 fromLua<type1>(state, 2) )); 427 427 } 428 428 … … 608 608 ExecutorParamType<type2>(), ExecutorParamType<type3>(), 609 609 ExecutorParamType<type4>(), ExecutorParamType<type5>()) 610 {611 this->functionPointer = function;612 this->functorType = Executor_Objective | Executor_NoLoadString;613 }614 615 /** 616 * @brief executes the Command on BaseObject617 * @param object the BaseObject to execute this Executor on618 * @param loadString ignored in this case619 */ 620 virtual void operator()(BaseObject* object, const SubString& = SubString()) const621 {622 PRINTF(1)("no usefull executor\n");623 }624 625 virtual void operator()(BaseObject* object, int& count, void* values) const626 {627 lua_State* state = (lua_State*)values;628 count = 1;629 630 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(631 fromLua<type0>(state, 1),632 fromLua<type1>(state, 2),633 fromLua<type2>(state, 3),634 fromLua<type3>(state, 4),635 fromLua<type4>(state, 5),636 fromLua<type5>(state, 6) ));637 }638 639 /** 640 * @returns a _new_ Copy of this Executor641 */ 642 virtual Executor* clone () const643 {644 return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);645 }610 { 611 this->functionPointer = function; 612 this->functorType = Executor_Objective | Executor_NoLoadString; 613 } 614 615 /** 616 * @brief executes the Command on BaseObject 617 * @param object the BaseObject to execute this Executor on 618 * @param loadString ignored in this case 619 */ 620 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 621 { 622 PRINTF(1)("no usefull executor\n"); 623 } 624 625 virtual void operator()(BaseObject* object, int& count, void* values) const 626 { 627 lua_State* state = (lua_State*)values; 628 count = 1; 629 630 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 631 fromLua<type0>(state, 1), 632 fromLua<type1>(state, 2), 633 fromLua<type2>(state, 3), 634 fromLua<type3>(state, 4), 635 fromLua<type4>(state, 5), 636 fromLua<type5>(state, 6) )); 637 } 638 639 /** 640 * @returns a _new_ Copy of this Executor 641 */ 642 virtual Executor* clone () const 643 { 644 return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer); 645 } 646 646 private: 647 647 ret (T::*functionPointer)(type0, type1, type2, type3, type4, type5); -
trunk/src/world_entities/environments/mapped_water.cc
r8792 r9006 19 19 #include "util/loading/resource_manager.h" 20 20 #include "state.h" 21 #include "t_animation.h" 21 22 #include "math.h" 22 23 #include "glgui.h" 24 #include "shell_command.h" 25 #include "script_class.h" 23 26 24 27 CREATE_FACTORY(MappedWater, CL_MAPPED_WATER); 28 29 SHELL_COMMAND(gui, MappedWater, openGui); 30 SHELL_COMMAND(output, MappedWater, saveParams); 31 32 CREATE_SCRIPTABLE_CLASS(MappedWater, CL_MAPPED_WATER, 33 addMethod("waterUV", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterUV)) 34 ->addMethod("waterFlow", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterFlow)) 35 ->addMethod("shineSize", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineSize)) 36 ->addMethod("shineStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineStrength)) 37 ->addMethod("reflStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeReflStrength)) 38 ->addMethod("refraction", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeRefraction)) 39 ->addMethod("waterHeight", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterHeight)) 40 ->addMethod("waterColor", ExecutorLua4<MappedWater, float, float, float, float>(&MappedWater::fadeWaterColor))); 41 25 42 26 43 /** … … 45 62 /// initialization of the shaders 46 63 this->initShaders(); 47 48 tempcounter = 0; 64 65 /// calculation of the 4 verts of the water quad 66 this->calcVerts(); 67 68 // init gui 69 this->box = NULL; 49 70 } 50 71 … … 58 79 delete color_uni; 59 80 delete light_uni; 60 delete shine_uni; 81 delete shineSize_uni; 82 delete shineStrength_uni; 83 delete reflStrength_uni; 84 delete refr_uni; 61 85 } 62 86 … … 70 94 this->setWaterSize(100, 100); 71 95 this->setWaterUV(9); 72 this->setWaterFlow(0.08 );96 this->setWaterFlow(0.08f); 73 97 this->setLightPos(0, 10, 0); 74 98 this->setWaterAngle(0); 75 99 this->setNormalMapScale(0.25f); 76 100 this->setWaterColor(0.1f, 0.2f, 0.4f); 77 this->setShininess(128); 101 this->setShineSize(128); 102 this->setShineStrength(0.7f); 103 this->setReflStrength(1.0f); 104 this->setRefraction(0.009f); 78 105 79 106 // initialization of the texture coords, speeds etc... … … 84 111 this->move2 = this->move * this->kNormalMapScale; 85 112 86 113 // initalize fading bools 114 this->bFadeWaterHeight = false; 115 this->bFadeWaterUV = false; 116 this->bFadeWaterFlow = false; 117 this->bFadeShineSize = false; 118 this->bFadeShineStrength = false; 119 this->bFadeReflStrength = false; 120 this->bFadeRefraction = false; 121 this->bFadeWaterColor = false; 87 122 } 88 123 … … 104 139 mat.setDiffuseMap(refrTex, 1); 105 140 // load normal map 106 mat.setDiffuseMap("pictures/ normalmap.bmp", GL_TEXTURE_2D, 2);141 mat.setDiffuseMap("pictures/water_normalmap.bmp", GL_TEXTURE_2D, 2); 107 142 // load dudv map 108 mat.setDiffuseMap("pictures/ dudvmap.bmp", GL_TEXTURE_2D, 3);143 mat.setDiffuseMap("pictures/water_dudvmap.bmp", GL_TEXTURE_2D, 3); 109 144 110 145 // sets texture parameters for reflection texture … … 140 175 Shader::Uniform(shader, "dudvMap").set(3); 141 176 // Set the variable "depthMap" to correspond to the fifth texture unit 142 Shader::Uniform(shader, "depthMap").set( 2);177 Shader::Uniform(shader, "depthMap").set(1); 143 178 // Give the variable "waterColor" a blue color 144 179 color_uni = new Shader::Uniform(shader, "waterColor"); … … 148 183 light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f); 149 184 // Set the variable "shine" 150 shine_uni = new Shader::Uniform(shader, "kShine"); 151 shine_uni->set(this->shininess); 185 shineSize_uni = new Shader::Uniform(shader, "kShine"); 186 shineSize_uni->set(this->shineSize); 187 // Set the variable "shineStrength" 188 shineStrength_uni = new Shader::Uniform(shader, "shineStrength"); 189 shineStrength_uni->set(this->shineStrength); 190 // Set the variable "reflStrength" 191 reflStrength_uni = new Shader::Uniform(shader, "reflStrength"); 192 reflStrength_uni->set(this->reflStrength); 193 // Set the variable "refraction" 194 refr_uni = new Shader::Uniform(shader, "kRefraction"); 195 refr_uni->set(this->refraction); 152 196 // uniform for the camera position 153 197 cam_uni = new Shader::Uniform(shader, "cameraPos"); 154 198 155 199 this->shader->deactivateShader(); 200 } 201 202 /** 203 * @brief calculates the 4 verts of the water quad 204 */ 205 void MappedWater::calcVerts() 206 { 207 float deg2radtemp = this->waterAngle / 180 * PI; 208 209 this->waterVerts[2] = this->waterVerts[0] + cos(deg2radtemp) * this->xWidth; 210 this->waterVerts[3] = this->waterVerts[1] + sin(deg2radtemp) * this->xWidth; 211 this->waterVerts[4] = this->waterVerts[0] + cos(deg2radtemp) * this->xWidth - sin(deg2radtemp) * this->zWidth; 212 this->waterVerts[5] = this->waterVerts[1] + sin(deg2radtemp) * this->xWidth + cos(deg2radtemp) * this->zWidth; 213 this->waterVerts[6] = this->waterVerts[0] - sin(deg2radtemp) * this->zWidth; 214 this->waterVerts[7] = this->waterVerts[1] + cos(deg2radtemp) * this->zWidth; 156 215 } 157 216 … … 171 230 172 231 this->shader->deactivateShader(); 173 } ;232 } 174 233 175 234 /** … … 177 236 * @param shine new value for the shininess 178 237 */ 179 void MappedWater::resetShin iness(float shine)238 void MappedWater::resetShineSize(float shine) 180 239 { 181 240 this->shader->activateShader(); 182 this->shin iness= shine;241 this->shineSize = shine; 183 242 184 243 // Set the variable "shine" 185 shine _uni->set(this->shininess);244 shineSize_uni->set(this->shineSize); 186 245 187 246 this->shader->deactivateShader(); 188 }; 247 } 248 249 /** 250 * @brief resets the strength of the specular reflection in the Shader 251 * @param strength new value for the strength of the specular reflection 252 */ 253 void MappedWater::resetShineStrength(float strength) 254 { 255 this->shader->activateShader(); 256 this->shineStrength = strength; 257 258 // Set the variable "shine" 259 shineStrength_uni->set(this->shineStrength); 260 261 this->shader->deactivateShader(); 262 } 263 264 /** 265 * @brief resets the strength of the reflection in the Shader 266 * @param strength new value for the strength of the reflection 267 */ 268 void MappedWater::resetReflStrength(float strength) 269 { 270 this->shader->activateShader(); 271 this->reflStrength = strength; 272 273 // Set the variable "shine" 274 reflStrength_uni->set(this->reflStrength); 275 276 this->shader->deactivateShader(); 277 } 278 279 /** 280 * @brief resets the refraction in the Shader 281 * @param refraction new value for the refraction 282 */ 283 void MappedWater::resetRefraction(float refraction) 284 { 285 this->shader->activateShader(); 286 this->refraction = refraction; 287 288 // Set the variable "shine" 289 refr_uni->set(this->refraction); 290 291 this->shader->deactivateShader(); 292 } 189 293 190 294 /** … … 203 307 204 308 this->shader->deactivateShader(); 205 } ;309 } 206 310 207 311 /** … … 215 319 LoadParam(root, "waterpos", this, MappedWater, setWaterPos); 216 320 LoadParam(root, "watersize", this, MappedWater, setWaterSize); 217 LoadParam(root, "lightpos", this, MappedWater, setLightPos);218 321 LoadParam(root, "wateruv", this, MappedWater, setWaterUV); 219 322 LoadParam(root, "waterflow", this, MappedWater, setWaterFlow); 323 LoadParam(root, "lightpos", this, MappedWater, setLightPos); 324 LoadParam(root, "waterangle", this, MappedWater, setWaterAngle); 220 325 LoadParam(root, "normalmapscale", this, MappedWater, setNormalMapScale); 221 LoadParam(root, "waterangle", this, MappedWater, setWaterAngle); 326 LoadParam(root, "shinesize", this, MappedWater, setShineSize); 327 LoadParam(root, "shinestrength", this, MappedWater, setShineStrength); 328 LoadParam(root, "reflstrength", this, MappedWater, setReflStrength); 329 LoadParam(root, "refraction", this, MappedWater, setRefraction); 222 330 LoadParam(root, "watercolor", this, MappedWater, setWaterColor); 223 LoadParam(root, "shininess", this, MappedWater, setShininess); 331 } 332 333 /** 334 * @brief prints the xml code of the water params 335 */ 336 void MappedWater::saveParams() 337 { 338 // it's not too nice, but it works fine 339 PRINTF(0)("\nMappedWater XML Code:\n<MappedWater>\n <waterpos>%f, %f, %f</waterpos>\n <watersize>%f, %f</watersize>\n <wateruv>%f</wateruv>\n <waterflow>%f</waterflow>\n <lightpos>%f, %f, %f</lightpos>\n <waterangle>%f</waterangle>\n <normalmapscale>%f</normalmapscale>\n <shinesize>%f</waterpos>\n <shinestrength>%f</shinestrength>\n <reflstrength>%f</reflstrength>\n <refraction>%f</refraction>\n <watercolor>%f, %f, %f</watercolor>\n</MappedWater>\n", this->waterVerts[0], this->waterHeight, this->waterVerts[1], this->xWidth, this->zWidth, this->waterUV, this->waterFlow, this->lightPos.x, this->lightPos.y, this->lightPos.z, this->waterAngle, this->kNormalMapScale, this->shineSize, this->shineStrength, this->reflStrength, this->refraction, this->waterColor.x, this->waterColor.y, this->waterColor.z); 340 } 341 342 /** 343 * @brief starts the slider gui that lets you edit all water parameters 344 */ 345 void MappedWater::openGui() 346 { 347 if (this->box == NULL) 348 { 349 this->box = new OrxGui::GLGuiBox(OrxGui::Vertical); 350 { 351 OrxGui::GLGuiBox* waterColorBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 352 { 353 OrxGui::GLGuiInputLine* waterColorText = new OrxGui::GLGuiInputLine(); 354 waterColorText->setText("WaterColor"); 355 waterColorBox->pack(waterColorText); 356 357 OrxGui::GLGuiSlider* waterColorR = new OrxGui::GLGuiSlider(); 358 waterColorR->setRange(0, 1.0f); 359 waterColorR->setValue(this->waterColor.x); 360 waterColorR->setStep(0.1f); 361 waterColorR->connect(SIGNAL(waterColorR, valueChanged), this, SLOT(MappedWater, resetWaterColorR)); 362 waterColorBox->pack(waterColorR); 363 364 OrxGui::GLGuiSlider* waterColorG = new OrxGui::GLGuiSlider(); 365 waterColorG->setRange(0, 1.0f); 366 waterColorG->setStep(0.1f); 367 waterColorG->setValue(this->waterColor.y); 368 waterColorG->connect(SIGNAL(waterColorG, valueChanged), this, SLOT(MappedWater, resetWaterColorG)); 369 waterColorBox->pack(waterColorG); 370 371 OrxGui::GLGuiSlider* waterColorB = new OrxGui::GLGuiSlider(); 372 waterColorB->setRange(0, 1.0f); 373 waterColorB->setStep(0.1f); 374 waterColorB->setValue(this->waterColor.z); 375 waterColorB->connect(SIGNAL(waterColorB, valueChanged), this, SLOT(MappedWater, resetWaterColorB)); 376 waterColorBox->pack(waterColorB); 377 } 378 this->box->pack(waterColorBox); 379 380 OrxGui::GLGuiBox* waterUVBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 381 { 382 OrxGui::GLGuiInputLine* waterUVText = new OrxGui::GLGuiInputLine(); 383 waterUVText->setText("WaterUV"); 384 waterUVBox->pack(waterUVText); 385 386 OrxGui::GLGuiSlider* waterUV = new OrxGui::GLGuiSlider(); 387 waterUV->setRange(1, 20); 388 waterUV->setValue(this->waterUV); 389 waterUV->setStep(1); 390 waterUV->connect(SIGNAL(waterUV, valueChanged), this, SLOT(MappedWater, setWaterUV)); 391 waterUVBox->pack(waterUV); 392 } 393 this->box->pack(waterUVBox); 394 395 OrxGui::GLGuiBox* waterFlowBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 396 { 397 OrxGui::GLGuiInputLine* waterFlowText = new OrxGui::GLGuiInputLine(); 398 waterFlowText->setText("WaterFlow"); 399 waterFlowBox->pack(waterFlowText); 400 401 OrxGui::GLGuiSlider* waterFlow = new OrxGui::GLGuiSlider(); 402 waterFlow->setRange(0.01f, 2); 403 waterFlow->setValue(this->waterFlow); 404 waterFlow->setStep(0.02f); 405 waterFlow->connect(SIGNAL(waterFlow, valueChanged), this, SLOT(MappedWater, setWaterFlow)); 406 waterFlowBox->pack(waterFlow); 407 } 408 this->box->pack(waterFlowBox); 409 410 OrxGui::GLGuiBox* shineSizeBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 411 { 412 OrxGui::GLGuiInputLine* shineSizeText = new OrxGui::GLGuiInputLine(); 413 shineSizeText->setText("ShineSize"); 414 shineSizeBox->pack(shineSizeText); 415 416 OrxGui::GLGuiSlider* shineSize = new OrxGui::GLGuiSlider(); 417 shineSize->setRange(1, 128); 418 shineSize->setValue(this->shineSize); 419 shineSize->setStep(1); 420 shineSize->connect(SIGNAL(shineSize, valueChanged), this, SLOT(MappedWater, resetShineSize)); 421 shineSizeBox->pack(shineSize); 422 } 423 this->box->pack(shineSizeBox); 424 425 OrxGui::GLGuiBox* shineStrengthBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 426 { 427 OrxGui::GLGuiInputLine* shineStrengthText = new OrxGui::GLGuiInputLine(); 428 shineStrengthText->setText("ShineStrength"); 429 shineStrengthBox->pack(shineStrengthText); 430 431 OrxGui::GLGuiSlider* shineStrength = new OrxGui::GLGuiSlider(); 432 shineStrength->setRange(0, 1); 433 shineStrength->setValue(this->shineStrength); 434 shineStrength->setStep(0.1f); 435 shineStrength->connect(SIGNAL(shineStrength, valueChanged), this, SLOT(MappedWater, resetShineStrength)); 436 shineStrengthBox->pack(shineStrength); 437 } 438 this->box->pack(shineStrengthBox); 439 440 OrxGui::GLGuiBox* reflStrengthBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 441 { 442 OrxGui::GLGuiInputLine* reflStrengthText = new OrxGui::GLGuiInputLine(); 443 reflStrengthText->setText("ReflStrength"); 444 reflStrengthBox->pack(reflStrengthText); 445 446 OrxGui::GLGuiSlider* reflStrength = new OrxGui::GLGuiSlider(); 447 reflStrength->setRange(0, 1); 448 reflStrength->setValue(this->reflStrength); 449 reflStrength->setStep(0.1f); 450 reflStrength->connect(SIGNAL(reflStrength, valueChanged), this, SLOT(MappedWater, resetReflStrength)); 451 reflStrengthBox->pack(reflStrength); 452 } 453 this->box->pack(reflStrengthBox); 454 455 OrxGui::GLGuiBox* refractionBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 456 { 457 OrxGui::GLGuiInputLine* refractionText = new OrxGui::GLGuiInputLine(); 458 refractionText->setText("Refraction"); 459 refractionBox->pack(refractionText); 460 461 OrxGui::GLGuiSlider* refraction = new OrxGui::GLGuiSlider(); 462 refraction->setRange(0.001f, 0.1f); 463 refraction->setValue(this->refraction); 464 refraction->setStep(0.004f); 465 refraction->connect(SIGNAL(refraction, valueChanged), this, SLOT(MappedWater, resetRefraction)); 466 refractionBox->pack(refraction); 467 } 468 this->box->pack(refractionBox); 469 470 OrxGui::GLGuiBox* lightPosBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 471 { 472 OrxGui::GLGuiInputLine* lightPosText = new OrxGui::GLGuiInputLine(); 473 lightPosText->setText("LightPos"); 474 lightPosBox->pack(lightPosText); 475 476 OrxGui::GLGuiSlider* lightPosX = new OrxGui::GLGuiSlider(); 477 lightPosX->setRange(-600, 600); 478 lightPosX->setValue(this->lightPos.x); 479 lightPosX->setStep(15); 480 lightPosX->connect(SIGNAL(lightPosX, valueChanged), this, SLOT(MappedWater, resetLightPosX)); 481 lightPosBox->pack(lightPosX); 482 483 OrxGui::GLGuiSlider* lightPosY = new OrxGui::GLGuiSlider(); 484 lightPosY->setRange(-600, 600); 485 lightPosY->setStep(15); 486 lightPosY->setValue(this->lightPos.y); 487 lightPosY->connect(SIGNAL(lightPosY, valueChanged), this, SLOT(MappedWater, resetLightPosY)); 488 lightPosBox->pack(lightPosY); 489 490 OrxGui::GLGuiSlider* lightPosZ = new OrxGui::GLGuiSlider(); 491 lightPosZ->setRange(-600, 600); 492 lightPosZ->setStep(15); 493 lightPosZ->setValue(this->lightPos.z); 494 lightPosZ->connect(SIGNAL(lightPosZ, valueChanged), this, SLOT(MappedWater, resetLightPosZ)); 495 lightPosBox->pack(lightPosZ); 496 } 497 this->box->pack(lightPosBox); 498 499 OrxGui::GLGuiBox* waterHeightBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 500 { 501 OrxGui::GLGuiInputLine* waterHeightText = new OrxGui::GLGuiInputLine(); 502 waterHeightText->setText("WaterHeight"); 503 waterHeightBox->pack(waterHeightText); 504 505 OrxGui::GLGuiSlider* waterHeight = new OrxGui::GLGuiSlider(); 506 waterHeight->setRange(-500, 500); 507 waterHeight->setValue(this->waterHeight); 508 waterHeight->setStep(10); 509 waterHeight->connect(SIGNAL(waterHeight, valueChanged), this, SLOT(MappedWater, setWaterHeight)); 510 waterHeightBox->pack(waterHeight); 511 } 512 this->box->pack(waterHeightBox); 513 } 514 515 this->box->showAll(); 516 this->box->setAbsCoor2D(300, 40); 517 OrxGui::GLGuiHandler::getInstance()->activate(); 518 OrxGui::GLGuiHandler::getInstance()->activateCursor(); 519 } 520 } 521 522 /** 523 * @brief closes the water gui 524 */ 525 void MappedWater::closeGui() 526 { 527 delete this->box; 528 this->box = NULL; 224 529 } 225 530 … … 230 535 { 231 536 glMatrixMode(GL_MODELVIEW); 232 233 537 glPushMatrix(); 234 // don't use a glTranslate here, the reflection point won't be at the right place anymore 235 glRotatef(this->waterAngle, 0, 1, 0);538 539 // don't use glRotate or glTranslate here... the shader won't work anymore 236 540 237 541 mat.select(); … … 247 551 glBegin(GL_QUADS); 248 552 // The back left vertice for the water 249 glMultiTexCoord2f(GL_TEXTURE0, 0, waterUV); // Reflection texture250 glMultiTexCoord2f(GL_TEXTURE1, 0, waterUV - move); // Refraction texture251 glMultiTexCoord2f(GL_TEXTURE2, 0, normalUV + move2); // Normal map texture252 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture253 glVertex3f(this->water Pos.x, this->waterPos.y, this->waterPos.z);553 glMultiTexCoord2f(GL_TEXTURE0, 0, waterUV); // Reflection texture 554 glMultiTexCoord2f(GL_TEXTURE1, 0, waterUV - move); // Refraction texture 555 glMultiTexCoord2f(GL_TEXTURE2, 0, normalUV + move2); // Normal map texture 556 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture 557 glVertex3f(this->waterVerts[0], this->waterHeight, this->waterVerts[1]); 254 558 255 559 // The front left vertice for the water 256 glMultiTexCoord2f(GL_TEXTURE0, 0, 0); // Reflection texture257 glMultiTexCoord2f(GL_TEXTURE1, 0, -move); // Refraction texture258 glMultiTexCoord2f(GL_TEXTURE2, 0, move2); // Normal map texture259 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture260 glVertex3f(this->water Pos.x, this->waterPos.y, this->waterPos.z + this->zWidth);560 glMultiTexCoord2f(GL_TEXTURE0, 0, 0); // Reflection texture 561 glMultiTexCoord2f(GL_TEXTURE1, 0, -move); // Refraction texture 562 glMultiTexCoord2f(GL_TEXTURE2, 0, move2); // Normal map texture 563 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture 564 glVertex3f(this->waterVerts[2], this->waterHeight, this->waterVerts[3]); 261 565 262 566 // The front right vertice for the water 263 glMultiTexCoord2f(GL_TEXTURE0, waterUV, 0); // Reflection texture264 glMultiTexCoord2f(GL_TEXTURE1, waterUV, -move); // Refraction texture265 glMultiTexCoord2f(GL_TEXTURE2, normalUV, move2); // Normal map texture266 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture267 glVertex3f(this->water Pos.x + this->xWidth, this->waterPos.y, this->waterPos.z + this->zWidth);567 glMultiTexCoord2f(GL_TEXTURE0, waterUV, 0); // Reflection texture 568 glMultiTexCoord2f(GL_TEXTURE1, waterUV, -move); // Refraction texture 569 glMultiTexCoord2f(GL_TEXTURE2, normalUV, move2); // Normal map texture 570 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture 571 glVertex3f(this->waterVerts[4], this->waterHeight, this->waterVerts[5]); 268 572 269 573 // The back right vertice for the water 270 glMultiTexCoord2f(GL_TEXTURE0, waterUV, waterUV); // Reflection texture271 glMultiTexCoord2f(GL_TEXTURE1, waterUV, waterUV - move); 272 glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2); // Normal map texture273 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture274 glVertex3f(this->water Pos.x + this->xWidth, this->waterPos.y, this->waterPos.z);574 glMultiTexCoord2f(GL_TEXTURE0, waterUV, waterUV); // Reflection texture 575 glMultiTexCoord2f(GL_TEXTURE1, waterUV, waterUV - move); // Refraction texture 576 glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2); // Normal map texture 577 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture 578 glVertex3f(this->waterVerts[6], this->waterHeight, this->waterVerts[7]); 275 579 glEnd(); 276 580 … … 290 594 this->move += this->waterFlow * dt; 291 595 this->move2 = this->move * this->kNormalMapScale; 292 293 294 // if(this->tempcounter == 200) { 295 // this->resetWaterColor(1, 0, 0); 296 // resetShininess(1); 297 // resetLightPos(0, 50, 0); 298 // PRINTF(0)("test waterchangecolor "); 299 // } 300 // tempcounter++; 301 596 597 // fading TODO fix this so it isnt hacky anymore 598 if(bFadeWaterUV) 599 { 600 this->waterUVFader = new tAnimation<MappedWater>(this, &MappedWater::setWaterUV); 601 this->waterUVFader->setInfinity(ANIM_INF_CONSTANT); 602 603 this->waterUVFader->addKeyFrame(this->waterUV, this->waterUVFadeTime, ANIM_LINEAR); 604 this->waterUVFader->addKeyFrame(this->newWaterUV, 0, ANIM_LINEAR); 605 606 bFadeWaterUV = false; 607 this->waterUVFader->replay(); 608 } 609 610 if(bFadeWaterFlow) 611 { 612 this->waterFlowFader = new tAnimation<MappedWater>(this, &MappedWater::setWaterFlow); 613 this->waterFlowFader->setInfinity(ANIM_INF_CONSTANT); 614 615 this->waterFlowFader->addKeyFrame(this->waterFlow, this->waterFlowFadeTime, ANIM_LINEAR); 616 this->waterFlowFader->addKeyFrame(this->newWaterFlow, 0, ANIM_LINEAR); 617 618 bFadeWaterFlow = false; 619 this->waterFlowFader->replay(); 620 } 621 622 if(bFadeShineSize) 623 { 624 this->shineSizeFader = new tAnimation<MappedWater>(this, &MappedWater::resetShineSize); 625 this->shineSizeFader->setInfinity(ANIM_INF_CONSTANT); 626 627 this->shineSizeFader->addKeyFrame(this->shineSize, this->shineSizeFadeTime, ANIM_LINEAR); 628 this->shineSizeFader->addKeyFrame(this->newShineSize, 0, ANIM_LINEAR); 629 630 bFadeShineSize = false; 631 this->shineSizeFader->replay(); 632 } 633 634 if(bFadeShineStrength) 635 { 636 this->shineStrengthFader = new tAnimation<MappedWater>(this, &MappedWater::resetShineStrength); 637 this->shineStrengthFader->setInfinity(ANIM_INF_CONSTANT); 638 639 this->shineStrengthFader->addKeyFrame(this->shineStrength, this->shineStrengthFadeTime, ANIM_LINEAR); 640 this->shineStrengthFader->addKeyFrame(this->newShineStrength, 0, ANIM_LINEAR); 641 642 bFadeShineStrength = false; 643 this->shineStrengthFader->replay(); 644 } 645 646 if(bFadeReflStrength) 647 { 648 this->reflStrengthFader = new tAnimation<MappedWater>(this, &MappedWater::resetReflStrength); 649 this->reflStrengthFader->setInfinity(ANIM_INF_CONSTANT); 650 651 this->reflStrengthFader->addKeyFrame(this->reflStrength, this->reflStrengthFadeTime, ANIM_LINEAR); 652 this->reflStrengthFader->addKeyFrame(this->newReflStrength, 0, ANIM_LINEAR); 653 654 bFadeReflStrength = false; 655 this->reflStrengthFader->replay(); 656 } 657 658 if(bFadeRefraction) 659 { 660 this->refractionFader = new tAnimation<MappedWater>(this, &MappedWater::resetRefraction); 661 this->refractionFader->setInfinity(ANIM_INF_CONSTANT); 662 663 this->refractionFader->addKeyFrame(this->refraction, this->refractionFadeTime, ANIM_LINEAR); 664 this->refractionFader->addKeyFrame(this->newRefraction, 0, ANIM_LINEAR); 665 666 bFadeRefraction = false; 667 this->refractionFader->replay(); 668 } 669 670 if(bFadeWaterHeight) 671 { 672 this->waterHeightFader = new tAnimation<MappedWater>(this, &MappedWater::setWaterHeight); 673 this->waterHeightFader->setInfinity(ANIM_INF_CONSTANT); 674 675 this->waterHeightFader->addKeyFrame(this->waterHeight, this->waterHeightFadeTime, ANIM_LINEAR); 676 this->waterHeightFader->addKeyFrame(this->newWaterHeight, 0, ANIM_LINEAR); 677 678 bFadeWaterHeight = false; 679 this->waterHeightFader->replay(); 680 } 681 682 if(bFadeWaterColor) 683 { 684 this->waterColorRFader = new tAnimation<MappedWater>(this, &MappedWater::resetWaterColorR); 685 this->waterColorRFader->setInfinity(ANIM_INF_CONSTANT); 686 687 this->waterColorRFader->addKeyFrame(this->waterColor.x, this->waterColorFadeTime, ANIM_LINEAR); 688 this->waterColorRFader->addKeyFrame(this->newWaterColor.x, 0, ANIM_LINEAR); 689 690 this->waterColorRFader->replay(); 691 692 this->waterColorGFader = new tAnimation<MappedWater>(this, &MappedWater::resetWaterColorG); 693 this->waterColorGFader->setInfinity(ANIM_INF_CONSTANT); 694 695 this->waterColorGFader->addKeyFrame(this->waterColor.y, this->waterColorFadeTime, ANIM_LINEAR); 696 this->waterColorGFader->addKeyFrame(this->newWaterColor.y, 0, ANIM_LINEAR); 697 698 this->waterColorGFader->replay(); 699 700 this->waterColorBFader = new tAnimation<MappedWater>(this, &MappedWater::resetWaterColorB); 701 this->waterColorBFader->setInfinity(ANIM_INF_CONSTANT); 702 703 this->waterColorBFader->addKeyFrame(this->waterColor.z, this->waterColorFadeTime, ANIM_LINEAR); 704 this->waterColorBFader->addKeyFrame(this->newWaterColor.z, 0, ANIM_LINEAR); 705 706 this->waterColorBFader->replay(); 707 708 bFadeWaterColor = false; 709 } 302 710 } 303 711 … … 330 738 Vector pos = State::getCameraNode()->getAbsCoor(); 331 739 332 if(pos.y > water Pos.y)740 if(pos.y > waterHeight) 333 741 { 334 742 // Translate the world, then flip it upside down 335 glTranslatef(0, water Pos.y*2, 0);743 glTranslatef(0, waterHeight * 2, 0); 336 744 glScalef(1, -1, 1); 337 745 … … 340 748 341 749 // Set our plane equation and turn clipping on 342 double plane[4] = {0, 1, 0, -water Pos.y};750 double plane[4] = {0, 1, 0, -waterHeight}; 343 751 glClipPlane(GL_CLIP_PLANE0, plane); 344 752 } … … 347 755 // If the camera is below the water we don't want to flip the world, 348 756 // but just render it clipped so only the top is drawn. 349 double plane[4] = {0, 1, 0, water Pos.y};757 double plane[4] = {0, 1, 0, waterHeight}; 350 758 glClipPlane(GL_CLIP_PLANE0, plane); 351 759 } … … 392 800 glEnable(GL_CLIP_PLANE0); 393 801 Vector pos = State::getCameraNode()->getAbsCoor(); 394 if(pos.y > water Pos.y)395 { 396 double plane[4] = {0, -1, 0, water Pos.y};802 if(pos.y > waterHeight) 803 { 804 double plane[4] = {0, -1, 0, waterHeight}; 397 805 glClipPlane(GL_CLIP_PLANE0, plane); 398 806 } … … 401 809 { 402 810 glCullFace(GL_FRONT); 403 double plane[4] = {0, 1, 0, -water Pos.y};811 double plane[4] = {0, 1, 0, -waterHeight}; 404 812 glClipPlane(GL_CLIP_PLANE0, plane); 405 813 } -
trunk/src/world_entities/environments/mapped_water.h
r8792 r9006 1 /*!1 /*! 2 2 * @file mapped_water.h 3 3 * worldentity for flat, cool looking, mapped water … … 12 12 <waterangle>0</waterangle> 13 13 <normalmapscale>0.25</normalmapscale><!-- you won't see a big differnce if you change that --> 14 <shininess>128</shininess><!-- the bigger the value, the smaller the specular reflection point --> 14 <shinesize>128</shinesize><!-- the bigger the value, the smaller the specular reflection point --> 15 <shinestrength>0.7</shinestrength> 16 <reflstrength>1</reflstrength> 17 <refraction>0.009</refraction> 15 18 <watercolor>0.1, 0.2, 0.4</watercolor> 16 19 </MappedWater> … … 25 28 #include "shader.h" 26 29 30 namespace OrxGui { class GLGuiBox; }; 31 32 // forward declaration 33 template <class T> class tAnimation; 27 34 28 35 class MappedWater : public WorldEntity … … 32 39 virtual ~MappedWater(); 33 40 41 // worldentity functions 34 42 void loadParams(const TiXmlElement* root); 35 43 void saveParams(); 36 44 void draw() const; 37 45 void tick(float dt); … … 43 51 void deactivateRefraction(); 44 52 53 // slider gui to edit water params during gameplay 54 void openGui(); 55 void closeGui(); 56 45 57 // functions to set parameters for the water, usually they're called through loadparam 46 void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); }; 47 void setWaterPos(float x, float y, float z) { this->waterPos = Vector(x,y,z); }; 48 void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; }; 49 void setWaterAngle(float angle) { this->waterAngle = angle; }; 50 void setWaterUV(float uv) { this->waterUV = uv; }; 51 void setWaterFlow(float flow) { this->waterFlow = flow; }; 52 void setNormalMapScale(float scale) { this->kNormalMapScale = scale; }; 53 void setShininess(float shine) { this->shininess = shine; }; 54 void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); }; 58 void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); } 59 void setWaterPos(float x, float y, float z) { this->waterHeight = y; this->waterVerts[0] = x; this->waterVerts[1] = z; } 60 void setWaterHeight(float y) { this->waterHeight = y; } 61 void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; } 62 void setWaterAngle(float angle) { this->waterAngle = angle; } 63 void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); } 64 void setWaterUV(float uv) { this->waterUV = uv; } 65 void setWaterFlow(float flow) { this->waterFlow = flow; } 66 void setNormalMapScale(float scale) { this->kNormalMapScale = scale; } 67 void setShineSize(float shine) { this->shineSize = shine; } 68 void setShineStrength(float strength) { this->shineStrength = strength; } 69 void setReflStrength(float strength) { this->reflStrength = strength; } 70 void setRefraction(float refraction) { this->refraction = refraction; } 55 71 56 72 // functions to change water parameters during runtime 57 73 // to reset waterUV and waterFlow just use the normal set functions 74 // don't reset kNormalMapScale (because it won't change anything) 75 void resetLightPos(float x, float y, float z); 76 void resetLightPosX(float x) { this->resetLightPos(x, this->lightPos.y, this->lightPos.z); } 77 void resetLightPosY(float y) { this->resetLightPos(this->lightPos.x, y, this->lightPos.z); } 78 void resetLightPosZ(float z) { this->resetLightPos(this->lightPos.x, this->lightPos.y, z); } 79 void resetWaterPos(float x, float y, float z) { this->setWaterPos(x, y, z); this->calcVerts(); } 80 void resetWaterSize(float x, float z) { this->setWaterSize(x, z); this->calcVerts(); } 81 void resetWaterAngle(float angle) { this->setWaterAngle(angle); this->calcVerts(); } 58 82 void resetWaterColor(float r, float g, float b); 59 void resetShininess(float shine); 60 void resetLightPos(float x, float y, float z); 83 void resetWaterColorR(float r) { this->resetWaterColor(r, this->waterColor.y, this->waterColor.z); } 84 void resetWaterColorG(float g) { this->resetWaterColor(this->waterColor.x, g, this->waterColor.z); } 85 void resetWaterColorB(float b) { this->resetWaterColor(this->waterColor.x, this->waterColor.y, b); } 86 void resetShineSize(float shine); 87 void resetShineStrength(float strength); 88 void resetReflStrength(float strength); 89 void resetRefraction(float refraction); 61 90 62 // fade functions 63 void fadeWaterColor(float r, float g, float b, float time); 64 void fadeShininess(float shine, float time); 65 void fadeLightPos(float x, float y, float z, float time); 91 // fading functions 92 void fadeWaterUV(float uv, float time) { this->newWaterUV = uv; this->waterUVFadeTime = time; this->bFadeWaterUV = true; } 93 void fadeWaterFlow(float flow, float time) { this->newWaterFlow = flow; this->waterFlowFadeTime = time; this->bFadeWaterFlow = true; } 94 void fadeShineSize(float shine, float time) { this->newShineSize = shine; this->shineSizeFadeTime = time; this->bFadeShineSize = true; } 95 void fadeShineStrength(float strength, float time) { this->newShineStrength = strength; this->shineStrengthFadeTime = time; this->bFadeShineStrength = true; } 96 void fadeReflStrength(float strength, float time) { this->newReflStrength = strength; this->reflStrengthFadeTime = time; this->bFadeReflStrength = true; } 97 void fadeRefraction(float refraction, float time) { this->newRefraction = refraction; this->refractionFadeTime = time; this->bFadeRefraction = true; } 98 void fadeWaterHeight(float y, float time) { this->newWaterHeight = y; this->waterHeightFadeTime = time; this->bFadeWaterHeight = true; } 99 void fadeWaterColor(float r, float g, float b, float time) { this->newWaterColor = Vector(r, g, b); this->waterColorFadeTime = time; this->bFadeWaterColor = true; } 66 100 67 101 private: … … 69 103 void initTextures(); 70 104 void initShaders(); 105 void calcVerts(); 71 106 72 107 private: 73 Vector waterPos; //!< position of the water 74 float xWidth, zWidth; //!< size of the water quad 75 Vector lightPos; //!< position of the light that is used to render the reflection 76 float waterAngle; //!< defines how much the water will be turned around the point waterPos 77 Vector waterColor; //!< color of the water 78 float move; //!< textures coords, speeds, positions for the shaded textures.... 79 float move2; 80 float waterUV; //!< size of the waves 81 float waterFlow; //!< speed of the water 82 float normalUV; 83 float kNormalMapScale; 84 float shininess; //!< the bigger the value, the smaller the specular reflection point 108 Material mat; 109 Shader* shader; 110 OrxGui::GLGuiBox* box; 85 111 86 int textureSize; //!< height and width of the texture 87 Material mat; 88 Shader* shader; 89 Shader::Uniform* cam_uni; //!< uniform that is used for the camera position 90 Shader::Uniform* light_uni; //!< uniform that is used for the light position 91 Shader::Uniform* color_uni; //!< uniform that is used for the watercolor 92 Shader::Uniform* shine_uni; //!< uniform that is used for the specular shininessd of the water 93 94 95 int tempcounter; 112 // water size and position 113 float waterHeight; //!< position of the water 114 float waterVerts[8]; //!< coords of the 4 vertexes of the water quad 115 float xWidth, zWidth; //!< size of the water quad 116 float waterAngle; //!< defines how much the water will be turned around the point waterPos 117 118 // values for texture size, scale, texture coords 119 float move; 120 float move2; 121 float waterUV; //!< size of the waves 122 float waterFlow; //!< speed of the water 123 float normalUV; 124 float kNormalMapScale; 125 int textureSize; //!< height and width of the texture 126 127 // values for the uniforms 128 Vector waterColor; //!< color of the water 129 Vector lightPos; //!< position of the light that is used to render the reflection 130 float shineSize; //!< the bigger the value, the smaller the specular reflection point 131 float shineStrength; 132 float reflStrength; 133 float refraction; 134 135 // uniforms 136 Shader::Uniform* cam_uni; //!< uniform that is used for the camera position 137 Shader::Uniform* light_uni; //!< uniform that is used for the light position 138 Shader::Uniform* color_uni; //!< uniform that is used for the watercolor 139 Shader::Uniform* shineSize_uni; //!< uniform that is used for the specular shininessd of the water 140 Shader::Uniform* shineStrength_uni; //!< uniform that is used for the strenght of the specular reflection 141 Shader::Uniform* reflStrength_uni; //!< uniform that is used for the strength of the reflection 142 Shader::Uniform* refr_uni; //!< uniform that is used for the strength of the refraction 143 144 // fading TODO fix this so it isnt so hacky anymore 145 tAnimation<MappedWater>* waterUVFader; 146 float newWaterUV; 147 float waterUVFadeTime; 148 bool bFadeWaterUV ; 149 tAnimation<MappedWater>* waterFlowFader; 150 float newWaterFlow; 151 float waterFlowFadeTime; 152 bool bFadeWaterFlow; 153 tAnimation<MappedWater>* shineSizeFader; 154 float newShineSize; 155 float shineSizeFadeTime; 156 bool bFadeShineSize; 157 tAnimation<MappedWater>* shineStrengthFader; 158 float newShineStrength; 159 float shineStrengthFadeTime; 160 bool bFadeShineStrength; 161 tAnimation<MappedWater>* reflStrengthFader; 162 float newReflStrength; 163 float reflStrengthFadeTime; 164 bool bFadeReflStrength; 165 tAnimation<MappedWater>* refractionFader; 166 float newRefraction; 167 float refractionFadeTime; 168 bool bFadeRefraction; 169 tAnimation<MappedWater>* waterHeightFader; 170 float newWaterHeight; 171 float waterHeightFadeTime; 172 bool bFadeWaterHeight; 173 tAnimation<MappedWater>* waterColorRFader; 174 tAnimation<MappedWater>* waterColorGFader; 175 tAnimation<MappedWater>* waterColorBFader; 176 Vector newWaterColor; 177 float waterColorFadeTime; 178 bool bFadeWaterColor; 96 179 }; 97 180 -
trunk/src/world_entities/script_trigger.cc
r9003 r9006 14 14 */ 15 15 16 16 17 #include "script_trigger.h" 17 18 #include "class_list.h" … … 22 23 23 24 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER, 24 //Position 25 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 26 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 27 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 28 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 29 //Set values 30 // ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setTarget)) 31 // ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setTriggerParent)) 32 ->addMethod("setTriggerLasts", ExecutorLua1<ScriptTrigger, bool >(&ScriptTrigger::setTriggerLasts)) 33 ->addMethod("setInvert", ExecutorLua1<ScriptTrigger, bool >(&ScriptTrigger::setInvert)) 34 ->addMethod("setRadius", ExecutorLua1<ScriptTrigger, float >(&ScriptTrigger::setRadius)) 35 //->addMethod("setScript", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setScript)) 36 //->addMethod("setFunction", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setFunction)) 37 ->addMethod("setDebugDraw", ExecutorLua1<ScriptTrigger, bool >(&ScriptTrigger::setInvert)) 25 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 26 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 27 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 28 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 38 29 ); 39 30 … … 61 52 { 62 53 63 loadParams(root);64 65 if(addToScript && scriptIsOk)66 {67 script->addObject( "ScriptTrigger", this->getName());68 }54 loadParams(root); 55 56 if(addToScript && scriptIsOk) 57 { 58 script->addObject( "ScriptTrigger", this->getName()); 59 } 69 60 70 61 } … … 88 79 { 89 80 90 WorldEntity ::loadParams(root); 91 92 LoadParam(root, "file", this, ScriptTrigger, setScript) 93 .describe("the fileName of the script, that should be triggered by this script trigger") 94 .defaultValues(""); 95 LoadParam(root, "function", this, ScriptTrigger, setFunction) 96 .describe("the function of the script, that should be triggered by this script trigger") 97 .defaultValues(""); 98 LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoor) 99 .describe("where this script trigger should be located") 100 .defaultValues(""); 101 LoadParam(root, "radius", this, ScriptTrigger, setRadius) 102 .describe("the fileName of the script, that should be triggered by this script trigger") 103 .defaultValues(0); 104 LoadParam(root, "worldentity", this, ScriptTrigger, setTarget) 105 .describe("The name of the target as it is in the *.oxw file") 106 .defaultValues(""); 107 LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent) 108 .describe("The name of the parent as it is in the *.oxw file") 109 .defaultValues(""); 110 LoadParam(root, "invert", this, ScriptTrigger, setInvert) 111 .describe("") 112 .defaultValues("false"); 113 LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts) 114 .describe("") 115 .defaultValues("true"); 116 LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw) 117 .describe("") 118 .defaultValues("false"); 119 LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript) 120 .describe("True if this scripttrigger should be aviable in the script") 121 .defaultValues("false"); 81 WorldEntity ::loadParams(root); 82 83 LoadParam(root, "file", this, ScriptTrigger, setScript) 84 .describe("the fileName of the script, that should be triggered by this script trigger") 85 .defaultValues(""); 86 LoadParam(root, "function", this, ScriptTrigger, setFunction) 87 .describe("the function of the script, that should be triggered by this script trigger") 88 .defaultValues(""); 89 LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoor) 90 .describe("where this script trigger should be located") 91 .defaultValues(""); 92 LoadParam(root, "radius", this, ScriptTrigger, setRadius) 93 .describe("the fileName of the script, that should be triggered by this script trigger") 94 .defaultValues(0); 95 LoadParam(root, "delay", this, ScriptTrigger, setDelay) 96 .describe("the delay after which the funtion sould be triggered") 97 .defaultValues(0); 98 LoadParam(root, "worldentity", this, ScriptTrigger, setTarget) 99 .describe("The name of the target as it is in the *.oxw file") 100 .defaultValues(""); 101 LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent) 102 .describe("The name of the parent as it is in the *.oxw file") 103 .defaultValues(""); 104 LoadParam(root, "invert", this, ScriptTrigger, setInvert) 105 .describe("") 106 .defaultValues("false"); 107 LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts) 108 .describe("") 109 .defaultValues("true"); 110 LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw) 111 .describe("") 112 .defaultValues("false"); 113 LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript) 114 .describe("True if this scripttrigger should be aviable in the script") 115 .defaultValues("false"); 122 116 } 123 117 … … 171 165 172 166 if( !invert && this->distance(target) < radius) 173 {167 { 174 168 executeAction(timestep); 175 169 scriptCalled = true; 176 170 177 }178 else if( invert && this->distance(target) > radius)179 {180 181 182 }171 } 172 else if( invert && this->distance(target) > radius) 173 { 174 executeAction(timestep); 175 scriptCalled = true; 176 } 183 177 //else 184 178 //printf("SCRIPTTRIGGER: target out of range\n"); … … 190 184 { 191 185 192 193 186 if(scriptIsOk) 187 { 194 188 //testScriptingFramework(); 195 196 197 198 199 200 201 202 203 204 189 if(!(script->selectFunction(this->functionName,returnCount)) ) 190 printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str()); 191 192 script->pushParam( timestep, this->functionName); 193 194 if( !(script->executeFunction()) ) 195 printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str()); 196 197 scriptFinished = script->getReturnedBool(); 198 } 205 199 206 200 … … 225 219 /* 226 220 void ScriptTrigger::testScriptingFramework() 227 221 { 228 222 std::string file("lunartest2.lua"); 229 223 //get script -
trunk/src/world_entities/script_trigger.h
r9003 r9006 37 37 void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; } 38 38 void setInvert(const bool inv) { this->invert = invert; } 39 void setDelay(float delay) { this->delay = delay; }; 39 40 void setRadius(const float radius) { if(radius>0) this->radius = radius; } 40 41 void setScript(const std::string& file); -
trunk/src/world_entities/skydome.cc
r8793 r9006 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler … … 43 43 { 44 44 PRINTF(0)("Skydome init\n"); 45 45 46 46 this->setClassID(CL_SKYDOME, "Skydome"); 47 47 this->toList(OM_BACKGROUND); 48 this->toReflectionList(); 48 this->toReflectionList(); 49 49 50 activateDome = false; 51 50 52 } 51 53 … … 57 59 { 58 60 PRINTF(0)("Deleting Skydome\n"); 59 61 60 62 if (glIsTexture(texture)) 61 63 glDeleteTextures(1, &texture); … … 74 76 75 77 78 void Skydome::activate() 79 { 80 this->activateDome = true; 81 } 82 83 void Skydome::deactivate() 84 { 85 this->activateDome = false; 86 } 87 88 76 89 void Skydome::draw() const 77 90 { 91 if(!activateDome) 92 return; 93 78 94 glPushAttrib(GL_ENABLE_BIT); 79 95 … … 88 104 glPushMatrix(); 89 105 glTranslatef(0.0f,pRadius,0.0f); 90 106 91 107 92 108 glBegin(GL_TRIANGLES); … … 113 129 { 114 130 PRINTF(0)("Generating a sky plane"); 115 131 116 132 // Make sure our vertex array is clear 117 if (planeVertices) 133 if (planeVertices) 118 134 { 119 135 delete planeVertices; … … 130 146 // Set the number of divisions into a valid range 131 147 int divs = divisions; 132 if (divisions < 1) 148 if (divisions < 1) 133 149 divs = 1; 134 150 135 if (divisions > 256) 136 divs = 256; 151 if (divisions > 256) 152 divs = 256; 137 153 138 154 pRadius = planetRadius; … … 152 168 float delta = plane_size/(float)divs; 153 169 float tex_delta = 2.0f/(float)divs; 154 170 155 171 // Variables we'll use during the dome's generation 156 172 float x_dist = 0.0f; … … 193 209 int startvert = (i*(divs+1) + j); 194 210 195 211 // tri 1 196 212 indices[index++] = startvert; 197 213 indices[index++] = startvert+1; … … 203 219 indices[index++] = startvert+divs+1; 204 220 } 205 } 206 } 221 } 222 } -
trunk/src/world_entities/skydome.h
r8793 r9006 34 34 void setShader(Shader* shader); 35 35 void setTexture(GLuint texture); 36 37 void activate(); 38 void deactivate(); 36 39 37 40 private: … … 44 47 }; 45 48 49 bool activateDome; 46 50 47 51 VertexInfo *planeVertices;
Note: See TracChangeset
for help on using the changeset viewer.