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/particleejector.h')
-rw-r--r--src/render/particleejector.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/render/particleejector.h b/src/render/particleejector.h
new file mode 100644
index 0000000..f626f26
--- /dev/null
+++ b/src/render/particleejector.h
@@ -0,0 +1,104 @@
+/*
+ render/particleejector.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_PARTICLEEJECTOR_H__
+#define __INCLUDED_RENDER_PARTICLEEJECTOR_H__
+
+#include <deque>
+
+#include "render/particleejectorscript.h"
+#include "render/particle.h"
+
+namespace render {
+
+class ParticleEjector : public ParticleEjectorScript {
+public:
+ typedef std::deque<Particle *> Particles;
+
+ /**
+ * @brief initialize an ejector from a ParticleEjectorScript
+ * */
+ ParticleEjector(const ParticleEjectorScript &script);
+ virtual ~ParticleEjector();
+
+ /**
+ * @brief if false, no new particles are created
+ * */
+ inline const bool enabled()
+ {
+ return ejector_enabled;
+ }
+
+ /* ---- mutators ------------------------------------------- */
+
+ /**
+ * @brief enable or disable particle ejection
+ * */
+ inline void enable(const bool enabled = true)
+ {
+ ejector_enabled = enabled;
+ }
+
+ /**
+ * @brief disable or enable particle ejection
+ * */
+ inline void disable(const bool disabled = true)
+ {
+ ejector_enabled = !disabled;
+ }
+
+ /**
+ * @brief updated the particles attached to the ejector, and drawn them
+ * */
+ void frame(const float seconds, const math::Vector3f & ps_location, const math::Axis & ps_axis);
+
+ /**
+ * @brief remove all particles
+ * */
+ void clear();
+
+protected:
+ inline Particles &particles()
+ {
+ return ejector_particles;
+ }
+
+ virtual void draw(const math::Vector3f & ps_location);
+
+private:
+ unsigned long ejector_last_eject;
+ Particles ejector_particles;
+ bool ejector_enabled;
+};
+
+/**
+ * @brief Spray particles
+ * */
+class ParticleEjectorSpray : public ParticleEjector {
+public:
+ ParticleEjectorSpray(const ParticleEjectorScript &script);
+ virtual ~ParticleEjectorSpray();
+
+protected:
+ virtual void draw(const math::Vector3f & ps_location);
+};
+
+/**
+ * @brief Trail particles
+ * */
+class ParticleEjectorTrail : public ParticleEjector {
+public:
+ ParticleEjectorTrail(const ParticleEjectorScript &script);
+ virtual ~ParticleEjectorTrail();
+
+protected:
+ virtual void draw(const math::Vector3f & ps_location);
+};
+
+} // namespace render
+
+#endif // __INCLUDED_RENDER_PARTICLEEJECTOR_H__
+