Add PointLight in lightPoint.cc
This commit is contained in:
parent
e1ded8a9ad
commit
acdfb0fb60
3 changed files with 70 additions and 0 deletions
|
@ -21,6 +21,7 @@ files = [
|
||||||
'basics.cc',
|
'basics.cc',
|
||||||
'camera.cc',
|
'camera.cc',
|
||||||
'light.cc',
|
'light.cc',
|
||||||
|
'lightPoint.cc',
|
||||||
'log.cc',
|
'log.cc',
|
||||||
'material.cc',
|
'material.cc',
|
||||||
'object.cc',
|
'object.cc',
|
||||||
|
|
35
src/lightPoint.cc
Normal file
35
src/lightPoint.cc
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/* lightPoint.cc
|
||||||
|
* vim: set tw=80:
|
||||||
|
* Eryn Wells <eryn@erynwells.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lightPoint.hh"
|
||||||
|
|
||||||
|
|
||||||
|
using charles::basics::Vector4;
|
||||||
|
|
||||||
|
|
||||||
|
namespace charles {
|
||||||
|
|
||||||
|
PointLight::PointLight(const Vector4& origin,
|
||||||
|
const Color& color)
|
||||||
|
: Light(color),
|
||||||
|
mOrigin(origin)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
Vector4
|
||||||
|
PointLight::GetOrigin()
|
||||||
|
{
|
||||||
|
return mOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PointLight::SetOrigin(const Vector4& origin)
|
||||||
|
{
|
||||||
|
mOrigin = origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace charles */
|
||||||
|
|
34
src/lightPoint.hh
Normal file
34
src/lightPoint.hh
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/* lightPoint.hh
|
||||||
|
* vim: set tw=80:
|
||||||
|
* Eryn Wells <eryn@erynwells.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIGHTPOINT_HH__
|
||||||
|
#define __LIGHTPOINT_HH__
|
||||||
|
|
||||||
|
#include "light.hh"
|
||||||
|
|
||||||
|
|
||||||
|
namespace charles {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The simplest light source. Emits light in all directions uniformly, without
|
||||||
|
* falloff.
|
||||||
|
*/
|
||||||
|
class PointLight
|
||||||
|
: public Light
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PointLight(const basics::Vector4 &origin,
|
||||||
|
const basics::Color& color);
|
||||||
|
|
||||||
|
basics::Vector4& GetOrigin();
|
||||||
|
void SetOrigin(const basics::Vector4& origin);
|
||||||
|
|
||||||
|
private:
|
||||||
|
basics::Vector4 mOrigin;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace charles */
|
||||||
|
|
||||||
|
#endif /* __LIGHTPOINT_HH__ */
|
Loading…
Add table
Add a link
Reference in a new issue