Changeset 7523 in orxonox.OLD for branches/atmospheric_engine
- Timestamp:
- May 3, 2006, 5:01:22 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
r7515 r7523 20 20 #include "glincl.h" 21 21 22 #include "shell_command.h"23 /*SHELL_COMMAND(activateFog, FogEffect, FogEffect::activate)22 /*#include "shell_command.h" 23 SHELL_COMMAND(activateFog, FogEffect, FogEffect::activate) 24 24 ->setAlias("aFog"); 25 25 SHELL_COMMAND(deactivateFog, FogEffect, FogEffect::deactivate) … … 71 71 bool FogEffect::activate() 72 72 { 73 PRINTF(0)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity, 74 this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z); 73 PRINTF(0)( "Enabling Fog Effect, 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); 75 74 76 75 glEnable(GL_FOG); -
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc
r7520 r7523 32 32 33 33 world_vector vertices[NUM_PANELS*4] = { 34 {-5 .0, -10.0, 0.0},{5.0, -10.0, 0.0},{5.0, 0.0, 0.0},{-5.0, 0.0, 0.0},35 {-5 .0, -10.0, 10.0},{-5.0, -10.0, 0.0},{-5.0, 0.0, 0.0},{-5.0, 0.0, 10.0},36 {-5 .0, -10.0, 20.0},{-5.0, -10.0, 10.0},{-5.0, 0.0, 10.0},{-5.0, 0.0, 20.0},37 {5 .0, -10.0, 0.0},{5.0, -10.0, 10.0},{5.0, 0.0, 10.0},{5.0, 0.0, 0.0},38 {5 .0, -10.0, 10.0},{5.0, -10.0, 20.0},{5.0, 0.0, 20.0},{5.0, 0.0, 10.0},39 {-5 .0, -10.0, 10.0},{5.0, -10.0, 10.0},{5.0, -10.0, 0.0},{-5.0, -10.0, 0.0}34 {-50.0, -60.0, 0.0},{50.0, -60.0, 0.0},{50.0, 0.0, 0.0},{-50.0, 0.0, 0.0}, 35 {-50.0, -60.0, 60.0},{-50.0, -60.0, 0.0},{-50.0, 0.0, 0.0},{-50.0, 0.0, 60.0}, 36 {-50.0, -60.0, 20.0},{-50.0, -60.0, 60.0},{-50.0, 0.0, 60.0},{-50.0, 0.0, 20.0}, 37 {50.0, -60.0, 0.0},{50.0, -60.0, 60.0},{50.0, 0.0, 60.0},{50.0, 0.0, 0.0}, 38 {50.0, -60.0, 60.0},{50.0, -60.0, 20.0},{50.0, 0.0, 20.0},{50.0, 0.0, 60.0}, 39 {-50.0, -60.0, 60.0},{50.0, -60.0, 60.0},{50.0, -60.0, 0.0},{-50.0, -60.0, 0.0} 40 40 }; 41 41 … … 65 65 WeatherEffect::loadParams(root); 66 66 67 LoadParam(root, "test", this, VolFogEffect, test); 67 LoadParam(root, "fog-altitude", this, VolFogEffect, setFogAltitude); 68 LoadParam(root, "fog-color", this, VolFogEffect, startFogColor); 68 69 } 69 70 70 void VolFogEffect::test(int t)71 {72 PRINTF(0)("test\n\n");73 }74 71 75 72 bool VolFogEffect::init() 76 73 { 77 74 PRINTF(0)("Initalize VolFogEffect\n"); 78 75 }; 79 76 … … 82 79 bool VolFogEffect::activate() 83 80 { 84 PRINTF(0)("Activate VolFogEffect\n"); 81 PRINTF(0)( "Enabling Volumetric Fog Effect, altitude: %i, color %f, %f, %f\n", this->fogAltitude, this->colorVector.x, this->colorVector.y, this->colorVector.z); 82 85 83 } 86 84 … … 91 89 92 90 93 void setFogColor(int v)91 void VolFogEffect::setFogColor(int v) 94 92 { 95 93 float z; /* distance of vertex from edge of fog volume */ … … 97 95 98 96 z = 0.0 - vertices[v].y; 99 f = ( 10.0 - z) / (10.0 - 0.0); /* linear fog: f = (end - z)/(end - start) */100 glColor4f( 0.6, 0.2, 0.0, f);97 f = (60.0 - z) / (60.0 - 0.0); /* linear fog: f = (end - z)/(end - start) */ 98 glColor4f(this->colorVector.x, this->colorVector.y, this->colorVector.z, f); 101 99 } 102 100 103 101 // int v; /* store of next vertex ref */ 104 102 105 103 /** … … 108 106 void VolFogEffect::draw() const 109 107 { 110 //int v; /* store of next vertex ref */108 int v; /* store of next vertex ref */ 111 109 int ref; 112 110 … … 118 116 glDepthMask(GL_FALSE); 119 117 120 v = ref * 4;121 122 118 /* restore z buffer writes, set blend params & disable texturing */ 123 119 … … 131 127 v = ref * 4; 132 128 glBegin(GL_QUADS); 133 setFogColor(v);129 //this->setFogColor(v); 134 130 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++; 135 setFogColor(v);131 //this->setFogColor(v); 136 132 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++; 137 setFogColor(v);133 //this->setFogColor(v); 138 134 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); v++; 139 setFogColor(v);135 //this->setFogColor(v); 140 136 glVertex3f(vertices[v].x, vertices[v].y, vertices[v].z); 141 137 glEnd(); -
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.h
r7520 r7523 23 23 virtual bool deactivate(); 24 24 25 void test(int t);26 27 28 25 virtual void draw() const; 29 26 virtual void tick(float dt); 30 27 28 inline void startFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); } 29 inline void setFogAltitude(float altitude) { this->fogAltitude = altitude; } 30 31 31 32 private: 32 void set_fog_colour(int v); 33 33 void setFogColor(int v); 34 GLfloat fogAltitude; 35 Vector colorVector; 34 36 }; 35 37
Note: See TracChangeset
for help on using the changeset viewer.