Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4274 in orxonox.OLD


Ignore:
Timestamp:
May 22, 2005, 10:21:00 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: particles emitting from plane and Cube.

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

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/lib/coord/p_node.h

    r4178 r4274  
    7373  /** \returns the Velocity of the Node */
    7474  inline const Vector& getVelocity() const {return this->velocity;}
     75  /** \returns the last calculated coordinate */
     76  inline Vector getLastAbsCoor(void) {return this->lastAbsCoordinate;}
    7577
    7678  void addChild (PNode* pNode, int parentingMode = DEFAULT_MODE);
  • orxonox/branches/physics/src/lib/graphics/particles/particle_emitter.cc

    r4178 r4274  
    3131{
    3232   this->setClassName ("ParticleEmitter");
     33
     34   this->type = EMITTER_DOT;
     35   this->emitterSize = 1.0;
    3336   this->direction = direction;
    3437   this->setSpread(angle);
     
    5053{
    5154  ParticleEngine::getInstance()->removeEmitter(this);
    52  
    5355}
    5456
     
    6971
    7072/* these are Animation interfaces: so you can change spec values as you want */
     73
     74/**
     75   \param type the new Type of this emitter
     76*/
     77void ParticleEmitter::setType(EMITTER_TYPE type)
     78{
     79  this->type = type;
     80}
     81
     82void ParticleEmitter::setSize(float emitterSize)
     83{
     84  this->emitterSize = emitterSize;
     85}
    7186
    7287/**
     
    140155            // this should spread the Particles evenly. if the Emitter is moved around quickly
    141156            Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt;
     157            Vector extension; // the Vector for different fields.
    142158
    143             system->addParticle(this->getAbsCoor() - equalSpread, velocityV);
     159            if (this->type & 2)
     160              {
     161                extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5));
     162                extension = this->getAbsDir().apply(extension);
     163              }
     164            else if (this->type & 8)
     165              {
     166                extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize;
     167              }
     168
     169            system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV);
     170           
    144171          }
    145172      }
  • orxonox/branches/physics/src/lib/graphics/particles/particle_emitter.h

    r4178 r4274  
    1313class ParticleSystem;
    1414
    15 typedef enum EMITTER_TYPE {EMITTER_DOT,
    16                            EMITTER_PLANE,
    17                            EMITTER_SPHERE,
    18                            EMITTER_CUBE};
     15//! The form of the Emitter to emit from
     16typedef enum EMITTER_TYPE {EMITTER_DOT   = 1,
     17                           EMITTER_PLANE = 2,
     18                           EMITTER_SPHERE= 4,
     19                           EMITTER_CUBE  = 8};
    1920
    2021//! A default singleton class.
     
    3233
    3334  /* controlling the behavour: these can be used as Animation interfaces */
     35  void setType(EMITTER_TYPE type);
     36  void setSize(float emitterSize);
    3437  void setEmissionRate(float emissionRate);
    3538  void setSpread(float angle, float randomAngle = 0.0);
     
    3942
    4043 private:
     44  EMITTER_TYPE type;    //!< The type of emitter this is
     45  float emitterSize;    //!< The size of the emitter (not for EMITTER_DOT)
    4146  Vector direction;     //!< emition direction
    4247  float angle;          //!< max angle from the direction of the emitter
  • orxonox/branches/physics/src/story_entities/world.cc

    r4223 r4274  
    499499  // Creating a Test Particle Emitter
    500500  ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 400, .5);
     501  emitter->setType(EMITTER_CUBE);
     502  emitter->setSize(20);
    501503  emitter->setParent(this->localPlayer);
    502504  emitter->setRelCoor(Vector(0,-3,0));
Note: See TracChangeset for help on using the changeset viewer.