diff --git a/src/basics.cc b/src/basics.cc index 0b8c81d..b2b55ea 100644 --- a/src/basics.cc +++ b/src/basics.cc @@ -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; +} diff --git a/src/basics.h b/src/basics.h index aff0d57..aca6795 100644 --- a/src/basics.h +++ b/src/basics.h @@ -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;