~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
4
 
 
5
#ifndef __C_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
 
6
#define __C_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
 
7
 
 
8
#include "IParticleAnimatedMeshSceneNodeEmitter.h"
 
9
#include "irrArray.h"
 
10
 
 
11
namespace irr
 
12
{
 
13
namespace scene
 
14
{
 
15
 
 
16
//! An animated mesh emitter
 
17
class CParticleAnimatedMeshSceneNodeEmitter : public IParticleAnimatedMeshSceneNodeEmitter
 
18
{
 
19
public:
 
20
 
 
21
        //! constructor
 
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,
 
27
                s32 mbNumber = -1,
 
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)
 
38
        );
 
39
 
 
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);
 
43
 
 
44
        //! Set Mesh to emit particles from
 
45
        virtual void setAnimatedMeshSceneNode( IAnimatedMeshSceneNode* node );
 
46
 
 
47
        //! Set whether to use vertex normal for direction, or direction specified
 
48
        virtual void setUseNormalDirection( bool useNormalDirection ) { UseNormalDirection = useNormalDirection; }
 
49
 
 
50
        //! Set direction the emitter emits particles
 
51
        virtual void setDirection( const core::vector3df& newDirection ) { Direction = newDirection; }
 
52
 
 
53
        //! Set the amount that the normal is divided by for getting a particles direction
 
54
        virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) { NormalDirectionModifier = normalDirectionModifier; }
 
55
 
 
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; }
 
59
 
 
60
        //! Set minimum number of particles the emitter emits per second
 
61
        virtual void setMinParticlesPerSecond( u32 minPPS ) { MinParticlesPerSecond = minPPS; }
 
62
 
 
63
        //! Set maximum number of particles the emitter emits per second
 
64
        virtual void setMaxParticlesPerSecond( u32 maxPPS ) { MaxParticlesPerSecond = maxPPS; }
 
65
 
 
66
        //! Set minimum starting color for particles
 
67
        virtual void setMinStartColor( const video::SColor& color ) { MinStartColor = color; }
 
68
 
 
69
        //! Set maximum starting color for particles
 
70
        virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
 
71
 
 
72
        //! Set the maximum starting size for particles
 
73
        virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
 
74
 
 
75
        //! Set the minimum starting size for particles
 
76
        virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
 
77
 
 
78
        //! Set the minimum particle life-time in milliseconds
 
79
        virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
 
80
 
 
81
        //! Set the maximum particle life-time in milliseconds
 
82
        virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
 
83
 
 
84
        //!     Maximal random derivation from the direction
 
85
        virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
 
86
 
 
87
        //! Get Mesh we're emitting particles from
 
88
        virtual const IAnimatedMeshSceneNode* getAnimatedMeshSceneNode() const { return Node; }
 
89
 
 
90
        //! Get whether to use vertex normal for direciton, or direction specified
 
91
        virtual bool isUsingNormalDirection() const { return UseNormalDirection; }
 
92
 
 
93
        //! Get direction the emitter emits particles
 
94
        virtual const core::vector3df& getDirection() const { return Direction; }
 
95
 
 
96
        //! Get the amount that the normal is divided by for getting a particles direction
 
97
        virtual f32 getNormalDirectionModifier() const { return NormalDirectionModifier; }
 
98
 
 
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; }
 
102
 
 
103
        //! Get the minimum number of particles the emitter emits per second
 
104
        virtual u32 getMinParticlesPerSecond() const { return MinParticlesPerSecond; }
 
105
 
 
106
        //! Get the maximum number of particles the emitter emits per second
 
107
        virtual u32 getMaxParticlesPerSecond() const { return MaxParticlesPerSecond; }
 
108
 
 
109
        //! Get the minimum starting color for particles
 
110
        virtual const video::SColor& getMinStartColor() const { return MinStartColor; }
 
111
 
 
112
        //! Get the maximum starting color for particles
 
113
        virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
 
114
 
 
115
        //! Get the maximum starting size for particles
 
116
        virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
 
117
 
 
118
        //! Get the minimum starting size for particles
 
119
        virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
 
120
 
 
121
        //! Get the minimum particle life-time in milliseconds
 
122
        virtual u32 getMinLifeTime() const { return MinLifeTime; }
 
123
 
 
124
        //! Get the maximum particle life-time in milliseconds
 
125
        virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
 
126
 
 
127
        //!     Maximal random derivation from the direction
 
128
        virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
 
129
 
 
130
private:
 
131
 
 
132
        IAnimatedMeshSceneNode* Node;
 
133
        IAnimatedMesh*          AnimatedMesh;
 
134
        const IMesh*            BaseMesh;
 
135
        s32                     TotalVertices;
 
136
        u32                     MBCount;
 
137
        s32                     MBNumber;
 
138
        core::array<s32>        VertexPerMeshBufferList;
 
139
 
 
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;
 
147
 
 
148
        u32 Time;
 
149
        u32 Emitted;
 
150
        s32 MaxAngleDegrees;
 
151
 
 
152
        bool EveryMeshVertex;
 
153
        bool UseNormalDirection;
 
154
};
 
155
 
 
156
} // end namespace scene
 
157
} // end namespace irr
 
158
 
 
159
 
 
160
#endif // __C_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
 
161