Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/particleejectorscript.h')
-rw-r--r--src/render/particleejectorscript.h367
1 files changed, 367 insertions, 0 deletions
diff --git a/src/render/particleejectorscript.h b/src/render/particleejectorscript.h
new file mode 100644
index 0000000..a538bb5
--- /dev/null
+++ b/src/render/particleejectorscript.h
@@ -0,0 +1,367 @@
+/*
+ render/particleejectorscript.h
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#ifndef __INCLUDED_RENDER_PARTICLEEJECTORSCRIPT_H__
+#define __INCLUDED_RENDER_PARTICLEEJECTORSCRIPT_H__
+
+#include "math/axis.h"
+#include "math/color.h"
+#include "math/vector3f.h"
+#include "model/model.h"
+
+namespace render {
+
+class ParticleEjectorScript {
+public:
+
+ /**
+ * @brief definition for type of ejector
+ * */
+ enum Type {Jet = 0, Trail = 1, Flame = 2, Spray = 3, Flare = 4 };
+
+ ParticleEjectorScript();
+ ParticleEjectorScript(const ParticleEjectorScript & other);
+
+ ~ParticleEjectorScript();
+
+ /* ---- inspectors ----------------------------------------- */
+
+ /**
+ * @brief the tytpe of ejector
+ * */
+ inline const Type type() const
+ {
+ return script_type;
+ }
+
+ /**
+ * @brief ejector axis relative to the particle system
+ * */
+ inline const math::Axis &axis() const
+ {
+ return script_axis;
+ }
+
+ /**
+ * @brief true of the ejector reacts on thrust
+ * */
+ inline bool thrust() const {
+ return script_thrust;
+ }
+
+ inline const unsigned int interval() const
+ {
+ return script_interval;
+ }
+
+ /**
+ * @brief angle of the cone through which to randomly spread ejected particles
+ * */
+ inline const float cone() const
+ {
+ return script_cone;
+ }
+
+ /**
+ * @brief offset defines the interpolation midpoint for alpha and radius ranges, default 0.5f
+ * */
+ inline float offset() const {
+ return script_offset;
+ }
+
+ /**
+ * @brief lifespan of ejected particles, in milliseconds
+ * */
+ inline unsigned long lifespan() const {
+ return script_lifespan;
+ }
+
+ /**
+ * @brief true if engine color is to be applied to ejected particles
+ * */
+ inline bool engine() const {
+ return script_engine;
+ }
+
+ /**
+ * @brief true if entity primary color is to be applied to ejected particles
+ * */
+ inline bool entity() const
+ {
+ return script_entity;
+ }
+
+ /**
+ * @brief true if entity secondary color is to be applied to ejected particles
+ * */
+ inline bool entity_second() const
+ {
+ return script_entity_second;
+ }
+
+ /**
+ * @brief name of the texture used to render ejected particles
+ * */
+ inline const std::string &texture() const {
+ return script_texture;
+ }
+
+
+ inline const model::Cull cull() const
+ {
+ return script_cull;
+ }
+
+ /**
+ * @brief color used to render ejected particles
+ * */
+ inline const math::Color &color() const
+ {
+ return script_color;
+ }
+
+ /**
+ * @brief radius vector for ejected particles, start, middle, end
+ * The radius is interpolated depending on the age and lifespan of the particle
+ * */
+ inline const math::Vector3f &radius_vec() const
+ {
+ return script_radius_vec;
+ }
+
+ /**
+ * @brief alpha vector for ejected particles, start, middle, end
+ * The alpha value is interpolated depending on the age and lifespan of the particle
+ * */
+ inline const math::Vector3f & alpha_vec() const
+ {
+ return script_alpha_vec;
+ }
+
+ /**
+ * @brief speed of ejected particles, in gameunits per second
+ * */
+ inline const float speed() const
+ {
+ return script_speed;
+ }
+
+ /**
+ * @brief spawn radius
+ * radius within wich particles are spawn
+ * */
+ inline const float spawn_radius() const
+ {
+ return script_spawn_radius;
+ }
+
+ /* ---- mutators ------------------------------------------- */
+
+ /**
+ * @brief return a reference to the ejector axis
+ * */
+ inline math::Axis &get_axis()
+ {
+ return script_axis;
+ }
+
+ /**
+ * @brief return a reference to the radius vector
+ * */
+ inline math::Vector3f &get_radius_vec()
+ {
+ return script_radius_vec;
+ }
+
+ /**
+ * @brief return a reference to the alpha vector
+ * */
+ inline math::Vector3f &get_alpha_vec()
+ {
+ return script_alpha_vec;
+ }
+
+ /**
+ * @brief return a reference to particle color
+ * */
+ inline math::Color &get_color()
+ {
+ return script_color;
+ }
+
+ /**
+ * @brief set the ejector type
+ * */
+ inline void set_type(const Type type)
+ {
+ script_type = type;
+ }
+
+ /**
+ * @brief set the radius within which particles are spawned
+ * */
+ void set_spawn_radius(const float spawn_radius)
+ {
+ script_spawn_radius = spawn_radius;
+ }
+
+ /**
+ * @brief set the speed of ejected particles, in gameunits per second
+ * */
+ inline void set_speed(const float speed)
+ {
+ script_speed = speed;
+ }
+
+ /**
+ * @brief set ejector cone, in degrees
+ * */
+ inline void set_cone(const float cone)
+ {
+ script_cone = cone;
+ }
+
+ /**
+ * @brief set ejector interval, in milliseconds
+ * */
+ inline void set_interval(const unsigned long interval)
+ {
+ script_interval = interval;
+ }
+
+ /**
+ * @brief set particle lifespan, in milliseconds
+ * */
+ inline void set_lifespan(const unsigned long lifespan)
+ {
+ script_lifespan = lifespan;
+ }
+
+ /**
+ * @brief set polygon cull rule
+ * */
+ inline void set_cull(const model::Cull cull)
+ {
+ script_cull = cull;
+ }
+
+ /**
+ * @brief set texture name
+ * */
+ inline void set_texture(const std::string &texture)
+ {
+ script_texture.assign(texture);
+ }
+
+ /**
+ * @brief temporal interpolation midpoint, default 0.5f
+ * */
+ inline void set_offset(const float offset)
+ {
+ script_offset = offset;
+ }
+
+ /**
+ * @brief set the radius vector
+ * */
+ inline void set_radius_vec(const math::Vector3f radius_vec)
+ {
+ script_radius_vec.assign(radius_vec);
+ }
+
+ /**
+ * @brief set the alpha vector
+ * */
+ inline void set_alpha_vec(const math::Vector3f alpha_vec)
+ {
+ script_alpha_vec.assign(alpha_vec);
+ }
+
+ /**
+ * @brief set particle entity primary color
+ * */
+ inline void set_entity(const bool use_color_entity)
+ {
+ script_entity = use_color_entity;
+ }
+
+ /**
+ * @brief set particle entity secondary color
+ * */
+ inline void set_entity_second(const bool use_color_entity_second)
+ {
+ script_entity_second = use_color_entity_second;
+ }
+
+ /**
+ * @brief set particle engine color
+ * */
+ inline void set_engine(const bool use_color_engine)
+ {
+ script_engine = use_color_engine;
+ }
+
+ /**
+ * @brief make ejector react on thruster setting
+ * */
+ inline void set_thrust(const bool use_thrust)
+ {
+ script_thrust = use_thrust;
+ }
+
+ /**
+ * @brief set the particle color
+ * */
+ inline void set_color(const math::Color &color)
+ {
+ script_color.assign(color);
+ }
+
+private:
+ /// type of ejector
+ Type script_type;
+ /// ejector axis, relative to the particle system axis
+ math::Axis script_axis;
+ /// interval between to ejects, in milliseconds
+ unsigned long script_interval;
+ /// lifespan of a particle, in milliseconds
+ unsigned long script_lifespan;
+ /// ejector cone, in default 360 degrees
+ float script_cone;
+ /// offset defines the 'middle' point for radius and alpha, range 0.0f-1.0f, default 0.5f.
+ float script_offset;
+ /// particle alpha vector: 0.0 - middle - 1.0
+ math::Vector3f script_alpha_vec;
+ /// particle radius vector: 0.0 - middle - 1.0
+ math::Vector3f script_radius_vec;
+
+ /// speed of ejected particles, in gameunits per second
+ float script_speed;
+
+ /// spawn radius
+ float script_spawn_radius;
+
+ /// color of ejected particles
+ math::Color script_color;
+
+ /// particles have entity primary color
+ bool script_entity;
+ /// particles have entity secondary color
+ bool script_entity_second;
+ /// particles jave engine color
+ bool script_engine;
+ /// ejector reacts on engine thrust
+ bool script_thrust;
+
+ /// texture to render particles with
+ std::string script_texture;
+ /// texture cull
+ model::Cull script_cull;
+};
+
+} // namespace render
+
+#endif // __INCLUDED_RENDER_PARTICLEEJECTORSCRIPT_H__