Add set_intensity; clean up PointLight constructors
This commit is contained in:
parent
e72374b7db
commit
fcc6f1a718
2 changed files with 12 additions and 7 deletions
18
src/light.cc
18
src/light.cc
|
@ -17,7 +17,7 @@ AmbientLight::AmbientLight()
|
|||
|
||||
|
||||
AmbientLight::AmbientLight(const Color &c)
|
||||
: AmbientLight(c, 1.0)
|
||||
: AmbientLight(c, 0.0)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -44,6 +44,13 @@ AmbientLight::get_intensity()
|
|||
return intensity;
|
||||
}
|
||||
|
||||
void
|
||||
AmbientLight::set_intensity(const float &i)
|
||||
{
|
||||
intensity = i;
|
||||
_clamp_intensity();
|
||||
}
|
||||
|
||||
|
||||
Color
|
||||
AmbientLight::compute_color_contribution()
|
||||
|
@ -67,21 +74,18 @@ AmbientLight::_clamp_intensity()
|
|||
#pragma mark - Point Lights
|
||||
|
||||
PointLight::PointLight()
|
||||
: AmbientLight(),
|
||||
Object()
|
||||
: PointLight(Vector3())
|
||||
{ }
|
||||
|
||||
|
||||
PointLight::PointLight(const Vector3 &o)
|
||||
: AmbientLight(),
|
||||
Object(o)
|
||||
: PointLight(o, Color::White)
|
||||
{ }
|
||||
|
||||
|
||||
PointLight::PointLight(const Vector3 &o,
|
||||
const Color &c)
|
||||
: AmbientLight(c),
|
||||
Object(o)
|
||||
: PointLight(o, c, 1.0)
|
||||
{ }
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
|
||||
const Color &get_color() const;
|
||||
const float &get_intensity() const;
|
||||
void set_intensity(const float &i);
|
||||
|
||||
Color compute_color_contribution() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue