Add operator= to Vector3 and Color
This commit is contained in:
parent
e5601e7f43
commit
6de49ae679
2 changed files with 25 additions and 0 deletions
|
@ -37,6 +37,16 @@ Vector3::Vector3(float _x, float _y, float _z)
|
|||
{ }
|
||||
|
||||
|
||||
inline Vector3 &
|
||||
Vector3::operator=(const Vector3 &v)
|
||||
{
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Vector3::operator+ --
|
||||
*
|
||||
|
@ -220,3 +230,14 @@ Color::Color()
|
|||
Color::Color(float r, float g, float b, float a)
|
||||
: red(r), green(g), blue(b), alpha(a)
|
||||
{ }
|
||||
|
||||
|
||||
inline Color &
|
||||
Color::operator=(const Color &c)
|
||||
{
|
||||
red = c.red;
|
||||
green = c.green;
|
||||
blue = c.blue;
|
||||
alpha = c.alpha;
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ struct Vector3
|
|||
Vector3();
|
||||
Vector3(float x, float y, float z);
|
||||
|
||||
Vector3 &operator=(const Vector3 &v);
|
||||
|
||||
Vector3 operator+(Vector3 v) const;
|
||||
Vector3 operator*(float a) const;
|
||||
Vector3 operator-(Vector3 v) const;
|
||||
|
@ -51,6 +53,8 @@ struct Color
|
|||
Color();
|
||||
Color(float r, float g, float b, float a);
|
||||
|
||||
Color &operator=(const Color &c);
|
||||
|
||||
static const Color Black;
|
||||
static const Color White;
|
||||
static const Color Red;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue