mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
allow explicit casts between vectors of different underlying types
This commit is contained in:
parent
9d0beeaafe
commit
e6124627e4
1 changed files with 15 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue