Made Cube/Rect more user-friendly
Former-commit-id: 13ac0b9f6428059596c98f636caf61afd2a436b7
This commit is contained in:
@@ -10,6 +10,12 @@
|
||||
|
||||
#define F(a) static_cast<T>(a)
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>::NzCube(T Width, T Height, T Depth)
|
||||
{
|
||||
Set(Width, Height, Depth);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>::NzCube(T X, T Y, T Z, T Width, T Height, T Depth)
|
||||
{
|
||||
@@ -22,6 +28,12 @@ NzCube<T>::NzCube(const NzRect<T>& rect)
|
||||
Set(rect);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>::NzCube(const NzVector3<T>& size)
|
||||
{
|
||||
Set(size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>::NzCube(const NzVector3<T>& vec1, const NzVector3<T>& vec2)
|
||||
{
|
||||
@@ -258,6 +270,19 @@ NzCube<T>& NzCube<T>::MakeZero()
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>& NzCube<T>::Set(T Width, T Height, T Depth)
|
||||
{
|
||||
x = F(0.0);
|
||||
y = F(0.0);
|
||||
z = F(0.0);
|
||||
width = Width;
|
||||
height = Height;
|
||||
depth = Depth;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>& NzCube<T>::Set(T X, T Y, T Z, T Width, T Height, T Depth)
|
||||
{
|
||||
@@ -305,6 +330,12 @@ NzCube<T>& NzCube<T>::Set(const NzRect<T>& rect)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>& NzCube<T>::Set(const NzVector3<T>& size)
|
||||
{
|
||||
return Set(size.x, size.y, size.z);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>& NzCube<T>::Set(const NzVector3<T>& vec1, const NzVector3<T>& vec2)
|
||||
{
|
||||
@@ -393,6 +424,12 @@ 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*(const NzVector3<T>& vec) const
|
||||
{
|
||||
return NzCube(x, y, z, width*vec.x, height*vec.y, depth*vec.z);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>& NzCube<T>::operator*=(T scalar)
|
||||
{
|
||||
@@ -401,6 +438,14 @@ NzCube<T>& NzCube<T>::operator*=(T scalar)
|
||||
depth *= scalar;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>& NzCube<T>::operator*=(const NzVector3<T>& vec)
|
||||
{
|
||||
width *= vec.x;
|
||||
height *= vec.y;
|
||||
depth *= vec.z;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzCube<T>::operator==(const NzCube& cube) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user