Add light module

This commit is contained in:
Eryn Wells 2013-09-10 21:48:41 -07:00
parent 72c0d1475e
commit 14b246b6e9
3 changed files with 76 additions and 0 deletions

View file

@ -6,6 +6,7 @@ Import('env')
files = Split(""" files = Split("""
basics.cc basics.cc
light.cc
object.cc object.cc
object_sphere.cc object_sphere.cc
scene.cc scene.cc

46
src/light.cc Normal file
View file

@ -0,0 +1,46 @@
/* light.cc
*
* Lights light the scene.
*
* Eryn Wells <eryn@erynwells.me>
*/
#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;
}

29
src/light.h Normal file
View file

@ -0,0 +1,29 @@
/* light.h
*
* Lights light the scene.
*
* Eryn Wells <eryn@erynwells.me>
*/
#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