V-Gears 0
Free Final Fantasy VII engine.
Particle.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears 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
16#pragma once
17
18#include <OgrePrerequisites.h>
19#include <Ogre.h>
20
22
23class ParticleEmitter;
24
31
32 public:
33
38
43
48 };
49
53 Particle();
54
58 virtual ~Particle() = 0;
59
65 virtual void InitForEmission(){};
66
73 virtual void InitForExpiration(){};
74
82 virtual void Update(Ogre::Real time_elapsed);
83
89 virtual void CopyAttributesTo(Particle* particle);
90
97
104 void SetParentEmitter(ParticleEmitter* parent_emitter){
105 parent_emitter_ = parent_emitter;
106 };
107
114
120 void SetEnabled(bool enabled) {enabled_ = enabled;};
121
127 bool IsEnabled() const {return enabled_;};
128
135 void SetEmittable(bool emittable) {emittable_ = emittable;};
136
142 bool IsEmittable() const {return emittable_;};
143
148
152 Ogre::Vector3 position;
153
157 Ogre::Vector3 direction;
158
166
174
175 protected:
176
181
186
191
196};
A particle emitter.
Definition: ParticleEmitter.h:27
A particle.
Definition: Particle.h:30
ParticleAdditionalData * additional_data
Additional data for the particle.
Definition: Particle.h:147
bool IsEnabled() const
Checks if the particle is enabled.
Definition: Particle.h:127
void SetEnabled(bool enabled)
Enables or disables the particle.
Definition: Particle.h:120
virtual ~Particle()=0
Destructor.
Definition: Particle.cpp:30
float total_time_to_live
The particle duration.
Definition: Particle.h:173
bool emittable_
Indicates if the particl can be emitted.
Definition: Particle.h:195
ParticleType particle_type_
The particle type.
Definition: Particle.h:185
bool IsEmittable() const
Checks if the particle can be emitted.
Definition: Particle.h:142
Particle()
Constructor.
Definition: Particle.cpp:18
float time_to_live
The particle duration.
Definition: Particle.h:165
virtual void InitForExpiration()
Initializes the particle.
Definition: Particle.h:73
ParticleEmitter * parent_emitter_
The particle emitter.
Definition: Particle.h:180
virtual void InitForEmission()
Initializes the particle.
Definition: Particle.h:65
virtual void CopyAttributesTo(Particle *particle)
Copies the particle attributes to another particle.
Definition: Particle.cpp:36
bool enabled_
Indicates if the particle is enabled.
Definition: Particle.h:190
Ogre::Vector3 direction
The direction that the particle is or will be emitted to.
Definition: Particle.h:157
ParticleType GetParticleType() const
Retrieves the particle type.
Definition: Particle.h:96
virtual void Update(Ogre::Real time_elapsed)
Updates the particle.
Definition: Particle.cpp:32
ParticleType
Types of particles.
Definition: Particle.h:37
@ PT_EMITTER
Definition: Particle.h:47
@ PT_VISUAL
A visual particle.
Definition: Particle.h:42
Ogre::Vector3 position
The particle position.
Definition: Particle.h:152
void SetEmittable(bool emittable)
Toggles the particle emitability.
Definition: Particle.h:135
ParticleEmitter * GetParentEmitter() const
Retrieves the particle emitter.
Definition: Particle.h:113
void SetParentEmitter(ParticleEmitter *parent_emitter)
Sets the particle emitter.
Definition: Particle.h:104
Additional data for a particle.
Definition: ParticleAdditionalData.h:21