Add RGB constructor to color

This commit is contained in:
Eryn Wells 2013-09-13 14:10:52 -07:00
parent 6fcfcd09b5
commit 9fef3c33d2
2 changed files with 13 additions and 2 deletions

View file

@ -279,12 +279,22 @@ Color::Color()
{ } { }
/*
* Color::Color --
*
* Constructor. Create a new Color with the given RGB components. Alpha is 1.0.
*/
Color::Color(const float &r, const float &g, const float &b)
: Color(r, g, b, 1.0)
{ }
/* /*
* Color::Color -- * Color::Color --
* *
* Constructor. Create a new Color with the given components. * Constructor. Create a new Color with the given components.
*/ */
Color::Color(float r, float g, float b, float a) Color::Color(const float &r, const float &g, const float &b, const float &a)
: red(r), green(g), blue(b), alpha(a) : red(r), green(g), blue(b), alpha(a)
{ } { }

View file

@ -58,7 +58,8 @@ struct Ray
struct Color struct Color
{ {
Color(); Color();
Color(float r, float g, float b, float a); Color(const float &r, const float &g, const float &b);
Color(const float &r, const float &g, const float &b, const float &a);
Color &operator*=(const float &rhs); Color &operator*=(const float &rhs);
Color &operator/=(const float &rhs); Color &operator/=(const float &rhs);