1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#ifndef __C_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
6
#define __C_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
8
#include "IParticleAnimatedMeshSceneNodeEmitter.h"
16
//! An animated mesh emitter
17
class CParticleAnimatedMeshSceneNodeEmitter : public IParticleAnimatedMeshSceneNodeEmitter
22
CParticleAnimatedMeshSceneNodeEmitter(
23
IAnimatedMeshSceneNode* node,
24
bool useNormalDirection = true,
25
const core::vector3df& direction = core::vector3df(0.0f,0.0f,-1.0f),
26
f32 normalDirectionModifier = 100.0f,
28
bool everyMeshVertex = false,
29
u32 minParticlesPerSecond = 20,
30
u32 maxParticlesPerSecond = 40,
31
const video::SColor& minStartColor = video::SColor(255,0,0,0),
32
const video::SColor& maxStartColor = video::SColor(255,255,255,255),
33
u32 lifeTimeMin = 2000,
34
u32 lifeTimeMax = 4000,
35
s32 maxAngleDegrees = 0,
36
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
37
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f)
40
//! Prepares an array with new particles to emitt into the system
41
//! and returns how much new particles there are.
42
virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray);
44
//! Set Mesh to emit particles from
45
virtual void setAnimatedMeshSceneNode( IAnimatedMeshSceneNode* node );
47
//! Set whether to use vertex normal for direction, or direction specified
48
virtual void setUseNormalDirection( bool useNormalDirection ) { UseNormalDirection = useNormalDirection; }
50
//! Set direction the emitter emits particles
51
virtual void setDirection( const core::vector3df& newDirection ) { Direction = newDirection; }
53
//! Set the amount that the normal is divided by for getting a particles direction
54
virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) { NormalDirectionModifier = normalDirectionModifier; }
56
//! Sets whether to emit min<->max particles for every vertex per second, or to pick
57
//! min<->max vertices every second
58
virtual void setEveryMeshVertex( bool everyMeshVertex ) { EveryMeshVertex = everyMeshVertex; }
60
//! Set minimum number of particles the emitter emits per second
61
virtual void setMinParticlesPerSecond( u32 minPPS ) { MinParticlesPerSecond = minPPS; }
63
//! Set maximum number of particles the emitter emits per second
64
virtual void setMaxParticlesPerSecond( u32 maxPPS ) { MaxParticlesPerSecond = maxPPS; }
66
//! Set minimum starting color for particles
67
virtual void setMinStartColor( const video::SColor& color ) { MinStartColor = color; }
69
//! Set maximum starting color for particles
70
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
72
//! Set the maximum starting size for particles
73
virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
75
//! Set the minimum starting size for particles
76
virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
78
//! Set the minimum particle life-time in milliseconds
79
virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
81
//! Set the maximum particle life-time in milliseconds
82
virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
84
//! Maximal random derivation from the direction
85
virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
87
//! Get Mesh we're emitting particles from
88
virtual const IAnimatedMeshSceneNode* getAnimatedMeshSceneNode() const { return Node; }
90
//! Get whether to use vertex normal for direciton, or direction specified
91
virtual bool isUsingNormalDirection() const { return UseNormalDirection; }
93
//! Get direction the emitter emits particles
94
virtual const core::vector3df& getDirection() const { return Direction; }
96
//! Get the amount that the normal is divided by for getting a particles direction
97
virtual f32 getNormalDirectionModifier() const { return NormalDirectionModifier; }
99
//! Gets whether to emit min<->max particles for every vertex per second, or to pick
100
//! min<->max vertices every second
101
virtual bool getEveryMeshVertex() const { return EveryMeshVertex; }
103
//! Get the minimum number of particles the emitter emits per second
104
virtual u32 getMinParticlesPerSecond() const { return MinParticlesPerSecond; }
106
//! Get the maximum number of particles the emitter emits per second
107
virtual u32 getMaxParticlesPerSecond() const { return MaxParticlesPerSecond; }
109
//! Get the minimum starting color for particles
110
virtual const video::SColor& getMinStartColor() const { return MinStartColor; }
112
//! Get the maximum starting color for particles
113
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
115
//! Get the maximum starting size for particles
116
virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
118
//! Get the minimum starting size for particles
119
virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
121
//! Get the minimum particle life-time in milliseconds
122
virtual u32 getMinLifeTime() const { return MinLifeTime; }
124
//! Get the maximum particle life-time in milliseconds
125
virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
127
//! Maximal random derivation from the direction
128
virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
132
IAnimatedMeshSceneNode* Node;
133
IAnimatedMesh* AnimatedMesh;
134
const IMesh* BaseMesh;
138
core::array<s32> VertexPerMeshBufferList;
140
core::array<SParticle> Particles;
141
core::vector3df Direction;
142
f32 NormalDirectionModifier;
143
u32 MinParticlesPerSecond, MaxParticlesPerSecond;
144
video::SColor MinStartColor, MaxStartColor;
145
u32 MinLifeTime, MaxLifeTime;
146
core::dimension2df MaxStartSize, MinStartSize;
152
bool EveryMeshVertex;
153
bool UseNormalDirection;
156
} // end namespace scene
157
} // end namespace irr
160
#endif // __C_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__