From 26b1401d6cfdfd35afe275e287dc7d205902e55e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 1 May 2012 20:44:51 +0000 Subject: Added light environment classes --- src/render/light.h | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/render/light.h (limited to 'src/render/light.h') diff --git a/src/render/light.h b/src/render/light.h new file mode 100644 index 0000000..7e64106 --- /dev/null +++ b/src/render/light.h @@ -0,0 +1,96 @@ +/* + render/light.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_LIGHT_H__ +#define __INCLUDED_RENDER_LIGHT_H__ + +#include "math/vector3f.h" +#include "math/color.h" + +namespace render +{ + +/** + * @brief paramaters for a single light source + * */ +class Light +{ +public: + /** + * @brief default constructor, creates a white light at (0,0,0) + * */ + Light(); + + /** + * @brief creates a light source with given color and location + * */ + Light(const math::Vector3f & location, const math::Color & color); + + /** + * @brief destructor + */ + ~Light(); + + /* ---- inspectors ----------------------------------------- */ + + /** + * @brief returns the location for this light source + * */ + inline const math::Vector3f & location() const { + return light_location; + } + + /** + * @brief returns the color for this light source + * */ + inline const math::Color & color() const { + return light_color; + } + + /** + * @brief returns the attenuation settings for this light source + * */ + inline const math::Vector3f & attenuation() const { + return light_attenuation; + } + + /* ---- mutators ------------------------------------------- */ + + /** + * @brief set the location for this light source + * @see location() + * */ + inline void set_location(const math::Vector3f & location) { + light_location.assign(location); + } + + /** + * @brief set the location for this light source + * @see color() + * */ + inline void set_color(const math::Color & color) { + light_color.assign(color); + } + + /** + * @brief set the attenuation settings for this light source + * */ + inline void set_attenuation(const float constant, const float linear, const float quadratic) { + light_attenuation.assign(constant, linear, quadratic); + } + +private: + math::Vector3f light_location; + math::Color light_color; + math::Vector3f light_attenuation; + + +}; + +} + +#endif + -- cgit v1.2.3