aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8.1/source/Irrlicht/CParticleMeshEmitter.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8.1/source/Irrlicht/CParticleMeshEmitter.h')
-rw-r--r--libraries/irrlicht-1.8.1/source/Irrlicht/CParticleMeshEmitter.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8.1/source/Irrlicht/CParticleMeshEmitter.h b/libraries/irrlicht-1.8.1/source/Irrlicht/CParticleMeshEmitter.h
new file mode 100644
index 0000000..af00031
--- /dev/null
+++ b/libraries/irrlicht-1.8.1/source/Irrlicht/CParticleMeshEmitter.h
@@ -0,0 +1,160 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_PARTICLE_MESH_EMITTER_H_INCLUDED__
6#define __C_PARTICLE_MESH_EMITTER_H_INCLUDED__
7
8#include "IParticleMeshEmitter.h"
9#include "irrArray.h"
10#include "aabbox3d.h"
11#include "IMeshBuffer.h"
12
13namespace irr
14{
15namespace scene
16{
17
18//! A default box emitter
19class CParticleMeshEmitter : public IParticleMeshEmitter
20{
21public:
22
23 //! constructor
24 CParticleMeshEmitter(
25 IMesh* mesh, bool useNormalDirection = true,
26 const core::vector3df& direction = core::vector3df(0.0f,0.0f,0.0f),
27 f32 normalDirectionModifier = 100.0f,
28 s32 mbNumber = -1,
29 bool everyMeshVertex = false,
30 u32 minParticlesPerSecond = 20,
31 u32 maxParticlesPerSecond = 40,
32 const video::SColor& minStartColor = video::SColor(255,0,0,0),
33 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
34 u32 lifeTimeMin = 2000,
35 u32 lifeTimeMax = 4000,
36 s32 maxAngleDegrees = 0,
37 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
38 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f)
39 );
40
41 //! Prepares an array with new particles to emitt into the system
42 //! and returns how much new particles there are.
43 virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray);
44
45 //! Set Mesh to emit particles from
46 virtual void setMesh( IMesh* mesh );
47
48 //! Set whether to use vertex normal for direction, or direction specified
49 virtual void setUseNormalDirection( bool useNormalDirection ) { UseNormalDirection = useNormalDirection; }
50
51 //! Set direction the emitter emits particles
52 virtual void setDirection( const core::vector3df& newDirection ) { Direction = newDirection; }
53
54 //! Set the amount that the normal is divided by for getting a particles direction
55 virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) { NormalDirectionModifier = normalDirectionModifier; }
56
57 //! Sets whether to emit min<->max particles for every vertex per second, or to pick
58 //! min<->max vertices every second
59 virtual void setEveryMeshVertex( bool everyMeshVertex ) { EveryMeshVertex = everyMeshVertex; }
60
61 //! Set minimum number of particles the emitter emits per second
62 virtual void setMinParticlesPerSecond( u32 minPPS ) { MinParticlesPerSecond = minPPS; }
63
64 //! Set maximum number of particles the emitter emits per second
65 virtual void setMaxParticlesPerSecond( u32 maxPPS ) { MaxParticlesPerSecond = maxPPS; }
66
67 //! Set minimum starting color for particles
68 virtual void setMinStartColor( const video::SColor& color ) { MinStartColor = color; }
69
70 //! Set maximum starting color for particles
71 virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
72
73 //! Set the maximum starting size for particles
74 virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
75
76 //! Set the minimum starting size for particles
77 virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
78
79 //! Set the minimum particle life-time in milliseconds
80 virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
81
82 //! Set the maximum particle life-time in milliseconds
83 virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
84
85 //! Set maximal random derivation from the direction
86 virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
87
88 //! Get Mesh we're emitting particles from
89 virtual const IMesh* getMesh() const { return Mesh; }
90
91 //! Get whether to use vertex normal for direciton, or direction specified
92 virtual bool isUsingNormalDirection() const { return UseNormalDirection; }
93
94 //! Get direction the emitter emits particles
95 virtual const core::vector3df& getDirection() const { return Direction; }
96
97 //! Get the amount that the normal is divided by for getting a particles direction
98 virtual f32 getNormalDirectionModifier() const { return NormalDirectionModifier; }
99
100 //! Gets whether to emit min<->max particles for every vertex per second, or to pick
101 //! min<->max vertices every second
102 virtual bool getEveryMeshVertex() const { return EveryMeshVertex; }
103
104 //! Get the minimum number of particles the emitter emits per second
105 virtual u32 getMinParticlesPerSecond() const { return MinParticlesPerSecond; }
106
107 //! Get the maximum number of particles the emitter emits per second
108 virtual u32 getMaxParticlesPerSecond() const { return MaxParticlesPerSecond; }
109
110 //! Get the minimum starting color for particles
111 virtual const video::SColor& getMinStartColor() const { return MinStartColor; }
112
113 //! Get the maximum starting color for particles
114 virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
115
116 //! Gets the maximum starting size for particles
117 virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
118
119 //! Gets the minimum starting size for particles
120 virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
121
122 //! Get the minimum particle life-time in milliseconds
123 virtual u32 getMinLifeTime() const { return MinLifeTime; }
124
125 //! Get the maximum particle life-time in milliseconds
126 virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
127
128 //! Get maximal random derivation from the direction
129 virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
130
131private:
132
133 const IMesh* Mesh;
134 core::array<s32> VertexPerMeshBufferList;
135 s32 TotalVertices;
136 u32 MBCount;
137 s32 MBNumber;
138
139 f32 NormalDirectionModifier;
140 core::array<SParticle> Particles;
141 core::vector3df Direction;
142 core::dimension2df MaxStartSize, MinStartSize;
143 u32 MinParticlesPerSecond, MaxParticlesPerSecond;
144 video::SColor MinStartColor, MaxStartColor;
145 u32 MinLifeTime, MaxLifeTime;
146
147 u32 Time;
148 u32 Emitted;
149 s32 MaxAngleDegrees;
150
151 bool EveryMeshVertex;
152 bool UseNormalDirection;
153};
154
155} // end namespace scene
156} // end namespace irr
157
158
159#endif // __C_PARTICLE_MESH_EMITTER_H_INCLUDED__
160