Changeset 9235 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Jul 5, 2006, 4:39:02 PM (18 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/effects/cloud_effect.cc
r9112 r9235 90 90 this->planetRadius = 1500; 91 91 this->divs = 15; 92 this->cloudActivate = false; 92 93 fadeSky = false; 93 94 fadeCloud = false; -
trunk/src/lib/graphics/effects/fog_effect.cc
r9112 r9235 20 20 #include "shell_command.h" 21 21 #include "script_class.h" 22 #include "cloud_effect.h" 22 23 23 24 // Define shell commands 24 SHELL_COMMAND(activate, FogEffect, activateFog);25 SHELL_COMMAND(deactivate, FogEffect, deactivateFog);25 //SHELL_COMMAND(activate, FogEffect, activateFog); 26 //SHELL_COMMAND(deactivate, FogEffect, deactivateFog); 26 27 SHELL_COMMAND(fadein, FogEffect, fadeInFog); 27 28 SHELL_COMMAND(fadeout, FogEffect, fadeOutFog); … … 84 85 this->fogFadeInActivate = false; 85 86 this->fogFadeOutActivate = false; 87 88 this->cloudColor = Vector(0.2f, 0.3f, 0.3f); 89 this->skyColor = Vector(0.2f, 0.3f, 0.3f); 86 90 } 87 91 … … 93 97 WeatherEffect::loadParams(root); 94 98 95 LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)");; 96 LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog");; 97 LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end");; 98 LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b");; 99 LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in");; 100 LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out");; 101 99 LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)"); 100 LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog"); 101 LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end"); 102 LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b"); 103 LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in"); 104 LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out"); 105 LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor); 106 LoadParam(root, "skycolor", this, FogEffect, setSkyColor); 107 102 108 LOAD_PARAM_START_CYCLE(root, element); 103 109 { 104 LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate"); ;110 LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate"); 105 111 } 106 112 LOAD_PARAM_END_CYCLE(element); … … 125 131 126 132 glEnable(GL_FOG); 133 134 // Store cloud- and sky color before the snow 135 this->oldCloudColor = CloudEffect::cloudColor; 136 this->oldSkyColor = CloudEffect::skyColor; 137 138 // Change the colors 139 CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration); 140 CloudEffect::changeSkyColor(this->skyColor, this->fogFadeInDuration); 127 141 } 128 142 … … 184 198 185 199 if ( this->fogMode == GL_LINEAR) 186 this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFade InDuration ) + this->fogEnd;200 this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeOutDuration ) + this->fogEnd; 187 201 else 188 this->fogFadeDensity = 1 - (( this->localTimer / this->fogFade InDuration ) * this->fogDensity);202 this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeOutDuration ) * this->fogDensity); 189 203 190 204 if ( this->localTimer >= this->fogFadeOutDuration ) … … 207 221 // If no manual FadeIn value was set, set a default value 208 222 if (!this->fogFadeInDuration > 0) 209 this->fogFadeInDuration = 20;223 this->fogFadeInDuration = 10; 210 224 211 225 // Reset local timer … … 227 241 this->fogFadeInActivate = false; 228 242 243 229 244 // If Fog is off, turn it on first 230 245 if (!this->fogActivate) … … 233 248 // If no manual FadeOut value was set, set a default value 234 249 if (!this->fogFadeOutDuration > 0) 235 this->fogFadeOutDuration = 20;250 this->fogFadeOutDuration = 10; 236 251 237 252 // set FogFadeOut activate … … 240 255 // Reset local timer 241 256 this->localTimer = 0; 242 } 243 257 258 // Restore the old cloud- and sky color 259 CloudEffect::changeCloudColor(this->oldCloudColor, this->fogFadeOutDuration); 260 CloudEffect::changeSkyColor(this->oldSkyColor, this->fogFadeOutDuration); 261 } 262 -
trunk/src/lib/graphics/effects/fog_effect.h
r8793 r9235 10 10 #include "glincl.h" 11 11 #include "vector.h" 12 13 class CloudEffect; 12 14 13 15 class FogEffect : public WeatherEffect … … 73 75 this->fogActivate = true; 74 76 } 77 78 inline void setCloudColor(float colorX, float colorY, float colorZ) 79 { 80 this->cloudColor = Vector(colorX, colorY, colorZ); 81 } 82 inline void setSkyColor(float colorX, float colorY, float colorZ) 83 { 84 this->skyColor = Vector(colorX, colorY, colorZ); 85 } 75 86 76 87 void fadeInFog(); … … 109 120 Vector colorVector; 110 121 float localTimer; 122 123 Vector oldSkyColor; 124 Vector oldCloudColor; 125 Vector skyColor; 126 Vector cloudColor; 111 127 }; 112 128 -
trunk/src/lib/graphics/effects/lightning_effect.cc
r9112 r9235 112 112 } 113 113 114 //should load both texture 114 115 this->thunderTextureA = true; 115 116 this->setTexture(); 117 this->switchTexture(); 116 118 117 119 if (this->lightningMove) { -
trunk/src/lib/graphics/effects/rain_effect.cc
r9112 r9235 34 34 35 35 // Define shell commands 36 SHELL_COMMAND(activate, RainEffect, activateRain);37 SHELL_COMMAND(deactivate, RainEffect, deactivateRain);36 //SHELL_COMMAND(activate, RainEffect, activateRain); 37 //SHELL_COMMAND(deactivate, RainEffect, deactivateRain); 38 38 SHELL_COMMAND(startraining, RainEffect, startRaining); 39 39 SHELL_COMMAND(stopraining, RainEffect, stopRaining); … … 96 96 */ 97 97 void RainEffect::init() { 98 99 this->rainParticles = NULL; 100 this->emitter = NULL; 101 this->rainBuffer = NULL; 102 this->windBuffer = NULL; 103 this->lightMan = NULL; 104 98 105 //Default values 99 106 this->rainActivate = false; … … 119 126 this->emitter = new PlaneEmitter(this->rainSize); 120 127 128 lightMan = LightManager::getInstance(); 121 129 } 122 130 … … 187 195 // If we're not fading, change color immediately 188 196 if (!this->rainFadeInActivate || !this->rainFadeOutActivate) { 189 CloudEffect::changeCloudColor(this->cloudColor, 0); 190 CloudEffect::changeSkyColor(this->skyColor, 0); 191 } 197 CloudEffect::changeCloudColor(this->cloudColor, 0.2); 198 CloudEffect::changeSkyColor(this->skyColor, 0.2); 199 } 200 201 //lightMan->setAmbientColor(.1,.1,.1); 192 202 } 193 203 … … 202 212 this->rainFadeOutActivate = false; 203 213 204 this->emitter->setSystem(NULL); 214 //if(this->emitter) 215 // this->emitter->setSystem(NULL); 216 //this->hideRain(); 205 217 206 218 // Stop Sound … … 208 220 209 221 // Restore the old cloud- and sky color 210 CloudEffect::changeCloudColor(this->oldCloudColor, 0 );211 CloudEffect::changeSkyColor(this->oldSkyColor, 0 );222 CloudEffect::changeCloudColor(this->oldCloudColor, 0.2); 223 CloudEffect::changeSkyColor(this->oldSkyColor, 0.2); 212 224 } 213 225 … … 242 254 243 255 // increase sound volume 244 if (!this->soundSource.isPlaying()) 256 if (progress > 0.5) { 257 if (!this->soundSource.isPlaying()) 245 258 this->soundSource.play(this->rainBuffer, this->soundRainVolume, true); 246 this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress); 259 this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress * 2 - 0.5); 260 } 247 261 248 262 if (progress >= 1) 249 263 this->rainFadeInActivate = false; 264 265 lightMan->setAmbientColor(1-progress, 1-progress, 1-progress); 250 266 } 251 267 … … 276 292 this->deactivate(); 277 293 } 294 lightMan->setAmbientColor(1-progress, 1-progress, 1-progress); 278 295 } 279 296 } -
trunk/src/lib/graphics/effects/rain_effect.h
r9006 r9235 132 132 float soundRainVolume; 133 133 134 Vector oldSkyColor; 135 Vector oldCloudColor; 136 Vector skyColor; 137 Vector cloudColor; 134 Vector oldSkyColor; 135 Vector oldCloudColor; 136 Vector skyColor; 137 Vector cloudColor; 138 139 LightManager* lightMan; 138 140 139 141 }; -
trunk/src/lib/graphics/effects/snow_effect.cc
r9112 r9235 28 28 #include "shell_command.h" 29 29 #include "script_class.h" 30 #include "cloud_effect.h" 30 31 31 32 #include "parser/tinyxml/tinyxml.h" … … 53 54 54 55 //load wind sound 55 if (this->snowWindForce > 1) {56 if (this->snowWindForce >= 1) { 56 57 if (this->windBuffer != NULL) 57 58 ResourceManager::getInstance()->unload(this->windBuffer); 58 59 this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV); 59 60 } 60 61 … … 87 88 LoadParam(root, "size", this, SnowEffect, size); 88 89 LoadParam(root, "coord", this, SnowEffect, coord); 90 LoadParam(root, "cloudcolor", this, SnowEffect, setCloudColor); 91 LoadParam(root, "skycolor", this, SnowEffect, setSkyColor); 92 LoadParam(root, "fadetime", this, SnowEffect, setFadeTime); 89 93 90 94 LOAD_PARAM_START_CYCLE(root, element); … … 119 123 this->snowCoord = Vector(100,450,400); 120 124 this->snowWindForce = 1; 125 126 this->fadeTime = 10; 127 this->cloudColor = Vector(0.2f, 0.2f, 0.2f); 128 this->skyColor = Vector(0.0f, 0.0f, 0.0f); 121 129 } 122 130 … … 149 157 if (this->snowWindForce != 0) 150 158 this->soundSource.play(this->windBuffer, 0.1f * this->snowWindForce, true); 159 160 // Store cloud- and sky color before the snow 161 this->oldCloudColor = CloudEffect::cloudColor; 162 this->oldSkyColor = CloudEffect::skyColor; 163 164 // Change the colors 165 CloudEffect::changeCloudColor(this->cloudColor, this->fadeTime); 166 CloudEffect::changeSkyColor(this->skyColor, this->fadeTime); 151 167 152 168 } … … 162 178 if (this->windBuffer != NULL) 163 179 ResourceManager::getInstance()->unload(this->windBuffer); 180 181 // Restore the old cloud- and sky color 182 CloudEffect::changeCloudColor(this->oldCloudColor, this->fadeTime); 183 CloudEffect::changeSkyColor(this->oldSkyColor, this->fadeTime); 164 184 } 165 185 -
trunk/src/lib/graphics/effects/snow_effect.h
r8495 r9235 16 16 class PlaneEmitter; 17 17 class PNode; 18 class CloudEffect; 18 19 19 20 #include "sound_source.h" … … 77 78 this->snowWindForce = force; 78 79 } 80 inline void setCloudColor(float colorX, float colorY, float colorZ) 81 { 82 this->cloudColor = Vector(colorX, colorY, colorZ); 83 } 84 inline void setSkyColor(float colorX, float colorY, float colorZ) 85 { 86 this->skyColor = Vector(colorX, colorY, colorZ); 87 } 88 inline void setFadeTime(float time) 89 { 90 this->fadeTime = time; 91 } 79 92 80 93 inline void setSnowOption(const std::string& option) { … … 97 110 float angle, randomAngle; 98 111 float alpha; 112 float fadeTime; 99 113 Vector snowCoord; 100 114 Vector2D snowSize; … … 110 124 OrxSound::SoundBuffer* windBuffer; 111 125 126 Vector oldSkyColor; 127 Vector oldCloudColor; 128 Vector skyColor; 129 Vector cloudColor; 112 130 }; 113 131 -
trunk/src/lib/graphics/importer/bsp_manager.cc
r9110 r9235 53 53 { 54 54 55 this->lastTex = -1; 55 56 this->parent = parent; 56 57 /*// open a BSP file … … 101 102 return 0; 102 103 } 104 105 103 106 /* 104 107 BspManager::BspManager(const char* fileName, float scale) … … 270 273 const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist; 271 274 272 if(dMins < - 50.0 && dMaxs < - 50.0) {275 if(dMins < -70.0 && dMaxs < -70.0) { 273 276 continue; 274 277 } … … 1371 1374 else 1372 1375 { 1373 if( this->outputFraction == 1.0f) 1376 if( this->outputFraction == 1.0f) // No collision Detected 1374 1377 { 1375 if( this->outputAllSolid ) 1378 if( this->outputAllSolid ) 1376 1379 { 1377 1380 this->collPlane = new plane; … … 1382 1385 SolidFlag = true; 1383 1386 } 1384 else 1387 else // No collision happened 1385 1388 { 1386 1389 yCollisionDown = false; … … 1388 1391 } 1389 1392 } 1390 else 1393 else // A collision has happended 1391 1394 { 1392 1395 yCollisionDown = true; 1393 1396 collPos = position + (down - position) * this->outputFraction; 1394 this->out = collPos; // why this????1395 1397 } 1396 1398 } -
trunk/src/lib/graphics/importer/md2/md2Model.cc
r9003 r9235 40 40 41 41 //! list of all different animations a std md2model supports 42 sAnim MD2Model::animationList[2 1] =42 sAnim MD2Model::animationList[22] = 43 43 { 44 44 // begin, end, fps, interruptable … … 64 64 { 190, 197, 10, 0 }, //!< DEATH_FALLBACKSLOW 65 65 { 198, 198, 5, 1 }, //!< BOOM 66 { 199, 204, 10, 1 }, //!< WALK (only for spectial models) 66 67 }; 67 68 -
trunk/src/lib/graphics/importer/md2/md2Model.h
r9003 r9235 30 30 #define MD2_VERSION 8 //!< the md2 version in the header 31 31 #define MD2_MAX_TRIANGLES 4096 //!< maximal triangles count 32 #define MD2_MAX_VERTICES 2048 //!< maximal vertices count33 #define MD2_MAX_TEXCOORDS 2048 //!< maximal tex coordinates32 #define MD2_MAX_VERTICES 3048 //!< maximal vertices count 33 #define MD2_MAX_TEXCOORDS 3048 //!< maximal tex coordinates 34 34 #define MD2_MAX_FRAMES 512 //!< maximal frames 35 35 #define MD2_MAX_SKINS 32 //!< maximal skins … … 92 92 DEATH_FALLBACKSLOW, 93 93 BOOM, 94 WALK, 94 95 95 96 MAX_ANIMATIONS … … 180 181 static sVec3D anorms[NUM_VERTEX_NORMALS]; //!< the anormals 181 182 static float anormsDots[SHADEDOT_QUANT][256]; //!< the anormals dot products 182 static sAnim animationList[2 1]; //!< the anomation list183 static sAnim animationList[22]; //!< the anomation list 183 184 //! again one of these strange id software parts 184 185 float* shadeDots;
Note: See TracChangeset
for help on using the changeset viewer.