Fixed debug-mode compilation
-Also added multiplication operator and equality comparison to Cube and Rect Former-commit-id: b4194a50fbe3025d3be1fc25d48a85d5a05fc5ac
This commit is contained in:
@@ -112,6 +112,15 @@ bool NzRect<T>::IsValid() const
|
||||
return width > F(0.0) && height > F(0.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzRect<T>::MakeZero()
|
||||
{
|
||||
x = F(0.0);
|
||||
y = F(0.0);
|
||||
width = F(0.0);
|
||||
height = F(0.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzRect<T>::Set(T X, T Y, T Width, T Height)
|
||||
{
|
||||
@@ -195,6 +204,32 @@ T NzRect<T>::operator[](unsigned int i) const
|
||||
return *(&x+i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T> NzRect<T>::operator*(T scalar) const
|
||||
{
|
||||
return NzRect(x, y, width*scalar, height*scalar);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T>& NzRect<T>::operator*=(T scalar)
|
||||
{
|
||||
width *= scalar;
|
||||
height *= scalar;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzRect<T>::operator==(const NzRect& rect) const
|
||||
{
|
||||
return NzNumberEquals(x, rect.x) && NzNumberEquals(y, rect.y) &&
|
||||
NzNumberEquals(width, rect.width) && NzNumberEquals(height, rect.height);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzRect<T>::operator!=(const NzRect& rect) const
|
||||
{
|
||||
return !operator==(rect);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T> NzRect<T>::Lerp(const NzRect& from, const NzRect& to, T interpolation)
|
||||
{
|
||||
@@ -215,6 +250,15 @@ NzRect<T> NzRect<T>::Lerp(const NzRect& from, const NzRect& to, T interpolation)
|
||||
return rect;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzRect<T> NzRect<T>::Zero()
|
||||
{
|
||||
NzRect rect;
|
||||
rect.MakeZero();
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const NzRect<T>& rect)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user