allow explicit casts between vectors of different underlying types

This commit is contained in:
Ricardo Luís Vaz Silva 2023-02-03 21:17:38 -03:00 committed by Rachael Alexanderson
parent 9d0beeaafe
commit e6124627e4

View file

@ -98,6 +98,11 @@ struct TVector2
{
}
template<typename U>
explicit operator TVector2<U> () const noexcept {
return TVector2<U>(static_cast<U>(X), static_cast<U>(Y));
}
void Zero()
{
Y = X = 0;
@ -375,6 +380,11 @@ struct TVector3
}
TVector3 (const TRotator<vec_t> &rot);
template<typename U>
explicit operator TVector3<U> () const noexcept {
return TVector3<U>(static_cast<U>(X), static_cast<U>(Y), static_cast<U>(Z));
}
void Zero()
{
@ -738,6 +748,11 @@ struct TVector4
{
}
template<typename U>
explicit operator TVector4<U> () const noexcept {
return TVector4<U>(static_cast<U>(X), static_cast<U>(Y), static_cast<U>(Z), static_cast<U>(W));
}
void Zero()
{
Z = Y = X = W = 0;