Changeset 6873 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Jan 30, 2006, 10:43:00 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r6815 r6873 139 139 140 140 LoadParam(root, "parent", this, PNode, setParent) 141 .describe("the Name of the Parent ofthis PNode");141 .describe("the Name of the Parent to set for this PNode"); 142 142 143 143 LoadParam(root, "parent-mode", this, PNode, setParentMode) … … 355 355 * main difference is, that here you give a directional vector, that will be translated into a Quaternion 356 356 */ 357 void PNode::setRelDir (float x, float y, float z)358 { 359 this->setRelDir(Quaternion( Vector(x,y,z), Vector(0,1,0)));357 void PNode::setRelDir (float angle, float x, float y, float z) 358 { 359 this->setRelDir(Quaternion(angle, Vector(x,y,z))); 360 360 } 361 361 … … 386 386 * main difference is, that here you give a directional vector, that will be translated into a Quaternion 387 387 */ 388 void PNode::setRelDirSoft(float x, float y, float z, float bias)389 { 390 this->setRelDirSoft(Quaternion( Vector(x,y,z), Vector(0,1,0)), bias);388 void PNode::setRelDirSoft(float angle, float x, float y, float z, float bias) 389 { 390 this->setRelDirSoft(Quaternion(angle, Vector(x,y,z)), bias); 391 391 } 392 392 … … 421 421 * main difference is, that here you give a directional vector, that will be translated into a Quaternion 422 422 */ 423 void PNode::setAbsDir (float x, float y, float z)424 { 425 this->setAbsDir(Quaternion( Vector(x,y,z), Vector(0,1,0)));423 void PNode::setAbsDir (float angle, float x, float y, float z) 424 { 425 this->setAbsDir(Quaternion(angle, Vector(x,y,z))); 426 426 } 427 427 … … 456 456 * main difference is, that here you give a directional vector, that will be translated into a Quaternion 457 457 */ 458 void PNode::setAbsDirSoft (float x, float y, float z, float bias)459 { 460 this->setAbsDirSoft(Quaternion( Vector(x,y,z), Vector(0,1,0)), bias);458 void PNode::setAbsDirSoft (float angle, float x, float y, float z, float bias) 459 { 460 this->setAbsDirSoft(Quaternion(angle, Vector(x,y,z)), bias); 461 461 } 462 462 … … 1319 1319 fabs( rotz - absDirection.v.z ) > __OFFSET_ROT ) 1320 1320 return true; 1321 1321 1322 1322 return false; 1323 1323 } -
trunk/src/lib/coord/p_node.h
r6815 r6873 115 115 // ROTATION // 116 116 void setRelDir (const Quaternion& relDir); 117 void setRelDir (float x, float y, float z);117 void setRelDir (float angle, float x, float y, float z); 118 118 void setRelDirSoft(const Quaternion& relDirSoft, float bias = 1.0); 119 void setRelDirSoft(float x, float y, float z, float bias = 1.0);119 void setRelDirSoft(float angle, float x, float y, float z, float bias = 1.0); 120 120 /** @returns the relative Direction */ 121 121 inline const Quaternion& getRelDir () const { return this->prevRelDirection; }; … … 125 125 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; 126 126 void setAbsDir (const Quaternion& absDir); 127 void setAbsDir (float x, float y, float z);127 void setAbsDir (float angle, float x, float y, float z); 128 128 void setAbsDirSoft(const Quaternion& absDirSoft, float bias = 1.0); 129 void setAbsDirSoft(float x, float y, float z, float bias = 1.0);129 void setAbsDirSoft(float angle, float x, float y, float z, float bias = 1.0); 130 130 void shiftDir (const Quaternion& shift); 131 131 /** @returns the absolute Direction */ -
trunk/src/lib/particles/Makefile.am
r6823 r6873 8 8 dot_emitter.cc \ 9 9 box_emitter.cc \ 10 plane_emitter.cc \ 10 11 \ 11 12 particle_system.cc \ … … 22 23 dot_emitter.h \ 23 24 box_emitter.h \ 25 plane_emitter.h \ 24 26 \ 25 27 particle_system.h \ -
trunk/src/lib/particles/plane_emitter.cc
r6870 r6873 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS 17 17 18 #include " box_emitter.h"18 #include "plane_emitter.h" 19 19 20 20 #include "particle_system.h" … … 28 28 29 29 30 CREATE_FACTORY( BoxEmitter, CL_BOX_EMITTER);30 CREATE_FACTORY(PlaneEmitter, CL_PLANE_EMITTER); 31 31 32 32 /** 33 33 * standard constructor 34 34 */ 35 BoxEmitter::BoxEmitter(const Vector& size, float emissionRate, float velocity, float angle)35 PlaneEmitter::PlaneEmitter(const Vector2D& size, float emissionRate, float velocity, float angle) 36 36 : ParticleEmitter(emissionRate, velocity, angle) 37 37 { … … 41 41 42 42 /** 43 * constructs and loads a BoxEmitter from a XML-element43 * constructs and loads a PlaneEmitter from a XML-element 44 44 * @param root the XML-element to load from 45 45 */ 46 BoxEmitter::BoxEmitter(const TiXmlElement* root)46 PlaneEmitter::PlaneEmitter(const TiXmlElement* root) 47 47 : ParticleEmitter() 48 48 { … … 58 58 removes the EmitterSystem from the ParticleEngine 59 59 */ 60 BoxEmitter::~BoxEmitter ()60 PlaneEmitter::~PlaneEmitter () 61 61 { 62 62 this->setSystem(NULL); … … 66 66 @brief initializes default values of a ParitcleEmitter 67 67 */ 68 void BoxEmitter::init()68 void PlaneEmitter::init() 69 69 { 70 this->setClassID(CL_ BOX_EMITTER, "BoxEmitter");71 this->setSize(1.0f, 1.0f,1.0f);70 this->setClassID(CL_PLANE_EMITTER, "PlaneEmitter"); 71 this->setSize(1.0f, 1.0f); 72 72 } 73 73 74 void BoxEmitter::loadParams(const TiXmlElement* root)74 void PlaneEmitter::loadParams(const TiXmlElement* root) 75 75 { 76 76 ParticleEmitter::loadParams(root); 77 77 78 LoadParam(root, "size", this, BoxEmitter, setSize)79 .describe("The Size of the BoxEmitter: x, y, z")80 .defaultValues( 3, 1.0f,1.0f,1.0f);78 LoadParam(root, "size", this, PlaneEmitter, setSize) 79 .describe("The Size of the PlaneEmitter: x, y") 80 .defaultValues(2, 1.0f,1.0f); 81 81 } 82 82 83 void BoxEmitter::setSize(float x, float y, float z)83 void PlaneEmitter::setSize(float x, float y) 84 84 { 85 this->size = Vector (x,y,z);85 this->size = Vector2D(x, y); 86 86 } 87 87 88 88 89 void BoxEmitter::emitParticles(unsigned int count) const89 void PlaneEmitter::emitParticles(unsigned int count) const 90 90 { 91 91 Vector inheritVelocity = this->getVelocity() * this->inheritSpeed; 92 92 93 93 Vector xDir = this->getAbsDirX() * this->size.x; 94 Vector yDir = this->getAbsDir Y() * this->size.y;95 Vector zDir = this->getAbsDir Z() * this->size.z;94 Vector yDir = this->getAbsDirZ() * this->size.y; 95 Vector zDir = this->getAbsDirY(); 96 96 97 97 for (unsigned int i = 0; i < count; i++) … … 99 99 Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2); 100 100 randDir.normalize(); 101 randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply( this->getAbsDirX());101 randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(zDir); 102 102 Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity; 103 103 104 Vector box= this->getAbsCoor() +104 Vector plane = this->getAbsCoor() + 105 105 xDir * ((float)rand()/RAND_MAX -.5) + 106 yDir * ((float)rand()/RAND_MAX -.5) + 107 zDir * ((float)rand()/RAND_MAX -.5); 106 yDir * ((float)rand()/RAND_MAX -.5); 108 107 109 108 // ROTATIONAL CALCULATION (this must not be done for all types of particles.) … … 113 112 Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir); 114 113 115 this->getSystem()->addParticle( box, velocityV, orient, moment);114 this->getSystem()->addParticle(plane, velocityV, orient, moment); 116 115 117 116 } -
trunk/src/lib/particles/plane_emitter.h
r6870 r6873 1 1 /*! 2 * @file box_emitter.h3 * Definition of a BoxEmitter2 * @file plane_emitter.h 3 * Definition of a PlaneEmitter 4 4 */ 5 5 6 #ifndef _ BOX_EMITTER_H7 #define _ BOX_EMITTER_H6 #ifndef _PLANE_EMITTER_H 7 #define _PLANE_EMITTER_H 8 8 9 9 #include "particle_emitter.h" 10 10 11 # define BOX_EMITTER_DEFAULT_SIZE Vector(1.0f, 1.0f, 1.0f)11 #include "vector2D.h" 12 12 13 //! A class to handle a Box Emitter. 13 #define PLANE_EMITTER_DEFAULT_SIZE Vector2D(1.0f, 1.0f) 14 15 //! A class to handle a Plane Emitter. 14 16 /** 15 * A BoxEmitter is a special kind of emitter, that has the (underlying) PNode16 * at its center, and from there on is a Boxin the Direction of the PNode17 * out around size in the corresponding directions 17 * A Plane Emitter is a special kind of emitter, that has the (underlying) PNode 18 * at its center, and from there on is a Plane in the Direction of the PNode 19 * out around size in the corresponding directions in x and z 18 20 */ 19 class BoxEmitter : public ParticleEmitter21 class PlaneEmitter : public ParticleEmitter 20 22 { 21 23 friend class ParticleSystem; 22 24 public: 23 BoxEmitter(const Vector& size = BOX_EMITTER_DEFAULT_SIZE,25 PlaneEmitter(const Vector2D& size = PLANE_EMITTER_DEFAULT_SIZE, 24 26 float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE, 25 27 float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY, 26 28 float angle = PARTICLE_EMITTER_DEFAULT_SPREAD); 27 BoxEmitter(const TiXmlElement* root);28 virtual ~ BoxEmitter();29 PlaneEmitter(const TiXmlElement* root); 30 virtual ~PlaneEmitter(); 29 31 30 32 virtual void loadParams(const TiXmlElement* root); 31 33 32 void setSize(float x, float y , float z);33 void setSize(const Vector & size) { this->setSize(size.x, size.y, size.z); };34 void setSize(float x, float y); 35 void setSize(const Vector2D& size) { this->setSize(size.x, size.y); }; 34 36 35 37 protected: … … 40 42 41 43 private: 42 Vector size;44 Vector2D size; 43 45 }; 44 46 45 #endif /* _ BOX_EMITTER_H */47 #endif /* _PLANE_EMITTER_H */
Note: See TracChangeset
for help on using the changeset viewer.