Changeset 7530 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics
- Timestamp:
- May 4, 2006, 12:31:54 AM (19 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc
r7523 r7530 22 22 #include "shell_command.h" 23 23 24 #define NUM_PANELS 6 /* number of panels in scene */ 24 /*#define NUM_PANELS 6; 25 25 26 26 typedef struct … … 29 29 float y; 30 30 float z; 31 } world_vector; /* vertex data */31 } world_vector; 32 32 33 33 world_vector vertices[NUM_PANELS*4] = { … … 38 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 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 42 42 using namespace std; … … 65 65 WeatherEffect::loadParams(root); 66 66 67 LoadParam(root, "fog-altitude", this, VolFogEffect, setFogAltitude); 68 LoadParam(root, "fog-color", this, VolFogEffect, startFogColor); 67 //LoadParam(root, "fog-altitude", this, VolFogEffect, setFogAltitude); 68 //LoadParam(root, "fog-color", this, VolFogEffect, startFogColor); 69 LoadParam(root, "test", this, VolFogEffect, test); 69 70 } 70 71 72 void VolFogEffect::test(int t) 73 { 74 PRINTF(0)("Test: %i\n", t); 75 } 71 76 72 77 bool VolFogEffect::init() … … 79 84 bool VolFogEffect::activate() 80 85 { 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);86 //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 87 88 PRINTF(0)("Activate VolFogEffect\n"); 83 89 } 84 90 … … 88 94 } 89 95 90 96 /* 91 97 void VolFogEffect::setFogColor(int v) 92 98 { 93 float z; /* distance of vertex from edge of fog volume */94 float f; /* fog factor */99 float z; 100 float f; 95 101 96 102 z = 0.0 - vertices[v].y; 97 f = (60.0 - z) / (60.0 - 0.0); /* linear fog: f = (end - z)/(end - start) */103 f = (60.0 - z) / (60.0 - 0.0); 98 104 glColor4f(this->colorVector.x, this->colorVector.y, this->colorVector.z, f); 99 105 } 100 101 // int v; /* store of next vertex ref */ 106 */ 102 107 103 108 /** … … 106 111 void VolFogEffect::draw() const 107 112 { 108 int v; /* store of next vertex ref */ 113 114 /*int v; // store of next vertex ref 109 115 int ref; 110 116 … … 113 119 for (ref=0; ref<NUM_PANELS; ref++) { 114 120 115 / * disable writes to z buffer (if fog area) */121 // disable writes to z buffer (if fog area) 116 122 glDepthMask(GL_FALSE); 117 123 118 / * restore z buffer writes, set blend params & disable texturing */124 // restore z buffer writes, set blend params & disable texturing 119 125 120 126 glDepthMask(GL_TRUE); … … 123 129 glDisable(GL_TEXTURE_2D); 124 130 125 / * draw the fog panel */131 // draw the fog panel 126 132 127 133 v = ref * 4; … … 137 143 glEnd(); 138 144 139 / * restore rendering state */145 // restore rendering state 140 146 141 147 glEnable(GL_TEXTURE_2D); 142 148 glDisable(GL_BLEND); 143 } 144 145 149 }*/ 146 150 } 147 151 … … 153 157 void VolFogEffect::tick(float dt) 154 158 { 155 PRINTF(0)("TICK VolFogEffect\n");156 159 } -
branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.h
r7523 r7530 26 26 virtual void tick(float dt); 27 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 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 void test(int t); 31 31 32 32 private: 33 void setFogColor(int v);34 GLfloat fogAltitude;35 Vector colorVector;33 //void setFogColor(int v); 34 //GLfloat fogAltitude; 35 //Vector colorVector; 36 36 }; 37 37
Note: See TracChangeset
for help on using the changeset viewer.