Changeset 7515 in orxonox.OLD for branches/atmospheric_engine/src
- Timestamp:
- May 3, 2006, 3:25:38 PM (19 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r7503 r7515 92 92 93 93 94 95 94 bool FogEffect::deactivate() 96 95 { -
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc
r7504 r7515 21 21 22 22 #include "shell_command.h" 23 /*SHELL_COMMAND(activateVolFog, VolFogEffect, VolFogEffect::activate)24 ->setAlias("aVolFog");25 SHELL_COMMAND(deactivateVolFog, VolFogEffect, VolFogEffect::deactivate)26 ->setAlias("dVolFog");*/27 23 28 24 using namespace std; … … 34 30 this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect"); 35 31 36 this->volfogMode = GL_LINEAR;37 this->volfogDensity = 0.001f;38 this->volfogStart = 10.0f;39 this->volfogEnd = 1000.0f;40 41 32 if (root != NULL) 42 33 this->loadParams(root); 43 34 jhljkhlkjhlkjh 44 35 this->activate(); 45 36 } … … 47 38 48 39 49 VolFogEffect::~VolFogEff ect()40 VolFogEffect::~VolFogEffdect() 50 41 { 51 42 this->deactivate(); … … 56 47 { 57 48 WeatherEffect::loadParams(root); 58 59 LoadParam(root, "volfog-mode", this, VolFogEffect, setVolFogMode);60 LoadParam(root, "volfog-density", this, VolFogEffect, setVolFogDensity);61 LoadParam(root, "volfog-color", this, VolFogEffect, setVolFogColor);62 63 64 49 } 65 50 … … 71 56 bool VolFogEffect::activate() 72 57 { 73 PRINTF(0)( "Enabling VolFog Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->volfogMode, this->volfogDensity,74 this->volfogStart, this->volfogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);75 58 76 glEnable(GL_FOG);77 {78 //GLfloat volfogColor[4] = {0.7, 0.6, 0.6, 1.0};79 GLfloat volfogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};80 81 glFogi(GL_FOG_MODE, this->volfogMode);82 glFogfv(GL_FOG_COLOR, volfogColor);83 glFogf(GL_FOG_DENSITY, this->volfogDensity);84 glHint(GL_FOG_HINT, GL_DONT_CARE);85 glFogf(GL_FOG_START, this->volfogStart);86 glFogf(GL_FOG_END, this->volfogEnd);87 88 //glVolFogi(GL_VOLFOG_COORDINATE_SOURCE, GL_VOLFOG_COORDINATE);89 }90 glClearColor(0.5, 0.5, 0.5, 1.0);91 59 } 92 60 … … 95 63 bool VolFogEffect::deactivate() 96 64 { 97 PRINTF(0)("Deactivating VolFog Effect"); 98 glDisable(GL_FOG); 65 99 66 } 100 67 101 68 102 103 GLint VolFogEffect::stringToVolFogMode(const std::string& mode)104 {105 if(mode == "GL_LINEAR")106 return GL_LINEAR;107 else if(mode == "GL_EXP")108 return GL_EXP;109 else if(mode == "GL_EXP2" )110 return GL_EXP2;111 else112 return -1;113 }114 115 -
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.h
r7505 r7515 23 23 virtual bool deactivate(); 24 24 25 inline void setVolFogMode(const std::string& mode) { this->volfogMode = this->stringToVolFogMode(mode); }26 inline void setVolFogDensity(float density) { this->volfogDensity = density; }27 inline void setVolFogRange(float start, float end) { this->volfogStart = start; this->volfogEnd = end; }28 inline void setVolFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }29 30 25 31 26 private: 32 GLint stringToVolFogMode(const std::string& mode);33 27 34 35 private:36 GLint volfogMode;37 GLfloat volfogDensity;38 GLfloat volfogStart;39 GLfloat volfogEnd;40 Vector colorVector;41 28 }; 42 29
Note: See TracChangeset
for help on using the changeset viewer.