/* render/particle.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_PARTICLE_H__ #define __INCLUDED_RENDER_PARTICLE_H__ #include "math/axis.h" #include "math/color.h" #include "math/vector3f.h" namespace render { /* ---- class Particle --------------------------------------------- */ /** * @brief One particle * */ class Particle { public: Particle(const math::Vector3f &location, const unsigned long timestamp); Particle(const math::Vector3f &location, const math::Axis &axis, const unsigned long timestamp); /* ---- inspectors ----------------------------------------- */ /** * @brief location of the particle * Depending on the attached setting of the ejector * location can be in world coordinates or in model coordinates, * */ inline const math::Vector3f &location() const { return particle_location; } /** * @brief axis vector of the particle * */ inline const math::Axis &axis() const { return particle_axis; } /** * @brief speed of the particle * */ const float speed() const { return particle_speed; } /** * @brief radius of the particle * */ const float radius() const { return particle_radius; } /** * @brief color of the particle * */ const math::Color color() const { return particle_color; } /** * @brief rotation of the particle, in radians * */ const float rotation() const { return particle_rotation; } /** * @brief particle creation timestamp * */ inline const unsigned long timestamp() const { return particle_timestamp; } /* ---- mutators ------------------------------------------- */ /** * @brief reference to the location of the particle * */ inline math::Vector3f &get_location() { return particle_location; } /** * @brief reference axis vector of the particle * */ inline math::Axis &get_axis() { return particle_axis; } /** * @brief set the location of the particle * */ inline void set_location(const math::Vector3f &location) { particle_location.assign(location); } /** * @brief set the axis of the particle * */ inline void set_axis(const math::Axis &axis) { particle_axis.assign(axis); } /** * @brief set the speed of the particle * */ inline void set_speed(const float speed) { particle_speed = speed; } /** * @brief set the radius of the particle * */ inline void set_radius(const float radius) { particle_radius = radius; } /** * @brief set the color of the particle * */ inline void set_color(const math::Color color) { particle_color.assign(color); } /** * @brief return a reference to the color of the particle * */ math::Color & get_color() { return particle_color; } /** * @brief set the rotation of the particle, in radians * This value is used to rotate the texture when rendering the particle * */ inline void set_rotation(const float rotation) { particle_rotation = rotation; } protected: math::Vector3f particle_location; math::Color particle_color; math::Axis particle_axis; float particle_radius; float particle_rotation; float particle_speed; unsigned long particle_timestamp; }; } // namespace #endif // __INCLUDED_RENDER_PARTICLE_H__