Changeset 7628 in orxonox.OLD for branches/atmospheric_engine/src/lib
- Timestamp:
- May 16, 2006, 11:41:25 AM (19 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r7523 r7628 71 71 bool FogEffect::activate() 72 72 { 73 PRINTF(0)( "Enabling Fog 73 PRINTF(0)( "Enabling FogEffect, 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); 74 74 75 75 glEnable(GL_FOG); … … 93 93 bool FogEffect::deactivate() 94 94 { 95 PRINTF(0)("Deactivating Fog 95 PRINTF(0)("Deactivating FogEffect\n"); 96 96 glDisable(GL_FOG); 97 97 } -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r7577 r7628 19 19 20 20 #include "glincl.h" 21 #include "debug.h" 21 22 22 // *****23 24 #include "material.h"25 23 #include "state.h" 26 #include "shell_command.h" 24 #include "spark_particles.h" 25 #include "plane_emitter.h" 27 26 28 27 #include "parser/tinyxml/tinyxml.h" 29 #include <algorithm>30 #include "box_emitter.h"31 #include "spark_particles.h"32 28 29 //SHELL_COMMAND(activate, RainEffect, activateRain); 30 //SHELL_COMMAND(deactivate, RainEffect, deactivateRain); 33 31 34 32 using namespace std; … … 40 38 this->setClassID(CL_RAIN_EFFECT, "RainEffect"); 41 39 42 // BoxEmitter::BoxEmitter(const Vector& size, float emissionRate, float velocity, float angle)43 44 // <name>RainEmitter</name>45 // <rel-coor>-1200, 300, 0</rel-coor>46 // <rel-dir>3.1412, 0, 0, 1</rel-dir>47 // <spread>0,.3</spread>48 // <emission-velocity>500,50</emission-velocity>49 // <size>1000, 1000</size>50 // <rate>5000</rate>51 52 this->emitter = new BoxEmitter(Vector(1000, 300, 100), 20000, 1000, M_2_PI);53 this->emitter->setRelCoor(100, 0, 0);54 // this->emitter->setParent(this);55 this->emitter->setSpread(0, 0.3);56 57 40 if (root != NULL) 58 41 this->loadParams(root); 42 43 this->init(); 59 44 60 45 this->activate(); … … 66 51 } 67 52 68 69 53 void RainEffect::loadParams(const TiXmlElement* root) 70 54 { 71 55 WeatherEffect::loadParams(root); 72 56 73 // LoadParam(root, "rel-coor", this, RainEffect, setRainMode); 74 // 75 // LoadParam(root, "rate", this, RainEffect, setRainColor); 76 // LoadParam(root, "velocity", this, RainEffect, setRainColor); 77 // LoadParam(root, "angle", this, RainEffect, setRainColor); 78 // 79 // LoadParam(root, "spread", this, RainEffect, setRainColor); 80 81 // BoxEmitter::BoxEmitter(const Vector& size, float emissionRate, float velocity, float angle) 82 83 this->emitter = new BoxEmitter(Vector(0, 1000, 0), 20000, 4000, 1); 84 this->emitter->setRelCoor(0, 100, 0); 85 // this->emitter->setParent(this); 86 this->emitter->setSpread(0, 0.3); 87 88 // LOAD_PARAM_START_CYCLE(root, element); 89 // { 90 // element->ToText(); 91 // // PER-PARTICLE-ATTRIBUTES: 92 // LoadParam_CYCLE(element, "radius", this, ParticleSystem, setRadius) 93 // .describe("The Radius of each particle over time (TimeIndex [0-1], radius at TimeIndex, randomRadius at TimeIndex)"); 94 // 95 // LoadParam_CYCLE(element, "mass", this, ParticleSystem, setMass) 96 // .describe("The Mass of each particle over time (TimeIndex: [0-1], mass at TimeIndex, randomMass at TimeIndex)"); 97 // 98 // LoadParam_CYCLE(element, "color", this, ParticleSystem, setColor) 99 // .describe("The Color of each particle over time (TimeIndex: [0-1], red: [0-1], green: [0-1], blue: [0-1], alpha: [0-1])"); 100 // } 101 // LOAD_PARAM_END_CYCLE(element); 102 57 LoadParam(root, "coord", this, RainEffect, setRainCoord); 58 LoadParam(root, "size", this, RainEffect, setRainSize); 59 LoadParam(root, "rate", this, RainEffect, setRainRate); 60 LoadParam(root, "velocity", this, RainEffect, setRainVelocity); 103 61 } 104 62 63 105 64 bool RainEffect::init() 106 {} 65 { 66 this->emitter = new PlaneEmitter(this->rainSize); 67 } 68 107 69 108 70 SparkParticles* RainEffect::rainParticles = NULL; … … 110 72 bool RainEffect::activate() 111 73 { 112 // PRINTF(0)( "Enabling Rain Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->rainMode, this->rainDensity, this->rainStart, this->rainEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z); 113 PRINTF(0)("Activating Rain Effect\n"); 74 PRINTF(0)( "Activating RainEffect, coord: %f, %f, %f, size: %f, %f, rate: %f, velocity: %f\n", this->rainCoord.x, this->rainCoord.y, this->rainCoord.z, this->rainSize.x, this-> rainSize.y, this->rainRate, this->rainVelocity ); 114 75 115 76 if (unlikely(RainEffect::rainParticles == NULL)) … … 125 86 RainEffect::rainParticles->setColor(0.8, 0.8, 0.2, 0.3, 0.3); 126 87 RainEffect::rainParticles->setColor(1, 0.5, 0.5, 1, 0); 127 128 // <life-span>2,2</life-span>129 // <radius>0, 0.05, 0.05</radius>130 // <radius>1, 0.05, 0.05</radius>131 // <mass>0,1, .05</mass>132 // <color>0, 0, 0, 1, .3</color>133 // <color>.5, .5, .5, 1, .2</color>134 // <color>1,0.5, .5,1, .0</color>135 // <precache>2</precache>136 // <emitters>137 // <PlaneEmitter>138 139 // </PlaneEmitter>140 // </emitters>141 142 88 } 143 89 144 90 this->emitter->setSystem(RainEffect::rainParticles); 145 // this->size = 4.0;146 91 147 92 RainEffect::rainParticles->debug(); 148 // this->updateNode(0);149 this->emitter->setEmissionRate(5000.0);150 this->emitter->setEmissionVelocity(50.0);151 93 152 // this->setHealth(200);94 this->emitter->setRelCoor(this->rainCoord); 153 95 96 this->emitter->setEmissionRate(this->rainRate); 97 this->emitter->setEmissionVelocity(-this->rainVelocity); 98 99 this->emitter->setSpread(0, .3); 154 100 } 155 101 … … 157 103 bool RainEffect::deactivate() 158 104 { 159 PRINTF(0)("Deactivating Rain 105 PRINTF(0)("Deactivating RainEffect\n"); 160 106 161 107 this->emitter->setSystem(NULL); 162 // this->lifeCycle = 0.0;163 // this->toList(OM_NULL);164 165 // GarbageCollector::getInstance()->collect(this);166 // this->toList(OM_DEAD);167 168 108 } 169 170 void RainEffect::draw() const171 {172 // Particle* drawPart = ParticleSystem::particles;173 174 // glDepthMask(GL_FALSE);175 // glPushAttrib(GL_ENABLE_BIT);176 //177 // glDisable(GL_LIGHTING);178 // glDisable(GL_TEXTURE_2D);179 //180 // glEnable(GL_LINE_SMOOTH);181 // glEnable(GL_BLEND);182 // glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);183 //184 // glLineWidth(2.0);185 // glBegin(GL_LINES);186 // while (likely(drawPart != NULL))187 // {188 // // printf("%f %f %f %f\n", drawPart->color[0], drawPart->color[1], drawPart->color[2], drawPart->color[3]);189 // glColor4fv(drawPart->color);190 // glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);191 // glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius,192 // drawPart->position.y - drawPart->velocity.y * drawPart->radius,193 // drawPart->position.z - drawPart->velocity.z * drawPart->radius);194 // drawPart = drawPart->next;195 // }196 // glEnd();197 //198 // glDepthMask(GL_TRUE);199 // glPopAttrib();200 } -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h
r7577 r7628 7 7 8 8 #include "vector.h" 9 #include "vector2D.h" 10 9 11 #include "particle_system.h" 10 //#include "material.h"11 12 12 13 class SparkParticles; 13 class P articleEmitter;14 class PlainEmitter; 14 15 15 16 #include "weather_effect.h" … … 29 30 virtual bool deactivate(); 30 31 31 virtual void draw() const; 32 33 // inline void setRainMode(const std::string& mode) { this->rainMode = this->stringToRainMode(mode); } 34 // inline void setRainDensity(float density) { this->rainDensity = density; } 35 // inline void setRainRange(float start, float end) { this->rainStart = start; this->rainEnd = end; } 36 // inline void setRainColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); } 32 inline void setRainCoord(float x, float y, float z) { this->rainCoord = Vector(x, y, z); } 33 inline void setRainSize(float x, float y) { this->rainSize = Vector2D(x, y); } 34 inline void setRainRate(float rate) { this->rainRate = rate;} 35 inline void setRainVelocity(float velocity) { this->rainVelocity = velocity; } 37 36 38 37 private: … … 40 39 ParticleEmitter* emitter; 41 40 42 // GLfloat rainDensity;43 // GLfloat rainStart;44 // GLfloat rainEnd;45 // Vector colorVector;41 Vector rainCoord; 42 Vector2D rainSize; 43 GLfloat rainRate; 44 GLfloat rainVelocity; 46 45 }; 47 46 -
branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.cc
r7576 r7628 41 41 42 42 this->init(); 43 43 44 44 this->activate(); 45 45 } … … 73 73 bool SnowEffect::activate() 74 74 { 75 PRINTF(0)("Activating Snow 75 PRINTF(0)("Activating SnowEffect\n"); 76 76 77 77 SnowEffect::snowParticles = new SpriteParticles(10000); … … 101 101 bool SnowEffect::deactivate() 102 102 { 103 PRINTF(0)("Deactivating Snow 103 PRINTF(0)("Deactivating SnowEffect\n"); 104 104 105 105 this->emitter->setSystem(NULL);
Note: See TracChangeset
for help on using the changeset viewer.