Add light module
This commit is contained in:
parent
72c0d1475e
commit
14b246b6e9
3 changed files with 76 additions and 0 deletions
|
@ -6,6 +6,7 @@ Import('env')
|
|||
|
||||
files = Split("""
|
||||
basics.cc
|
||||
light.cc
|
||||
object.cc
|
||||
object_sphere.cc
|
||||
scene.cc
|
||||
|
|
46
src/light.cc
Normal file
46
src/light.cc
Normal 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
29
src/light.h
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue