From 6f71ba51932d9032f0008afedf6840fb8559ecd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 9 Jan 2011 01:32:25 +0100 Subject: [PATCH] Allow constructing Vector4 from Vector3 with optional W value. --- src/Math/Vector4.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Math/Vector4.h b/src/Math/Vector4.h index 01c2e0bd3..99334cd45 100644 --- a/src/Math/Vector4.h +++ b/src/Math/Vector4.h @@ -52,6 +52,15 @@ template class Vector4: public Vector { setX(x); setY(y); setZ(z); setW(w); } + /** + * @brief Constructor + * @param other Three component vector + * @param w W / A value + */ + inline Vector4(const Vector& other, T w = T(1)) { + setX(other[0]); setY(other[1]); setZ(other[2]); setW(w); + } + inline T x() const { return Vector::at(0); } /**< @brief X component */ inline T y() const { return Vector::at(1); } /**< @brief Y component */ inline T z() const { return Vector::at(2); } /**< @brief Z component */