- Timestamp:
- Jun 15, 2006, 1:12:24 PM (18 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.cc
r8261 r8455 65 65 66 66 67 boolCloudEffect::init()67 void CloudEffect::init() 68 68 { 69 69 PRINTF(1)("Initializing CloudEffect\n"); … … 84 84 float bbox[3] = {0}; 85 85 cloudModel.GetDimensions(bbox[0], bbox[1], bbox[2]); 86 86 87 87 // Load Shaders 88 88 this->cloudShader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/sky.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/sky.frag"); … … 115 115 116 116 117 boolCloudEffect::activate()117 void CloudEffect::activate() 118 118 { 119 119 PRINTF(0)( "Activating CloudEffect with Material %s\n", this->cloudTexture.c_str()); … … 122 122 } 123 123 124 boolCloudEffect::deactivate()124 void CloudEffect::deactivate() 125 125 { 126 126 PRINTF(0)("Deactivating CloudEffect\n"); … … 133 133 if (!this->cloudActivate) 134 134 return; 135 135 136 136 // glMatrixMode(GL_MODELVIEW); 137 137 // glPushMatrix(); … … 159 159 // glCullFace(GL_BACK); 160 160 // glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 161 161 162 162 // glLineWidth(3.0f); 163 163 … … 209 209 210 210 glPopMatrix(); 211 211 212 212 } 213 213 -
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h
r8255 r8455 28 28 virtual void loadParams(const TiXmlElement* root); 29 29 30 virtual boolinit();30 virtual void init(); 31 31 32 virtual boolactivate();33 virtual booldeactivate();32 virtual void activate(); 33 virtual void deactivate(); 34 34 35 35 inline void activateCloud() { this->activate(); } -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r8445 r8455 71 71 } 72 72 73 bool FogEffect::init() 74 { 75 //default values 76 this->fogActivate = false; 73 void FogEffect::init() 74 { 75 // default values 76 this->fogMode = GL_LINEAR; 77 this->fogDensity = 0.03; 78 this->fogStart = 0; 79 this->fogEnd = 50; 80 this->colorVector = Vector(0.3, 0.3, 0.3); 81 82 // init variables 77 83 this->fogFadeInDuration = 0; 78 84 this->fogFadeOutDuration = 0; 85 this->fogFadeInDensity = 0; 86 this->fogFadeOutDensity = 0; 79 87 this->localTimer = 0; 80 81 this->fogMode = GL_LINEAR; 82 this->fogDensity = 0.05; 83 this->fogStart = 0; 84 this->fogEnd = 500; 85 this->colorVector = Vector(0.3, 0.3, 0.3); 86 87 return 0; 88 } 89 90 91 bool FogEffect::activate() 88 this->fogActivate = false; 89 this->fogFadeInActivate = false; 90 this->fogFadeOutActivate = false; 91 92 } 93 94 95 void FogEffect::activate() 92 96 { 93 97 PRINTF(0)( "Enabling FogEffect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity, this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z); … … 102 106 glFogf(GL_FOG_END, this->fogEnd); 103 107 104 // glFogf(GL_FOG_DENSITY, this->fogDensity); 105 108 if ( this->fogFadeInActivate ) 109 glFogf(GL_FOG_DENSITY, this->fogFadeInDensity); 110 else if ( this->fogFadeOutActivate ) 111 glFogf(GL_FOG_DENSITY, this->fogFadeOutDensity); 112 else 113 glFogf(GL_FOG_DENSITY, this->fogDensity); 114 106 115 glEnable(GL_FOG); 107 116 108 return 0; 109 } 110 111 112 bool FogEffect::deactivate() 117 } 118 119 120 void FogEffect::deactivate() 113 121 { 114 122 PRINTF(0)("Deactivating FogEffect\n"); … … 120 128 glDisable(GL_FOG); 121 129 122 return 0;123 130 } 124 131 125 132 void FogEffect::draw() const { 126 133 134 if (!this->fogActivate) 135 return; 136 127 137 // If Fog Fade In 128 if ( this->fogFadeInActivate ) {138 if ( this->fogFadeInActivate ) 129 139 glFogf(GL_FOG_DENSITY, this->fogFadeInDensity); 130 // PRINTF(0)( "this->fogFadeInDensity: %f\n", this->fogFadeInDensity); 131 } 140 132 141 // If Fog Fade Out 133 elseif ( this->fogFadeOutActivate )142 if ( this->fogFadeOutActivate ) 134 143 glFogf(GL_FOG_DENSITY, this->fogFadeOutDensity); 135 136 // Normal Fog activate137 else138 glFogf(GL_FOG_DENSITY, this->fogDensity);139 144 140 145 } … … 147 152 if ( this->fogFadeInActivate ) { 148 153 this->localTimer += dt; 149 float progress = this->localTimer / this->fogFadeInDuration; 150 this->fogFadeInDensity = progress * this->fogDensity; 154 this->fogFadeInDensity = ( this->localTimer / this->fogFadeInDuration ) * this->fogDensity; 151 155 152 156 if ( this->localTimer >= this->fogFadeOutDuration ) 153 157 this->fogFadeInActivate = false; 154 158 } 155 else if ( this->fogFadeOutActivate ) { 159 160 if ( this->fogFadeOutActivate ) { 156 161 this->localTimer += dt; 157 float progress = this->localTimer / this->fogFadeInDuration; 158 this->fogFadeOutDensity = 1 - progress * this->fogDensity; 162 this->fogFadeOutDensity = 1 - (( this->localTimer / this->fogFadeInDuration ) * this->fogDensity); 159 163 160 164 if ( this->localTimer >= this->fogFadeOutDuration ) -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
r8443 r8455 18 18 virtual void loadParams(const TiXmlElement* root); 19 19 20 virtual boolinit();20 virtual void init(); 21 21 22 virtual boolactivate();23 virtual booldeactivate();22 virtual void activate(); 23 virtual void deactivate(); 24 24 25 25 void activateFog() { this->activate(); } -
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.cc
r8449 r8455 38 38 { 39 39 this->setClassID(CL_LIGHTENING_EFFECT, "LighteningEffect"); 40 40 41 41 this->init(); 42 42 … … 72 72 73 73 74 boolLighteningEffect::init()74 void LighteningEffect::init() 75 75 { 76 76 //default values 77 77 this->lighteningActivate = false; 78 78 79 79 this->time = 0.0; 80 80 this->flashFrequency = 4.0f; … … 82 82 this->flashConstTime = 0.1f; 83 83 this->flashRisingTime = 0.03f; 84 84 85 85 this->width = 700.0f; 86 86 this->height = 250.0f; … … 89 89 this->bNewCoordinate = false; 90 90 this->lighteningMove = false; 91 91 92 92 this->seedX = 500.f; 93 93 this->seedZ = 1000.0f; 94 94 this->seedTime = 2.0f; 95 95 96 96 this->mainPosX = 3000; 97 97 this->mainPosY = 900; 98 98 this->mainPosZ = 0; 99 99 100 100 // initialize lightening textures 101 101 this->billboard[0] = new Billboard(NULL); … … 103 103 this->billboard[0]->setSize(this->width, this->height); 104 104 this->billboard[0]->setVisibiliy(false); 105 105 106 106 this->billboard[1] = new Billboard(NULL); 107 107 this->billboard[1]->setTexture("maps/lightning_bolt2.png"); 108 108 this->billboard[1]->setSize(this->width, this->height); 109 109 this->billboard[1]->setVisibiliy(false); 110 110 111 111 this->billboard[2] = new Billboard(NULL); 112 112 this->billboard[2]->setTexture("maps/lightning_bolt3.png"); 113 113 this->billboard[2]->setSize(this->width, this->height); 114 114 this->billboard[2]->setVisibiliy(false); 115 115 116 116 this->billboard[3] = new Billboard(NULL); 117 117 this->billboard[3]->setTexture("maps/lightning_bolt4.png"); 118 118 this->billboard[3]->setSize(this->width, this->height); 119 119 this->billboard[3]->setVisibiliy(false); 120 120 121 121 if (this->lighteningMove) { 122 122 this->cameraCoor = State::getCameraNode()->getAbsCoor(); … … 131 131 this->billboard[3]->setAbsCoor(3000,900,0); 132 132 } 133 133 134 134 this->flashLight = new Light(); 135 135 this->flashLight->setDiffuseColor(0,0,0); 136 136 this->flashLight->setSpecularColor(0,0,0); 137 137 138 138 /* 139 139 this->soundSource = NULL; 140 140 this->thunderBuffer = NULL; 141 141 142 142 this->soundSource.setSourceNode(this); 143 143 144 144 //load sound 145 145 if (this->thunderBuffer != NULL) … … 147 147 this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/thunder.wav", WAV);*/ 148 148 149 return 0;150 149 } 151 150 … … 185 184 186 185 187 boolLighteningEffect::activate()186 void LighteningEffect::activate() 188 187 { 189 188 PRINTF(0)( "Activating LighteningEffect\n" ); … … 191 190 192 191 this->time = 0; 193 194 return 0; 195 } 196 197 198 bool LighteningEffect::deactivate() 192 } 193 194 195 void LighteningEffect::deactivate() 199 196 { 200 197 PRINTF(0)("Deactivating LighteningEffect\n"); … … 205 202 this->billboard[2]->setVisibiliy(false); 206 203 this->billboard[3]->setVisibiliy(false); 207 208 return 0;209 204 } 210 205 … … 213 208 if(!lighteningActivate) 214 209 return; 215 210 216 211 this->time += dt; 217 212 218 213 // TODO: Make random flashing with short light dingsda:) 219 214 220 215 if( this->time > this->flashFrequency) { 221 216 222 217 this->billboard[0]->setVisibiliy(true); 223 218 this->time = 0.0f; 224 219 225 220 this->flashLight->setAbsCoor(this->billboard[0]->getAbsCoor().x, this->billboard[0]->getAbsCoor().y, this->billboard[0]->getAbsCoor().z); 226 221 … … 228 223 this->flashLight->setDiffuseColor(1,1,1); 229 224 this->flashLight->setSpecularColor(1,1,1); 230 225 231 226 //this->soundSource.play(this->thunderBuffer); 232 227 233 228 } else if( this->billboard[3]->isVisible() && this->time > this->flashConstTime) { 234 229 235 230 this->billboard[3]->setVisibiliy(false); 236 231 this->time = 0.0f; … … 240 235 241 236 } 242 237 243 238 if( this->billboard[2]->isVisible() && this->time > this->flashRisingTime) { 244 239 245 240 this->billboard[2]->setVisibiliy(false); 246 241 this->billboard[3]->setVisibiliy(true); 247 242 // this->flashLight->setDiffuseColor(1,1,1); 248 243 // this->flashLight->setSpecularColor(1,1,1); 249 244 250 245 } else if( this->billboard[1]->isVisible() && this->time > this->flashRisingTime*2/3 ) { 251 246 252 247 this->billboard[1]->setVisibiliy(false); 253 248 this->billboard[2]->setVisibiliy(true); 254 249 //this->flashLight->setDiffuseColor(0,0,0); 255 250 //this->flashLight->setSpecularColor(0,0,0); 256 251 257 252 } else if( this->billboard[0]->isVisible() && this->time > this->flashRisingTime*1/3 ) { 258 253 259 254 this->billboard[0]->setVisibiliy(false); 260 255 this->billboard[1]->setVisibiliy(true); 261 256 //this->flashLight->setDiffuseColor(1,1,1); 262 257 //this->flashLight->setSpecularColor(1,1,1); 263 264 } 265 258 259 } 260 266 261 if( this->bNewCoordinate) { 267 262 float posX, posZ; 268 263 269 264 if(this->lighteningMove) { 270 265 271 266 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 272 267 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX + this->cameraCoor.x; … … 274 269 275 270 } else { 276 271 277 272 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX; 278 273 posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX; 279 274 280 275 } 281 276 282 277 this->billboard[0]->setAbsCoor(posX, this->mainPosY, posZ); 283 278 this->billboard[1]->setAbsCoor(posX, this->mainPosY, posZ); 284 279 this->billboard[2]->setAbsCoor(posX, this->mainPosY, posZ); 285 280 this->billboard[3]->setAbsCoor(posX, this->mainPosY, posZ); 286 281 287 282 this->flashFrequency = this->mainFrequency + this->seedTime * (float)rand()/(float)RAND_MAX; 288 283 289 284 float w = this->width + this->seedWidth * (float)rand()/(float)RAND_MAX; 290 285 float h = this->height + this->seedHeight * (float)rand()/(float)RAND_MAX; 291 286 292 287 this->billboard[0]->setSize(w, h); 293 288 this->billboard[1]->setSize(w, h); 294 289 this->billboard[2]->setSize(w, h); 295 290 this->billboard[3]->setSize(w, h); 296 291 297 292 this->bNewCoordinate = false; 298 293 } -
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h
r8373 r8455 25 25 virtual void loadParams(const TiXmlElement* root); 26 26 27 virtual boolinit();27 virtual void init(); 28 28 29 virtual boolactivate();30 virtual booldeactivate();29 virtual void activate(); 30 virtual void deactivate(); 31 31 32 inline void activateLightening() { this->activate(); }33 inline void deactivateLightening() { this->deactivate(); }32 inline void activateLightening() { this->activate(); } 33 inline void deactivateLightening() { this->deactivate(); } 34 34 35 35 virtual void draw() const; -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8443 r8455 105 105 106 106 107 boolRainEffect::init()107 void RainEffect::init() 108 108 { 109 109 //Default values … … 126 126 lightMan = LightManager::getInstance(); 127 127 this->rainAmbient = lightMan->getAmbientColor(); 128 129 return 0;130 128 } 131 129 … … 133 131 SparkParticles* RainEffect::rainParticles = NULL; 134 132 135 boolRainEffect::activate()133 void RainEffect::activate() 136 134 { 137 135 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" ); … … 168 166 lightMan->setAmbientColor(.1,.1,.1); 169 167 170 return 0; 171 } 172 173 174 bool RainEffect::deactivate() 168 } 169 170 171 void RainEffect::deactivate() 175 172 { 176 173 PRINTF(0)("Deactivating RainEffect\n"); … … 185 182 lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient); 186 183 187 return 0;188 184 } 189 185 -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h
r8356 r8455 30 30 virtual void loadParams(const TiXmlElement* root); 31 31 32 virtual boolinit();32 virtual void init(); 33 33 34 virtual boolactivate();35 virtual booldeactivate();34 virtual void activate(); 35 virtual void deactivate(); 36 36 37 37 inline void activateRain() { this->activate(); } -
branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.cc
r8261 r8455 79 79 LoadParam(root, "size", this, SnowEffect, size); 80 80 LoadParam(root, "coord", this, SnowEffect, coord); 81 81 82 82 LOAD_PARAM_START_CYCLE(root, element); 83 83 { … … 87 87 } 88 88 89 boolSnowEffect::init()89 void SnowEffect::init() 90 90 { 91 91 this->emitter = new PlaneEmitter(); … … 113 113 } 114 114 115 boolSnowEffect::activate()115 void SnowEffect::activate() 116 116 { 117 117 PRINTF(0)("Activating SnowEffect\n"); … … 146 146 147 147 148 boolSnowEffect::deactivate()148 void SnowEffect::deactivate() 149 149 { 150 150 PRINTF(0)("Deactivating SnowEffect\n"); … … 171 171 /* 172 172 float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len(); 173 173 174 174 if(activated) 175 175 { … … 182 182 else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y) 183 183 this->alpha = 0.4; 184 184 185 185 SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha); 186 186 SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2); … … 197 197 else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y ) 198 198 this->alpha = 0.5; 199 199 200 200 SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha); 201 201 SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2); -
branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.h
r8255 r8455 28 28 virtual void loadParams(const TiXmlElement* root); 29 29 30 virtual boolinit();30 virtual void init(); 31 31 32 virtual boolactivate();33 virtual booldeactivate();32 virtual void activate(); 33 virtual void deactivate(); 34 34 35 35 inline void activateSnow() { this->activate(); } -
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc
r7810 r8455 29 29 30 30 //#include <GL/glext.h> //OpenGL Extensions 31 //#include <GL/glxext.h> // GLX Extensions 31 //#include <GL/glxext.h> // GLX Extensions 32 32 33 33 #ifndef GL_EXT_fog_coord … … 76 76 } 77 77 78 boolVolFogEffect::init()78 void VolFogEffect::init() 79 79 { 80 80 PRINTF(0)("Initalize VolFogEffect\n"); … … 92 92 // Set fog color 93 93 float fogColor[4] = {0.6f,0.58f,0.79f,0.0f}; 94 94 95 95 96 96 glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordfEXT"); … … 117 117 118 118 if (glewGetExtension("GL_EXT_fog_coord")) 119 {120 119 PRINTF(0)("GL_EXT_fog_coord extension found\n"); 121 return true; 122 } 123 else 124 { 125 PRINTF(0)("GL_EXT_fog_coord extension NOT found\n"); 126 return false; 127 } 128 } 129 130 131 bool VolFogEffect::activate() 120 } 121 122 123 void VolFogEffect::activate() 132 124 { 133 125 PRINTF(0)("Activating VolFogEffect\n"); 134 126 } 135 127 136 boolVolFogEffect::deactivate()128 void VolFogEffect::deactivate() 137 129 { 138 130 PRINTF(0)("Deactivating VolFogEffect\n"); … … 160 152 //glEnable(GL_BLEND); 161 153 //glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); 162 154 163 155 int i; 164 156 glLoadIdentity(); 165 157 166 158 167 159 glBegin( GL_LINES ); 168 160 glNormal3f(0,1,0); … … 210 202 * ticks the effect if there is any time dependancy 211 203 */ 212 void VolFogEffect::tick(float dt) 213 { 214 } 204 void VolFogEffect::tick(float dt) 205 { 206 } -
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.h
r7810 r8455 18 18 virtual void loadParams(const TiXmlElement* root); 19 19 20 virtual boolinit();20 virtual void init(); 21 21 22 virtual boolactivate();23 virtual booldeactivate();22 virtual void activate(); 23 virtual void deactivate(); 24 24 25 25 virtual void draw() const; -
branches/atmospheric_engine/src/lib/graphics/effects/weather_effect.cc
r8255 r8455 55 55 * initializes the graphics effect 56 56 */ 57 boolWeatherEffect::init()57 void WeatherEffect::init() 58 58 {} 59 59 -
branches/atmospheric_engine/src/lib/graphics/effects/weather_effect.h
r7810 r8455 18 18 virtual void loadParams(const TiXmlElement* root); 19 19 20 virtual boolinit();20 virtual void init(); 21 21 22 virtual bool activate() = 0;23 virtual bool deactivate() = 0;22 virtual void activate(); 23 virtual void deactivate(); 24 24 25 25 virtual void draw() const; 26 26 virtual void tick(float dt); 27 27 28 inline bool isActivated() const { return this->bActivated; }28 inline bool isActivated() const { return this->bActivated; } 29 29 30 30
Note: See TracChangeset
for help on using the changeset viewer.