Add operator*= to colors
This commit is contained in:
parent
51c79b9b76
commit
c6c11ca95a
2 changed files with 14 additions and 2 deletions
|
@ -198,7 +198,8 @@ Ray::Ray(Vector3 o, Vector3 d)
|
|||
* Compute and return the point given by parameterizing this Ray by time t.
|
||||
*/
|
||||
Vector3
|
||||
Ray::parameterize(float t)
|
||||
Ray::parameterize(const float t)
|
||||
const
|
||||
{
|
||||
return origin + t * direction;
|
||||
}
|
||||
|
@ -241,3 +242,13 @@ Color::operator=(const Color &c)
|
|||
alpha = c.alpha;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Color &
|
||||
Color::operator*=(const float f)
|
||||
{
|
||||
red *= f;
|
||||
green *= f;
|
||||
blue *= f;
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ struct Ray
|
|||
Ray();
|
||||
Ray(Vector3 o, Vector3 d);
|
||||
|
||||
Vector3 parameterize(float t);
|
||||
Vector3 parameterize(const float t) const;
|
||||
|
||||
Vector3 origin, direction;
|
||||
};
|
||||
|
@ -54,6 +54,7 @@ struct Color
|
|||
Color(float r, float g, float b, float a);
|
||||
|
||||
Color &operator=(const Color &c);
|
||||
Color &operator*=(const float c);
|
||||
|
||||
static const Color Black;
|
||||
static const Color White;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue