29 #ifndef __X3DPARTICLEEMITTERNODE_H__
30 #define __X3DPARTICLEEMITTERNODE_H__
81 Inst< SFFloat > _speed = 0,
82 Inst< SFFloat > _variation = 0,
83 Inst< SFFloat > _mass = 0,
84 Inst< SFFloat > _surfaceArea = 0,
85 Inst< SFFloat > _angularSpeed = 0 );
88 class H3DAPI_API Particle {
103 Particle(
const Vec3f &_position = Vec3f( 0, 0, 0 ),
104 const Vec3f &_velocity = Vec3f( 0, 0, 0 ),
108 const Vec3f &_rotation_axis = Vec3f( 0, 0, 1 ),
112 surface_area( _surface_area ),
113 position( _position ),
114 velocity( _velocity ),
115 rotation_axis( _rotation_axis ),
116 rotation_angle( _rotation_angle ),
117 angular_speed( _angular_speed ),
118 new_particle(
true ),
120 total_time_to_live(0),
124 distance_from_viewer( 0 ),
125 user_data ( NULL ) {}
127 inline void updateParticle(
const Matrix4f &_global_to_local,
130 Vec3f vp_look_at_local,
132 global_to_local = _global_to_local;
133 position += velocity * dt;
134 rotation_angle += angular_speed *
H3DFloat(dt);
137 distance_from_viewer = vp_look_at_local * ( position - vp_pos_local );
146 if ( f <= keys[0] ) {
150 if ( f >= keys[keys.size()-1] ) {
152 return (
int)keys.size() - 1;
157 for(
size_t i = keys.size()-1;
true; --i) {
159 w = (f-keys[i])/(keys[i+1]-keys[i]);
170 inline bool isDead() {
171 return time_lived > total_time_to_live;
174 bool operator<(
const Particle &p )
const {
175 return distance_from_viewer > p.distance_from_viewer;
183 void setUserData ( UserData* _data ) {
184 user_data.reset ( _data );
187 UserData* getUserData ()
const {
188 return user_data.get();
208 Matrix4f global_to_local;
211 void renderTexCoord(
const Vec3f &tc );
220 std::list< Particle > &particles ) = 0;
281 Particle newParticle(
ParticleSystem *ps,
const Vec3f &pos,
const Vec3f &dir );
Contains the SFFloat field class.
Header file for TextureCoordinate, X3D scene-graph node.
Header file for X3DColorNode, X3D scene-graph node.
Header file for X3DGeometryNode, X3D scene-graph node.
Header file for X3DNode, X3D scene-graph node.
The ParticleSystem node specifies a complete particle system.
Definition: ParticleSystem.h:184
This abstract node type is the base type for all nodes in the X3D system.
Definition: X3DNode.h:65
The X3DParticleEmitterNode abstract type represents any node that is an emitter of particles.
Definition: X3DParticleEmitterNode.h:76
H3DUniquePtr< SFFloat > surfaceArea
The surfaceArea field specifies the surface area of the particle in metres-squared.
Definition: X3DParticleEmitterNode.h:263
H3DUniquePtr< SFFloat > variation
The variation field specifies a multiplier for the randomness that is used to control the range of po...
Definition: X3DParticleEmitterNode.h:244
H3DUniquePtr< SFFloat > mass
The mass field specifies the basic mass of each particle in kilograms.
Definition: X3DParticleEmitterNode.h:252
virtual string defaultXMLContainerField()
Returns the default xml containerField attribute value.
Definition: X3DParticleEmitterNode.h:224
H3DUniquePtr< SFFloat > angularSpeed
The angularSpeed field specifies an initial rotational speed that will be imparted to all particles.
Definition: X3DParticleEmitterNode.h:275
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: X3DParticleEmitterNode.h:278
H3DUniquePtr< SFFloat > speed
The speed field specifies an initial linear speed that will be imparted to all particles.
Definition: X3DParticleEmitterNode.h:235
This abstract node type is the base type for all node types which specify texture coordinates.
Definition: X3DTextureCoordinateNode.h:55
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194