12#include "Interpolation.h"
19#define SHADER_PARTICLES_DEFAULT "Ressources\\Shaders\\ParticleBatched.shader"
25#define TEXTURE_PARTICLES_DEFAULT "Ressources\\Images\\DefaultBox10x10.png"
86 static std::string GetType() {
return "ParticleSystem"; };
140 int Serialize(std::fstream* data,
int offset)
override;
148 int Deserialize(std::fstream* data,
int offset)
override;
Defines the GameObject class and its related components.
#define SHADER_PARTICLES_DEFAULT
The default shader for particles.
Definition ParticleSystem.h:19
#define TEXTURE_PARTICLES_DEFAULT
The default texture for particles.
Definition ParticleSystem.h:25
Defines the Sprite class, which represents a game sprite.
The BezierInterpolator class represents a Bezier curve interpolator.
Definition Interpolation.h:61
Base class for game components.
Definition GameObject.h:29
Class representing a game object.
Definition GameObject.h:68
Represents a particle.
Definition ParticleSystem.h:51
Transform * transform
Definition ParticleSystem.h:56
float distance
Definition ParticleSystem.h:65
void Disable()
Disables the particle.
Definition ParticleSystem.cpp:121
fVec2 currentScale
Definition ParticleSystem.h:60
GameObject go
Definition ParticleSystem.h:54
bool isActive
Definition ParticleSystem.h:57
fVec2 currentPosition
Definition ParticleSystem.h:59
double clock
Definition ParticleSystem.h:64
Sprite * sprite
Definition ParticleSystem.h:55
float currentSpeed
Definition ParticleSystem.h:61
fVec4 currentColor
Definition ParticleSystem.h:62
fVec2 currentDirection
Definition ParticleSystem.h:63
ParticleProperties prop
Definition ParticleSystem.h:58
void Enable()
Enables the particle.
Definition ParticleSystem.cpp:126
Represents a particle system component that can be attached to a game object.
Definition ParticleSystem.h:82
void Init()
Initializes the particle system.
Definition ParticleSystem.cpp:96
void Update()
Updates the particle system.
Definition ParticleSystem.cpp:15
int maxParticles
Definition ParticleSystem.h:99
std::string shader
Definition ParticleSystem.h:105
uint16 emissionQuantity
Definition ParticleSystem.h:101
int Serialize(std::fstream *data, int offset) override
Serializes the particle system.
Definition ParticleSystem.cpp:145
bool recycle
Definition ParticleSystem.h:104
std::deque< int > enabled
Definition ParticleSystem.h:98
void UpdateParticle(int index)
Updates a particle.
Definition ParticleSystem.cpp:108
static std::map< GameObject *, ParticleSystem > componentList
Definition ParticleSystem.h:93
double emissionFrequency
Definition ParticleSystem.h:100
void Emit()
Emits particles.
Definition ParticleSystem.cpp:53
void InitParticle()
Initializes a particle.
Definition ParticleSystem.cpp:86
std::string texture
Definition ParticleSystem.h:106
GameObject * attachedObj
Definition ParticleSystem.h:88
bool isActive
Definition ParticleSystem.h:95
std::deque< int > disabled
Definition ParticleSystem.h:97
std::deque< Particle > pool
Definition ParticleSystem.h:96
int initNum
Definition ParticleSystem.h:102
ParticleProperties prop
Definition ParticleSystem.h:103
int Deserialize(std::fstream *data, int offset) override
Deserializes the particle system.
Definition ParticleSystem.cpp:179
Represents a game sprite.
Definition Sprite.h:26
Structure that holds the properties of a particle.
Definition ParticleSystem.h:31
int lifedistance
Definition ParticleSystem.h:34
BezierInterpolator colorY
Definition ParticleSystem.h:41
float lifetime
Definition ParticleSystem.h:33
BezierInterpolator colorZ
Definition ParticleSystem.h:42
BezierInterpolator colorA
Definition ParticleSystem.h:43
BezierInterpolator speed
Definition ParticleSystem.h:44
fVec2 absoluteStartPosition
Definition ParticleSystem.h:32
BezierInterpolator directionX
Definition ParticleSystem.h:36
BezierInterpolator directionY
Definition ParticleSystem.h:37
BezierInterpolator scaleY
Definition ParticleSystem.h:39
BezierInterpolator colorX
Definition ParticleSystem.h:40
fVec2 sPosition
Definition ParticleSystem.h:35
BezierInterpolator scaleX
Definition ParticleSystem.h:38