Changeset 9936 in orxonox.OLD for branches/volumetric_fog
- Timestamp:
- Nov 17, 2006, 10:07:44 AM (18 years ago)
- Location:
- branches/volumetric_fog/src/world_entities/weather_effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.cc
r9935 r9936 20 20 #include "p_node.h" 21 21 #include "state.h" 22 #include "shell_command.h" 22 23 23 24 #include "glincl.h" 24 25 #include "debug.h" 25 26 26 27 27 #define GLX_GLXEXT_PROTOTYPES … … 31 31 CREATE_FACTORY(VolFogEffect); 32 32 33 SHELL_COMMAND(activate, VolFogEffect, activateFog); 34 SHELL_COMMAND(deactivate, VolFogEffect, deactivateFog); 35 36 37 typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); // Declare Function Prototype 38 PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL; // Our glFogCoordfEXT Function 33 39 34 40 … … 36 42 this->registerObject(this, VolFogEffect::_objectList); 37 43 38 39 44 if (root != NULL) 45 this->loadParams(root); 40 46 41 42 47 // Initialize Effect 48 this->init(); 43 49 44 45 46 50 // Activate Effect 51 if(fogActivate) 52 this->activate(); 47 53 } 48 54 49 55 50 56 VolFogEffect::~VolFogEffect() { 57 if(fogActivate) 51 58 this->deactivate(); 52 59 } 53 60 54 61 void VolFogEffect::loadParams(const TiXmlElement* root) { 55 62 WeatherEffect::loadParams(root); 56 63 } 57 64 58 65 void VolFogEffect::init() { 59 PRINTF(0)("Initalize VolFogEffect\n"); 60 61 fogActivate = false; 66 PRINTF(0)("Initalize VolFogEffect\n"); 67 68 fogColor[0] = 0.6f; 69 fogColor[1] = 0.3f; 70 fogColor[2] = 0.0f; 71 fogColor[3] = 1.0f; 62 72 63 73 fogActivate = false; 64 74 } 65 75 66 76 67 77 void VolFogEffect::activate() { 68 PRINTF(0)("Activating VolFogEffect\n"); 78 PRINTF(0)("Activating VolFogEffect\n"); 79 80 // Test whether the extension exists 81 if (!glewIsSupported("GL_EXT_fog_coord")) 82 { 83 PRINTF(0)("Can't activate volumetric fog, GL_EXT_fog_coord extension is misssing\n"); 84 return; 85 } 86 87 fogActivate = true; 69 88 } 70 89 71 90 void VolFogEffect::deactivate() { 72 PRINTF(0)("Deactivating VolFogEffect\n"); 91 PRINTF(0)("Deactivating VolFogEffect\n"); 92 93 fogActivate = false; 73 94 } 74 95 … … 79 100 void VolFogEffect::draw() const { 80 101 102 if(!fogActivate) 103 return; 81 104 } 82 105 -
branches/volumetric_fog/src/world_entities/weather_effects/volfog_effect.h
r9935 r9936 24 24 virtual void activate(); 25 25 virtual void deactivate(); 26 27 inline void activateFog() 28 { 29 this->activate(); 30 } 31 inline void deactivateFog() 32 { 33 this->deactivate(); 34 } 26 35 27 36 virtual void draw() const;
Note: See TracChangeset
for help on using the changeset viewer.