summaryrefslogtreecommitdiffstats
path: root/Common/interface
diff options
context:
space:
mode:
Diffstat (limited to 'Common/interface')
-rw-r--r--Common/interface/BasicMath.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/Common/interface/BasicMath.h b/Common/interface/BasicMath.h
index f9af0d56..33922e9e 100644
--- a/Common/interface/BasicMath.h
+++ b/Common/interface/BasicMath.h
@@ -221,6 +221,16 @@ template <class T> struct Vector2
static_cast<T>(*it++)
};
}
+
+ template<typename Y>
+ Vector2<Y> Recast()const
+ {
+ return Vector2<Y>
+ {
+ static_cast<Y>(x),
+ static_cast<Y>(y)
+ };
+ }
};
template <class T>
@@ -406,6 +416,17 @@ template <class T> struct Vector3
};
}
+ template<typename Y>
+ Vector3<Y> Recast()const
+ {
+ return Vector3<Y>
+ {
+ static_cast<Y>(x),
+ static_cast<Y>(y),
+ static_cast<Y>(z)
+ };
+ }
+
operator Vector2<T>()const{return Vector2<T>(x,y);}
};
@@ -613,6 +634,18 @@ template <class T> struct Vector4
};
}
+ template<typename Y>
+ Vector4<Y> Recast()const
+ {
+ return Vector4<Y>
+ {
+ static_cast<Y>(x),
+ static_cast<Y>(y),
+ static_cast<Y>(z),
+ static_cast<Y>(w)
+ };
+ }
+
operator Vector3<T>() const
{
return Vector3<T>(x, y, z);