Changeset 7523 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc
- Timestamp:
- May 3, 2006, 5:01:22 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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();
Note: See TracChangeset
for help on using the changeset viewer.