Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-08-18 09:24:15 +0000
committerStijn Buys <ingar@osirion.org>2009-08-18 09:24:15 +0000
commitf030154fe727e25a2afe1f78b3998c2d2dba95e4 (patch)
treecd92baf9e4fa8a136523b9eb570e9811846c9250 /src/render/particles.h
parent5636fad174f0bcff857c357c394c4cc8d424b302 (diff)
astyle cleanup, corrects not loading of material textures
Diffstat (limited to 'src/render/particles.h')
-rw-r--r--src/render/particles.h106
1 files changed, 73 insertions, 33 deletions
diff --git a/src/render/particles.h b/src/render/particles.h
index cf0f5eb..15e9827 100644
--- a/src/render/particles.h
+++ b/src/render/particles.h
@@ -15,22 +15,30 @@
#include "core/entity.h"
#include "model/parts.h"
-namespace render {
+namespace render
+{
/* ---- class Particle --------------------------------------------- */
/// one particle
-class Particle {
+class Particle
+{
public:
Particle(const math::Vector3f &location, float time);
Particle(const math::Vector3f &location, const math::Axis &axis, float time);
/// location of the particle, in world coordinates
- inline math::Vector3f &location() { return particle_location; }
+ inline math::Vector3f &location() {
+ return particle_location;
+ }
- inline math::Axis &axis() { return particle_axis; }
+ inline math::Axis &axis() {
+ return particle_axis;
+ }
- inline const float time() const { return particle_time; }
+ inline const float time() const {
+ return particle_time;
+ }
protected:
math::Vector3f particle_location;
@@ -42,31 +50,52 @@ protected:
/* ---- class ParticleScript --------------------------------------- */
/// class to hold particle scripts
-class ParticleScript {
+class ParticleScript
+{
public:
- enum Type {Jet=0, Trail=1, Flame=2, Spray=3 };
+ enum Type {Jet = 0, Trail = 1, Flame = 2, Spray = 3 };
+
+ inline const Type type() const {
+ return particles_type;
+ }
- inline const Type type() const { return particles_type; }
+ inline const std::string &label() const {
+ return particles_label;
+ }
- inline const std::string &label() const { return particles_label; }
+ inline const std::string &texture() const {
+ return particles_texture;
+ }
- inline const std::string &texture() const { return particles_texture; }
+ inline const math::Color &color() const {
+ return particles_color;
+ }
- inline const math::Color &color() const { return particles_color; }
+ inline float radius() const {
+ return particles_radius;
+ }
- inline float radius() const { return particles_radius; }
+ inline float timeout() const {
+ return particles_timeout;
+ }
- inline float timeout() const { return particles_timeout; }
+ inline float eject() const {
+ return particles_eject;
+ }
- inline float eject() const { return particles_eject; }
+ inline float speed() const {
+ return particles_speed;
+ }
- inline float speed() const { return particles_speed; }
+ inline float alpha() const {
+ return particles_alpha;
+ }
- inline float alpha() const { return particles_alpha; }
+ inline float offset() const {
+ return particles_offset;
+ }
- inline float offset() const { return particles_offset; }
-
static ParticleScript *load(const std::string &label);
static void clear();
@@ -81,8 +110,8 @@ private:
std::string particles_label;
std::string particles_texture;
Type particles_type;
- math::Color particles_color;
-
+ math::Color particles_color;
+
float particles_radius;
float particles_timeout;
float particles_eject;
@@ -98,21 +127,30 @@ private:
/* ---- class ParticleSystem --------------------------------------- */
/// abstract base class for a particle system attached to an entity
-class ParticleSystem {
+class ParticleSystem
+{
public:
ParticleSystem(ParticleScript *script, core::Entity *entity, model::Particles *modelclass);
virtual ~ParticleSystem();
/// index of the texture to use
- inline const size_t texture() const { return particlesystem_texture; }
+ inline const size_t texture() const {
+ return particlesystem_texture;
+ }
/// location of the particle system within the entity
- inline const math::Vector3f &location() const { return particlesystem_location; }
+ inline const math::Vector3f &location() const {
+ return particlesystem_location;
+ }
/// axis of the particle system within the entity
- inline const math::Axis &axis() const { return particlesystem_axis; }
+ inline const math::Axis &axis() const {
+ return particlesystem_axis;
+ }
- inline const model::Cull cull() const { return particlesystem_cull; }
+ inline const model::Cull cull() const {
+ return particlesystem_cull;
+ }
virtual void draw(float elapsed);
@@ -125,16 +163,18 @@ public:
protected:
core::Entity *particlesystem_entity;
-
+
typedef std::deque<Particle *> Stream;
- inline Stream & stream() { return particlesystem_stream; }
+ inline Stream & stream() {
+ return particlesystem_stream;
+ }
size_t particlesystem_texture;
math::Axis particlesystem_axis;
math::Vector3f particlesystem_location;
-
+
float particlesystem_last_eject;
ParticleScript *particlesystem_script;
@@ -146,11 +186,11 @@ protected:
float particlesystem_radius;
float now;
math::Color color;
-
+
model::Particles *particlesystem_modelclass;
model::Cull particlesystem_cull;
};
-
+
/* ---- class Flame ------------------------------------------------ */
/// flame style particles, like engine flames
@@ -159,7 +199,7 @@ class Flame : public ParticleSystem
public:
Flame(ParticleScript *script, core::Entity *entity, model::Particles *modelclass);
virtual ~Flame();
-
+
virtual void draw(float elapsed);
};
@@ -171,7 +211,7 @@ class Jet : public ParticleSystem
public:
Jet(ParticleScript *script, core::Entity *entity, model::Particles *modelclass);
virtual ~Jet();
-
+
virtual void draw(float elapsed);
};
@@ -183,7 +223,7 @@ class Spray : public ParticleSystem
public:
Spray(ParticleScript *script, core::Entity *entity, model::Particles *modelclass);
virtual ~Spray();
-
+
virtual void draw(float elapsed);
};