SuperTuxKart
Loading...
Searching...
No Matches
particle_kind.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2011-2015 Joerg Henrichs, Marianne Gagnon
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_PARTICLE_KIND_HPP
20#define HEADER_PARTICLE_KIND_HPP
21
22#include "utils/no_copy.hpp"
23
24#include <string>
25#include <SColor.h>
26using namespace irr;
27
28class Material;
29
30enum EmitterShape
31{
32 EMITTER_POINT,
33 EMITTER_SPHERE,
34 EMITTER_BOX
35};
36
41class ParticleKind : public NoCopy
42{
43private:
44
46 //float m_particle_size;
48 float m_min_size;
49
50 int m_angle_spread;
51
52 float m_velocity_x;
53 float m_velocity_y;
54 float m_velocity_z;
55
56 EmitterShape m_shape;
57
60
63
64 int m_lifetime_min;
65 int m_lifetime_max;
66
67 int m_fadeout_time;
68
69 video::SColor m_min_start_color;
70 video::SColor m_max_start_color;
71
73 float m_box_x, m_box_y, m_box_z;
74
77
78 int m_emission_decay_rate;
79
80 bool m_flips;
81
82 std::string m_name;
83
84 std::string m_material_file;
85
86 bool m_has_scale_affector;
87 float m_scale_affector_factor_x;
88 float m_scale_affector_factor_y;
89
93
96
97public:
98
104 ParticleKind(const std::string &file);
105 virtual ~ParticleKind() {}
106
107
108 float getMaxSize () const { return m_max_size; }
109 float getMinSize () const { return m_min_size; }
110
111 int getMinRate () const { return m_min_rate; }
112 int getMaxRate () const { return m_max_rate; }
113
114 EmitterShape getShape () const { return m_shape; }
115
116 Material* getMaterial () const;
117
118 int getMaxLifetime () const { return m_lifetime_max; }
119 int getMinLifetime () const { return m_lifetime_min; }
120
121 int getFadeoutTime () const { return m_fadeout_time; }
122
123 video::SColor getMinColor() const { return m_min_start_color; }
124 video::SColor getMaxColor() const { return m_max_start_color; }
125
126 float getBoxSizeX () const { return m_box_x; }
127 float getBoxSizeY () const { return m_box_y; }
128 float getBoxSizeZ () const { return m_box_z; }
129
130 float getSphereRadius() const { return m_sphere_radius; }
131
132 int getAngleSpread () const { return m_angle_spread; }
133
134 float getVelocityX () const { return m_velocity_x; }
135 float getVelocityY () const { return m_velocity_y; }
136 float getVelocityZ () const { return m_velocity_z; }
137
138 void setBoxSizeXZ (float x, float z) { m_box_x = x; m_box_z = z; }
139
140 int getEmissionDecayRate() const { return m_emission_decay_rate; }
141
142 bool hasScaleAffector() const { return m_has_scale_affector; }
143 float getScaleAffectorFactorX() const { return m_scale_affector_factor_x; }
144 float getScaleAffectorFactorY() const { return m_scale_affector_factor_y; };
145
146 bool getFlips() const { return m_flips; }
147
148 bool isVerticalParticles() const { return m_vertical_particles; }
149
150 bool randomizeInitialY() const { return m_randomize_initial_y; }
151
152 const std::string& getName() const { return m_name; }
153};
154
155#endif
156
157
Definition: material.hpp:48
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
type of particles
Definition: particle_kind.hpp:42
float m_max_size
Size of the particles.
Definition: particle_kind.hpp:47
int m_max_rate
Maximal emission rate in particles per second.
Definition: particle_kind.hpp:62
int m_min_rate
Minimal emission rate in particles per second.
Definition: particle_kind.hpp:59
bool m_vertical_particles
The particle's billboards should face the player by rotating around the Y axis only.
Definition: particle_kind.hpp:92
bool m_randomize_initial_y
Used mainly for weather, like snow.
Definition: particle_kind.hpp:95
float m_sphere_radius
For sphere emitters only.
Definition: particle_kind.hpp:76
float m_box_x
For box emitters only.
Definition: particle_kind.hpp:73