hx3d
1
2D/3D Simple Game Framework
Main Page
Namespaces
Classes
Files
File List
engine
include
hx3d
graphics
particle.hpp
1
/*
2
Particle.
3
Copyright (C) 2015 Denis BOURGE
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
9
10
This library 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 GNU
13
Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18
USA
19
*/
20
21
#ifndef HX3D_GRAPHICS_PARTICLE
22
#define HX3D_GRAPHICS_PARTICLE
23
24
#include "hx3d/utils/poolable.hpp"
25
#include "hx3d/utils/ptr.hpp"
26
27
#include "hx3d/graphics/texture.hpp"
28
#include "hx3d/graphics/sprite.hpp"
29
#include "hx3d/graphics/batch.hpp"
30
31
namespace
hx3d
{
32
namespace
graphics {
33
37
class
Particle
:
public
Poolable
{
38
public
:
39
Particle
();
40
46
void
setTexture
(
const
Ptr<Texture>
& texture);
47
53
void
update
(
const
float
delta);
54
60
void
draw
(
Batch
& batch);
61
62
virtual
void
reset
()
override
;
63
65
66
private
:
68
glm::vec3 position;
70
glm::vec3 size;
72
glm::vec3 velocity;
74
glm::vec3 gravity;
76
float
rotation;
78
float
rotationSpeed;
79
81
float
baseLife;
83
float
life;
85
Color
color;
86
88
Sprite
sprite;
90
bool
dead;
91
92
friend
class
ParticleEmitter
;
93
};
94
95
}
/* graphics */
96
}
/* hx3d */
97
98
#endif
hx3d::graphics::Particle
Poolable 2D/3D particle.
Definition:
particle.hpp:37
hx3d::graphics::Particle::update
void update(const float delta)
Update the particle.
Definition:
particle.cpp:44
hx3d::graphics::Color
Four [0..255] components defined color.
Definition:
color.hpp:32
hx3d
hx3d framework namespace
Definition:
audio.hpp:26
hx3d::Poolable
Reutilisable elements. Recycling is good for your memory.
Definition:
poolable.hpp:29
hx3d::graphics::Batch
Simple base batch implementation. Draw at each draw call.
Definition:
batch.hpp:36
hx3d::graphics::Particle::reset
virtual void reset() override
Reset the element.
Definition:
particle.cpp:32
hx3d::graphics::Sprite
2D texture manipulation.
Definition:
sprite.hpp:62
hx3d::graphics::Particle::setTexture
void setTexture(const Ptr< Texture > &texture)
Set the texture.
Definition:
particle.cpp:40
hx3d::graphics::ParticleEmitter
Emit particles with parameters.
Definition:
particle_emitter.hpp:33
hx3d::Ptr
std::shared_ptr< T > Ptr
Quick-typing shared ptr.
Definition:
ptr.hpp:34
hx3d::graphics::Particle::draw
void draw(Batch &batch)
Draw the particle.
Definition:
particle.cpp:69
Generated by
1.8.11