# HG changeset patch # User John Tsiombikas # Date 1393725407 -7200 # Node ID 07c08d970cb42f7acd48d86427e8673359bb7653 # Parent 9d581abd0bfb0ce39dfa4ca15a9961aa64ad1718 added a rudimentary light class diff -r 9d581abd0bfb -r 07c08d970cb4 src/light.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/light.cc Sun Mar 02 03:56:47 2014 +0200 @@ -0,0 +1,38 @@ +#include "light.h" + +using namespace goatgfx; + +Light::Light() +{ + cast_shadows = false; +} + +void Light::set_color(const Vector3 &color) +{ + this->color = color; +} + +const Vector3 &Light::get_color() const +{ + return color; +} + +void Light::set_attenuation(const Vector3 &att) +{ + attenuation = att; +} + +const Vector3 &Light::get_attenuation() const +{ + return attenuation; +} + +void Light::set_shadow_caster(bool s) +{ + cast_shadows = s; +} + +bool Light::is_shadow_caster() const +{ + return cast_shadows; +} diff -r 9d581abd0bfb -r 07c08d970cb4 src/light.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/light.h Sun Mar 02 03:56:47 2014 +0200 @@ -0,0 +1,30 @@ +#ifndef GOATGFX_LIGHT_H_ +#define GOATGFX_LIGHT_H_ + +#include "xform_node.h" + +namespace goatgfx { + +class Light : public XFormNode { +private: + Vector3 color; + Vector3 attenuation; + + bool cast_shadows; + +public: + Light(); + + void set_color(const Vector3 &color); + const Vector3 &get_color() const; + + void set_attenuation(const Vector3 &att); + const Vector3 &get_attenuation() const; + + void set_shadow_caster(bool s); + bool is_shadow_caster() const; +}; + +} // namespace goatgfx + +#endif // GOATGFX_LIGHT_H_ diff -r 9d581abd0bfb -r 07c08d970cb4 src/xform_node.h --- a/src/xform_node.h Sun Mar 02 02:18:15 2014 +0200 +++ b/src/xform_node.h Sun Mar 02 03:56:47 2014 +0200 @@ -1,5 +1,5 @@ -#ifndef XFORM_NODE_H_ -#define XFORM_NODE_H_ +#ifndef GOATGFX_XFORM_NODE_H_ +#define GOATGFX_XFORM_NODE_H_ #include #include "vmath/vector.h" @@ -155,4 +155,4 @@ } // namespace goatgfx -#endif /* XFORM_NODE_H_ */ +#endif /* GOATGFX_XFORM_NODE_H_ */