Changeset 7652 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc
- Timestamp:
- May 17, 2006, 6:41:58 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc
r7577 r7652 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 7 8 9 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler 13 13 */ 14 14 … … 27 27 VolFogEffect::VolFogEffect(const TiXmlElement* root) 28 28 { 29 29 this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect"); 30 30 31 32 31 if (root != NULL) 32 this->loadParams(root); 33 33 34 35 34 // Initialize Effect 35 this->init(); 36 36 37 38 37 // Activate Effect 38 this->activate(); 39 39 } 40 40 … … 42 42 VolFogEffect::~VolFogEffect() 43 43 { 44 44 this->deactivate(); 45 45 } 46 46 47 47 void VolFogEffect::loadParams(const TiXmlElement* root) 48 48 { 49 49 WeatherEffect::loadParams(root); 50 50 } 51 51 52 52 bool VolFogEffect::init() 53 53 { 54 55 56 57 58 59 54 PRINTF(0)("Initalize VolFogEffect\n"); 55 56 if (glewInit() == GLEW_OK) 57 PRINTF(0)("glewInit OK\n"); 58 else 59 PRINTF(0)("glewInit failed\n"); 60 60 61 62 61 // Set fog color 62 float fogColor[4] = {0.0, 1.0, 0.0, 1.0}; 63 63 64 65 66 67 68 69 70 71 64 /* set up fog params */ 65 glEnable(GL_FOG); // Enable Fog 66 glFogi(GL_FOG_MODE, GL_LINEAR); // Fog Fade Is Linear 67 glFogfv(GL_FOG_COLOR, fogColor); // Set The Fog Color 68 glFogf(GL_FOG_START, 0.0f); // Set The Fog Start 69 glFogf(GL_FOG_END, 1.0f); // Set The Fog End 70 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT); // Set The Fog based on vertice coordinates 71 // glHint(GL_FOG_HINT, GL_NICEST); // Per-Pixel Fog Calculation 72 72 73 73 // glClearColor(0.0, 0.0, 0.0, 1.0); //sets bg color?! 74 74 75 76 77 75 /* enable texturing & set texturing function */ 76 // glEnable(GL_TEXTURE_2D); 77 // glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 78 78 79 80 81 82 83 84 85 86 87 88 79 if (glewGetExtension("GL_EXT_fog_coord")) 80 { 81 PRINTF(0)("GL_EXT_fog_coord extension found\n"); 82 return true; 83 } 84 else 85 { 86 PRINTF(0)("GL_EXT_fog_coord extension NOT found\n"); 87 return false; 88 } 89 89 } 90 90 … … 92 92 bool VolFogEffect::activate() 93 93 { 94 94 PRINTF(0)("Activating VolFogEffect\n"); 95 95 } 96 96 97 97 bool VolFogEffect::deactivate() 98 98 { 99 99 PRINTF(0)("Deactivating VolFogEffect\n"); 100 100 } 101 101 102 102 103 103 /** 104 105 104 * draws the effect, if needed 105 */ 106 106 void VolFogEffect::draw() const 107 107 { … … 134 134 135 135 glBegin(GL_QUADS); // Back Wall 136 136 glFogCoordfEXT(0.0f); glVertex3f(0.0f,0.0f,0.0f); 137 137 glFogCoordfEXT(0.0f); glVertex3f( 100.0f,0.0f,0.0f); 138 138 glFogCoordfEXT(1.0f); glVertex3f( 100.0f, 100.0f,0.0f); … … 141 141 142 142 glBegin(GL_QUADS); // Front Wall 143 143 glFogCoordfEXT(0.0f); glVertex3f(0.0f,0.0f,100.0f); 144 144 glFogCoordfEXT(0.0f); glVertex3f( 100.0f,0.0f,100.0f); 145 145 glFogCoordfEXT(1.0f); glVertex3f( 100.0f, 100.0f,100.0f); … … 155 155 156 156 glBegin(GL_QUADS); // Left Wall 157 157 glFogCoordfEXT(0.0f); glVertex3f(0.0f,0.0f, 100.0f); 158 158 glFogCoordfEXT(1.0f); glVertex3f(0.0f, 100.0f, 100.0f); 159 159 glFogCoordfEXT(1.0f); glVertex3f(0.0f, 100.0f,0.0f); … … 169 169 170 170 /** 171 172 171 * ticks the effect if there is any time dependancy 172 */ 173 173 void VolFogEffect::tick(float dt) 174 174 {
Note: See TracChangeset
for help on using the changeset viewer.