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>2012-05-01 20:44:51 +0000
committerStijn Buys <ingar@osirion.org>2012-05-01 20:44:51 +0000
commit26b1401d6cfdfd35afe275e287dc7d205902e55e (patch)
treebefd04ee2ade7e7e5c1a1a93b42bc4d07252444f /src/render/light.h
parent486f74a45c8241862f2b94d63e54aeb2bc5d5424 (diff)
Added light environment classes
Diffstat (limited to 'src/render/light.h')
-rw-r--r--src/render/light.h96
1 files changed, 96 insertions, 0 deletions
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
+