diff options
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/color.cc | 12 | ||||
-rw-r--r-- | src/math/color.h | 5 | ||||
-rw-r--r-- | src/math/vector3f.cc | 1 | ||||
-rw-r--r-- | src/math/vector3f.h | 4 |
4 files changed, 16 insertions, 6 deletions
diff --git a/src/math/color.cc b/src/math/color.cc index 05f3b4c..ecdfd2f 100644 --- a/src/math/color.cc +++ b/src/math/color.cc @@ -10,13 +10,15 @@ namespace math { -Color::Color() +Color::Color() : + r(_r), g(_g), b(_b), a(_a) { _r = _g = _b = 0.0f; _a = 1.0f; } -Color::Color(const float red, const float green , const float blue , const float alpha) +Color::Color(const float red, const float green , const float blue , const float alpha) : + r(_r), g(_g), b(_b), a(_a) { _r = red; _g = green; @@ -24,13 +26,15 @@ Color::Color(const float red, const float green , const float blue , const float _a = alpha; } -Color::Color(const float grey, const float alpha) +Color::Color(const float grey, const float alpha) : + r(_r), g(_g), b(_b), a(_a) { _r = _g = _b = grey; _a = alpha; } -Color::Color(const Color &other) +Color::Color(const Color &other) : + r(_r), g(_g), b(_b), a(_a) { this->operator=(other); } diff --git a/src/math/color.h b/src/math/color.h index 078faaa..51b415f 100644 --- a/src/math/color.h +++ b/src/math/color.h @@ -37,6 +37,11 @@ public: static const Color Green() { return Color(0.0f,1.0f,0.0f); }; static const Color Blue() { return Color(0.0f, 0.0f, 1.0f); }; static const Color Yellow() { return Color(1.0f, 1.0f, 0.0f); }; + + float &r; + float &g; + float &b; + float &a; private: void normalize(); diff --git a/src/math/vector3f.cc b/src/math/vector3f.cc index 371ada1..3f1f4ac 100644 --- a/src/math/vector3f.cc +++ b/src/math/vector3f.cc @@ -170,4 +170,5 @@ float dotproduct(const Vector3f& first, const Vector3f& second) r += first[i] * second[i]; return (r); } + } // namespace math diff --git a/src/math/vector3f.h b/src/math/vector3f.h index c2ebc6a..5d1fa41 100644 --- a/src/math/vector3f.h +++ b/src/math/vector3f.h @@ -145,9 +145,9 @@ Vector3f operator*(float scalar, const Vector3f& vector); /// vector cross product const Vector3f crossproduct(Vector3f const & first, Vector3f const & second); -/// vetor dot product +/// vector dot product float dotproduct(const Vector3f& first, const Vector3f& second); -} // namespace Math +} // namespace math #endif // __INCLUDED_MATH_VECTOR3F_H__ |