Fixed debug-mode compilation
-Also added multiplication operator and equality comparison to Cube and Rect Former-commit-id: b4194a50fbe3025d3be1fc25d48a85d5a05fc5ac
This commit is contained in:
@@ -127,6 +127,17 @@ bool NzCube<T>::IsValid() const
|
||||
return width > F(0.0) && height > F(0.0) && depth > F(0.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzCube<T>::MakeZero()
|
||||
{
|
||||
x = F(0.0);
|
||||
y = F(0.0);
|
||||
z = F(0.0);
|
||||
width = F(0.0);
|
||||
height = F(0.0);
|
||||
depth = F(0.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzCube<T>::Set(T X, T Y, T Z, T Width, T Height, T Depth)
|
||||
{
|
||||
@@ -229,6 +240,33 @@ T NzCube<T>::operator[](unsigned int i) const
|
||||
return *(&x+i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T> NzCube<T>::operator*(T scalar) const
|
||||
{
|
||||
return NzCube(x, y, z, width*scalar, height*scalar, depth*scalar);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>& NzCube<T>::operator*=(T scalar)
|
||||
{
|
||||
width *= scalar;
|
||||
height *= scalar;
|
||||
depth *= scalar;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzCube<T>::operator==(const NzCube& cube) const
|
||||
{
|
||||
return NzNumberEquals(x, cube.x) && NzNumberEquals(y, cube.y) && NzNumberEquals(z, cube.z) &&
|
||||
NzNumberEquals(width, cube.width) && NzNumberEquals(height, cube.height) && NzNumberEquals(depth, cube.depth);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzCube<T>::operator!=(const NzCube& cube) const
|
||||
{
|
||||
return !operator==(cube);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T> NzCube<T>::Lerp(const NzCube& from, const NzCube& to, T interpolation)
|
||||
{
|
||||
@@ -251,6 +289,15 @@ NzCube<T> NzCube<T>::Lerp(const NzCube& from, const NzCube& to, T interpolation)
|
||||
return cube;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T> NzCube<T>::Zero()
|
||||
{
|
||||
NzCube cube;
|
||||
cube.MakeZero();
|
||||
|
||||
return cube;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const NzCube<T>& cube)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user