From 14b246b6e9cda876bfb1459870bb2e323d6a3a9d Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 10 Sep 2013 21:48:41 -0700 Subject: [PATCH] Add light module --- src/SConscript | 1 + src/light.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/light.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/light.cc create mode 100644 src/light.h diff --git a/src/SConscript b/src/SConscript index 98a693c..0adc23b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -6,6 +6,7 @@ Import('env') files = Split(""" basics.cc + light.cc object.cc object_sphere.cc scene.cc diff --git a/src/light.cc b/src/light.cc new file mode 100644 index 0000000..00a8475 --- /dev/null +++ b/src/light.cc @@ -0,0 +1,46 @@ +/* light.cc + * + * Lights light the scene. + * + * Eryn Wells + */ + +#include "basics.h" +#include "light.h" +#include "object.h" + + +Light::Light() + : Light(1.0) +{ } + + +Light::Light(float i) + : Light(Vector3::Zero, i) +{ } + + +Light::Light(Vector3 o, float i) + : Object(o), + intensity(i) +{ } + + +/* + * Light::get_intensity -- + * Light::set_intensity -- + * + * Get and set the intensity of this light. + */ +float +Light::get_intensity() + const +{ + return intensity; +} + +void +Light::set_intensity(float i) +{ + intensity = i; +} diff --git a/src/light.h b/src/light.h new file mode 100644 index 0000000..8703e10 --- /dev/null +++ b/src/light.h @@ -0,0 +1,29 @@ +/* light.h + * + * Lights light the scene. + * + * Eryn Wells + */ + +#ifndef __LIGHT_H__ +#define __LIGHT_H__ + +#include "object.h" + + +class Light + : public Object +{ +public: + Light(); + Light(float i); + Light(Vector3 o, float i); + + float get_intensity() const; + void set_intensity(float i); + +private: + float intensity; +}; + +#endif