=== modified file 'test/const_vec_test.cc'
@@ -27,6 +27,8 @@
const vec2 b(2.0, 2.0);
vec2 aplusb(a + b);
vec2 aminusb(a - b);
+ vec2 atimesb(a * b);
+ vec2 adivb(a / b);
}
void
@@ -36,6 +38,8 @@
const vec3 b(2.0, 2.0, 2.0);
vec3 aplusb(a + b);
vec3 aminusb(a - b);
+ vec3 atimesb(a * b);
+ vec3 adivb(a / b);
}
void
@@ -45,4 +49,6 @@
const vec4 b(2.0, 2.0, 2.0, 2.0);
vec4 aplusb(a + b);
vec4 aminusb(a - b);
+ vec4 atimesb(a * b);
+ vec4 adivb(a / b);
}
=== modified file 'vec.h'
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2010 Linaro Limited
+// Copyright (c) 2010-2011 Linaro Limited
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the MIT License which accompanies
@@ -69,6 +69,18 @@
return tvec2(*this) /= rhs;
}
+ tvec2& operator/=(const tvec2& rhs)
+ {
+ x_ /= rhs.x_;
+ y_ /= rhs.y_;
+ return *this;
+ }
+
+ const tvec2 operator/(const tvec2& rhs) const
+ {
+ return tvec2(*this) /= rhs;
+ }
+
tvec2& operator*=(const T& rhs)
{
x_ *= rhs;
@@ -81,6 +93,18 @@
return tvec2(*this) *= rhs;
}
+ tvec2& operator*=(const tvec2& rhs)
+ {
+ x_ *= rhs.x_;
+ y_ *= rhs.y_;
+ return *this;
+ }
+
+ const tvec2 operator*(const tvec2& rhs) const
+ {
+ return tvec2(*this) *= rhs;
+ }
+
tvec2& operator+=(const T& rhs)
{
x_ += rhs;
@@ -211,6 +235,19 @@
return tvec3(*this) /= rhs;
}
+ tvec3& operator/=(const tvec3& rhs)
+ {
+ x_ /= rhs.x_;
+ y_ /= rhs.y_;
+ z_ /= rhs.z_;
+ return *this;
+ }
+
+ const tvec3 operator/(const tvec3& rhs) const
+ {
+ return tvec3(*this) /= rhs;
+ }
+
tvec3& operator*=(const T& rhs)
{
x_ *= rhs;
@@ -224,6 +261,19 @@
return tvec3(*this) *= rhs;
}
+ tvec3& operator*=(const tvec3& rhs)
+ {
+ x_ *= rhs.x_;
+ y_ *= rhs.y_;
+ z_ *= rhs.z_;
+ return *this;
+ }
+
+ const tvec3 operator*(const tvec3& rhs) const
+ {
+ return tvec3(*this) *= rhs;
+ }
+
tvec3& operator+=(const T& rhs)
{
x_ += rhs;
@@ -375,6 +425,20 @@
return tvec4(*this) /= rhs;
}
+ tvec4& operator/=(const tvec4& rhs)
+ {
+ x_ /= rhs.x_;
+ y_ /= rhs.y_;
+ z_ /= rhs.z_;
+ w_ /= rhs.w_;
+ return *this;
+ }
+
+ const tvec4 operator/(const tvec4& rhs) const
+ {
+ return tvec4(*this) /= rhs;
+ }
+
tvec4& operator*=(const T& rhs)
{
x_ *= rhs;
@@ -389,6 +453,20 @@
return tvec4(*this) *= rhs;
}
+ tvec4& operator*=(const tvec4& rhs)
+ {
+ x_ *= rhs.x_;
+ y_ *= rhs.y_;
+ z_ *= rhs.z_;
+ w_ *= rhs.w_;
+ return *this;
+ }
+
+ const tvec4 operator*(const tvec4& rhs) const
+ {
+ return tvec4(*this) *= rhs;
+ }
+
tvec4& operator+=(const T& rhs)
{
x_ += rhs;