Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3942 in orxonox.OLD for orxonox/branches


Ignore:
Timestamp:
Apr 23, 2005, 1:28:24 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: minor patches, and now it renders particle-faces

Location:
orxonox/branches/particleEngine/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/particleEngine/src/defs/debug.h

    r3934 r3942  
    6363#define DEBUG_MODULE_LOAD               0
    6464
    65 #define DEBUG_MODULE_IMPORTER           1
     65#define DEBUG_MODULE_IMPORTER           3
    6666#define DEBUG_MODULE_TRACK_MANAGER      0
    6767#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r3938 r3942  
    2121#include "particle_engine.h"
    2222#include "compiler.h"
     23#include "material.h"
    2324
    2425using namespace std;
    25 
    2626
    2727/**
     
    4343   this->setLifeSpan(.1);
    4444   this->setInheritSpeed(0);
    45 
     45   this->glID = NULL;
     46   this->setRadius(1.0, 1.0, 0.0);
     47   this->setType(PARTICLE_SPRITE, 1);
    4648   ParticleEngine::getInstance()->addSystem(this);
    4749}
     
    5860}
    5961
     62
     63void ParticleSystem::setType(PARTICLE_TYPE particleType, int count)
     64{
     65  this->particleType = particleType;
     66  this->dialectCount = count;
     67  if (glID != NULL)
     68    delete glID;
     69
     70  glID = new GLuint[count];
     71  for (int i = 0; i< count; i++)
     72    glID[i] = 0;
     73
     74  glID[0] = glGenLists(count);
     75 
     76  material = new Material("transperencyMap");
     77  material->setDiffuseMap("pictures/radialTransparency.jpg");
     78 
     79  glNewList(glID[0], GL_COMPILE);
     80  glBegin(GL_TRIANGLE_STRIP);
     81  glTexCoord2f(1, 1);
     82  glVertex3f(0.0, 1.0, 1.0);
     83  glTexCoord2f(1, 0);
     84  glVertex3f(0.0, 1.0, 0.0);
     85  glTexCoord2f(0, 1);
     86  glVertex3f(0.0, 0.0, 1.0);
     87  glTexCoord2f(0, 0);
     88  glVertex3f(0.0, 0.0, 0.0);
     89  glEnd();
     90  glEndList();
     91
     92 
     93
     94}
     95
    6096// setting properties
    6197void ParticleSystem::setMaterial(Material* material)
     
    6399  this->material = material;
    64100}
     101
    65102
    66103
     
    90127}
    91128
    92 void ParticleSystem::setRadius(float startRadius, float endRadius, float randomRadius)
     129void ParticleSystem::setRadius(float startRadius, float endRadius, float randomStartRadius, float randomEndRadius)
    93130{
    94131  this->startRadius = startRadius;
    95132  this->endRadius = endRadius;
    96   this->randomRadius = randomRadius;
     133  this->randomStartRadius = randomStartRadius;
     134  this->randomEndRadius = randomEndRadius;
    97135}
    98136
     
    117155     
    118156      tickPart->position = tickPart->position + tickPart->velocity;
    119       tickPart->radius + tickPart->radiusIt * dt;
     157      tickPart->radius += tickPart->radiusIt * dt;
     158
    120159      // many more to come
    121160
     
    153192void ParticleSystem::draw(void)
    154193{
     194  //  material->select();
     195
     196
     197  glMatrixMode(GL_MODELVIEW);
     198 
    155199  Particle* drawPart = particles;
    156200  if (likely(drawPart != NULL))
     
    160204        {
    161205          // draw in DOT mode
    162           glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
     206          glPushMatrix();
     207          glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z);
     208          glScalef(drawPart->radius, drawPart->radius, drawPart->radius);
     209          glCallList(*this->glID);
    163210         
    164          
     211          //              glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
    165212          drawPart = drawPart->next;
     213          glPopMatrix();
    166214        }
    167215      glEnd();
     
    193241      //  particle->rotation = ; //! \todo rotation is once again something to be done.
    194242      particles->mass = this->initialMass + (random()/RAND_MAX -.5)* this->randomInitialMass;
    195       particles->radius = this->startRadius + (random()/RAND_MAX-.5)*this->randomRadius;
     243      particles->radius = this->startRadius + (random()/RAND_MAX-.5)*this->randomStartRadius;
    196244     
    197       particles->radiusIt = (this->endRadius + (random()/RAND_MAX-.5)*this->randomRadius - particles->radius) / particles->timeToLive;
     245      particles->radiusIt = (this->endRadius + (random()/RAND_MAX-.5)*this->randomEndRadius - particles->radius) / particles->timeToLive;
    198246
    199247      ++this->count;
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h

    r3938 r3942  
    1818                            PARTICLE_PRIMITIVE};
    1919
    20 #define PARTICLE_DEFAULT_MAX_COUNT 200         //!< a default count of particles in the system.
    21 #define PARTICLE_DEFAULT_TYPE  PARTICLE_SPRITE //!< A default type of the system.
     20#define PARTICLE_DEFAULT_MAX_COUNT    200               //!< a default count of particles in the system.
     21#define PARTICLE_DEFAULT_TYPE         PARTICLE_SPRITE  //!< A default type of the system.
    2222
    2323// FORWARD DEFINITION
     
    4848  virtual ~ParticleSystem();
    4949
     50  void setType(PARTICLE_TYPE particleType, int count = 0);
    5051  void setMaterial(Material* material);
    5152  void setInheritSpeed(float value);
    5253  void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0);
    53   void setRadius(float startRadius, float endRadius, float randomRadius = 0.0);
     54  void setRadius(float startRadius, float endRadius, float randomStartRadius = 0.0, float randomEndRadius = 0.0);
    5455  void setConserve(float conserve);
    5556  void setMass(float mass, float randomMass);
     
    6465  float startRadius;
    6566  float endRadius;
    66   float randomRadius;
     67  float randomStartRadius;
     68  float randomEndRadius;
    6769  float initialMass;
    6870  float randomInitialMass;
     
    7678  Particle* particles;       //!< A list of particles of this System.
    7779
     80  GLuint* glID;              //!< A List of different gl-List-ID's
     81  GLuint dialectCount;       //!< How many different types of particles are there in the Particle System
    7882
    7983  void addParticle(Vector position, Vector velocity, unsigned int data = 0);
  • orxonox/branches/particleEngine/src/story_entities/world.cc

    r3938 r3942  
    379379            ParticleEmitter* testEmitter,* testEmitter2;
    380380            ParticleSystem* testSystem;
    381             testEmitter = new ParticleEmitter(Vector(-1,0,0), M_PI_2, 1200.0, 1);
     381            testEmitter = new ParticleEmitter(Vector(-1,0,0), M_PI_2, 1200.0, .5);
    382382            testEmitter->setParent(localPlayer);
    383             testEmitter2 = new ParticleEmitter(Vector(-1,0,0), .1, 1200, 1);
    384             testEmitter2->setParent(tn);
     383            testEmitter->setRelCoor(Vector(-3, 0, 0));
    385384
    386385            testSystem = new ParticleSystem(100000);
    387             testSystem->setLifeSpan(3);
     386            testSystem->setLifeSpan(1, .8);
     387            testSystem->setRadius(1.0, 0.0, .5);
    388388            testSystem->setConserve(.8);
    389389            testSystem->setInheritSpeed(1);
    390390
    391391            ParticleEngine::getInstance()->addConnection(testEmitter, testSystem);
    392             ParticleEngine::getInstance()->addConnection(testEmitter2, testSystem);
    393392
    394393            break;
Note: See TracChangeset for help on using the changeset viewer.