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::AmbientLight(const Color &c)
|
||||||
: AmbientLight(c, 1.0)
|
: AmbientLight(c, 0.0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +44,13 @@ AmbientLight::get_intensity()
|
||||||
return intensity;
|
return intensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AmbientLight::set_intensity(const float &i)
|
||||||
|
{
|
||||||
|
intensity = i;
|
||||||
|
_clamp_intensity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Color
|
Color
|
||||||
AmbientLight::compute_color_contribution()
|
AmbientLight::compute_color_contribution()
|
||||||
|
@ -67,21 +74,18 @@ AmbientLight::_clamp_intensity()
|
||||||
#pragma mark - Point Lights
|
#pragma mark - Point Lights
|
||||||
|
|
||||||
PointLight::PointLight()
|
PointLight::PointLight()
|
||||||
: AmbientLight(),
|
: PointLight(Vector3())
|
||||||
Object()
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
PointLight::PointLight(const Vector3 &o)
|
PointLight::PointLight(const Vector3 &o)
|
||||||
: AmbientLight(),
|
: PointLight(o, Color::White)
|
||||||
Object(o)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
PointLight::PointLight(const Vector3 &o,
|
PointLight::PointLight(const Vector3 &o,
|
||||||
const Color &c)
|
const Color &c)
|
||||||
: AmbientLight(c),
|
: PointLight(o, c, 1.0)
|
||||||
Object(o)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
const Color &get_color() const;
|
const Color &get_color() const;
|
||||||
const float &get_intensity() const;
|
const float &get_intensity() const;
|
||||||
|
void set_intensity(const float &i);
|
||||||
|
|
||||||
Color compute_color_contribution() const;
|
Color compute_color_contribution() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue