Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7577 in orxonox.OLD for branches/atmospheric_engine/src


Ignore:
Timestamp:
May 10, 2006, 5:20:24 PM (19 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine

Location:
branches/atmospheric_engine/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/defs/glincl.h

    r5279 r7577  
    1717#include <OpenGL/gl.h>
    1818#include <OpenGL/glu.h>
     19
     20//#include <OpenGL/glx.h> // GLX
     21//#include <OpenGL/glext.h> //OpenGL Extensions
     22//#include <OpenGL/glxext.h> // GLX Extensions
     23
    1924#endif
    2025
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc

    r7572 r7577  
    2828#include "parser/tinyxml/tinyxml.h"
    2929#include <algorithm>
     30#include "box_emitter.h"
     31#include "spark_particles.h"
     32
    3033
    3134using namespace std;
     
    3740  this->setClassID(CL_RAIN_EFFECT, "RainEffect");
    3841
    39 //   this->rainMode = GL_LINEAR;
    40 //   this->rainDensity = 0.001f;
    41 //   this->rainStart = 10.0f;
    42 //   this->rainEnd = 1000.0f;
     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);
    4356
    4457  if (root != NULL)
     
    4861}
    4962
    50 
    51 
    5263RainEffect::~RainEffect()
    5364{
     
    6071  WeatherEffect::loadParams(root);
    6172
    62 //   LoadParam(root, "rain-mode", this, RainEffect, setRainMode);
    63 //   LoadParam(root, "rain-density", this, RainEffect, setRainDensity);
    64 //   LoadParam(root, "rain-color", this, RainEffect, setRainColor);
    65 
     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);
    66102
    67103}
     
    70106{}
    71107
    72 
     108SparkParticles* RainEffect::rainParticles = NULL;
    73109
    74110bool RainEffect::activate()
    75111{
    76   PRINTF(0)("Activating Rain Effect\n");
     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");
     114
     115        if (unlikely(RainEffect::rainParticles == NULL))
     116        {
     117                RainEffect::rainParticles = new SparkParticles(10000);
     118                RainEffect::rainParticles->setName("RainParticles");
     119                RainEffect::rainParticles->setLifeSpan(2, 2);
     120                RainEffect::rainParticles->setRadius(0.05, 0.05);
     121                RainEffect::rainParticles->setRadius(0.04, 0.04);
     122                RainEffect::rainParticles->setRadius(0.03, 0.03);
     123                RainEffect::rainParticles->setColor(0, 0, 0, 1, .3);
     124                RainEffect::rainParticles->setColor(0.5, 0.5, 0.5, 1, 0.2);
     125                RainEffect::rainParticles->setColor(0.8, 0.8, 0.2, 0.3, 0.3);
     126                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        }
     143
     144        this->emitter->setSystem(RainEffect::rainParticles);
     145//      this->size = 4.0;
     146
     147        RainEffect::rainParticles->debug();
     148//      this->updateNode(0);
     149        this->emitter->setEmissionRate(5000.0);
     150        this->emitter->setEmissionVelocity(50.0);
     151
     152//      this->setHealth(200);
     153
    77154}
    78155
     
    81158{
    82159  PRINTF(0)("Deactivating Rain Effect\n");
    83 //      glDisable(GL_RAIN);
     160
     161  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
    84168}
    85169
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h

    r7562 r7577  
    88#include "vector.h"
    99#include "particle_system.h"
    10 #include "material.h"
     10//#include "material.h"
     11
     12class SparkParticles;
     13class ParticleEmitter;
    1114
    1215#include "weather_effect.h"
     
    3437
    3538  private:
    36 //     GLint                   rainMode;
     39    static SparkParticles*            rainParticles;
     40    ParticleEmitter*                  emitter;
     41
    3742//     GLfloat                 rainDensity;
    3843//     GLfloat                 rainStart;
  • branches/atmospheric_engine/src/lib/graphics/effects/volfog_effect.cc

    r7568 r7577  
    6060
    6161  // Set fog color
    62   float fogColor[4] = {0.2, 0.2, 0.2, 1.0};
     62  float fogColor[4] = {0.0, 1.0, 0.0, 1.0};
    6363
    6464  /* set up fog params */       
     
    6767  glFogfv(GL_FOG_COLOR, fogColor);                              // Set The Fog Color
    6868  glFogf(GL_FOG_START, 0.0f);                                   // Set The Fog Start
    69   glFogf(GL_FOG_END, 10.0f);                                    // Set The Fog End
     69  glFogf(GL_FOG_END, 1.0f);                                     // Set The Fog End
    7070  glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);  // Set The Fog based on vertice coordinates
    7171  // glHint(GL_FOG_HINT, GL_NICEST);                            // Per-Pixel Fog Calculation
     
    111111        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    112112
     113        /* Enable blending */
    113114        //glEnable(GL_BLEND);
    114115        //glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
     
    126127
    127128        glBegin(GL_QUADS); // Roof
    128                 glFogCoordfEXT(5.0f);   glVertex3f(0.0f, 100.0f,0.0f);
    129                 glFogCoordfEXT(5.0f);   glVertex3f( 100.0f, 100.0f,0.0f);
    130                 glFogCoordfEXT(5.0f);   glVertex3f( 100.0f, 100.0f, 100.0f);
    131                 glFogCoordfEXT(5.0f);   glVertex3f(0.0f, 100.0f, 100.0f);
     129                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f,0.0f);
     130                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f,0.0f);
     131                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f, 100.0f);
     132                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f, 100.0f);
    132133        glEnd();
    133134
     
    135136                glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f,0.0f);
    136137                glFogCoordfEXT(0.0f);   glVertex3f( 100.0f,0.0f,0.0f);
    137                 glFogCoordfEXT(5.0f);   glVertex3f( 100.0f, 100.0f,0.0f);
    138                 glFogCoordfEXT(5.0f);   glVertex3f(0.0f, 100.0f,0.0f);
     138                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f,0.0f);
     139                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f,0.0f);
    139140        glEnd();
    140141
     
    142143                glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f,100.0f);
    143144                glFogCoordfEXT(0.0f);   glVertex3f( 100.0f,0.0f,100.0f);
    144                 glFogCoordfEXT(50.0f);  glVertex3f( 100.0f, 100.0f,100.0f);
    145                 glFogCoordfEXT(50.0f);  glVertex3f(0.0f, 100.0f,100.0f);
     145                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f,100.0f);
     146                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f,100.0f);
    146147        glEnd();
    147148
    148149        glBegin(GL_QUADS); // Right Wall
    149150                glFogCoordfEXT(0.0f);   glVertex3f( 100.0f,0.0f, 100.0f);
    150                 glFogCoordfEXT(5.0f);   glVertex3f( 100.0f, 100.0f, 100.0f);
    151                 glFogCoordfEXT(5.0f);   glVertex3f( 100.0f, 100.0f,0.0f);
     151                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f, 100.0f);
     152                glFogCoordfEXT(1.0f);   glVertex3f( 100.0f, 100.0f,0.0f);
    152153                glFogCoordfEXT(0.0f);   glVertex3f( 100.0f,0.0f,0.0f);
    153154        glEnd();
     
    155156        glBegin(GL_QUADS); // Left Wall
    156157                glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f, 100.0f);
    157                 glFogCoordfEXT(5.0f);   glVertex3f(0.0f, 100.0f, 100.0f);
    158                 glFogCoordfEXT(5.0f);   glVertex3f(0.0f, 100.0f,0.0f);
     158                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f, 100.0f);
     159                glFogCoordfEXT(1.0f);   glVertex3f(0.0f, 100.0f,0.0f);
    159160                glFogCoordfEXT(0.0f);   glVertex3f(0.0f,0.0f,0.0f);
    160161        glEnd();
Note: See TracChangeset for help on using the changeset viewer.