Got the animator fades working
This commit is contained in:
@@ -3,17 +3,31 @@
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
|
||||
template <typename Type>
|
||||
class V3D{
|
||||
public:
|
||||
constexpr V3D(const V3D& other):
|
||||
x(other.x),
|
||||
y(other.y),
|
||||
z(other.z){}
|
||||
z(other.z){
|
||||
static_assert(std::is_arithmetic<Type>::value, "Type must be a number");
|
||||
}
|
||||
|
||||
constexpr V3D(uint32_t x=0, uint32_t y=0, uint32_t z=0):
|
||||
constexpr V3D(Type x=0, Type y=0, Type z=0):
|
||||
x(x),
|
||||
y(y),
|
||||
z(z){}
|
||||
z(z){
|
||||
static_assert(std::is_arithmetic<Type>::value, "Type must be a number");
|
||||
}
|
||||
|
||||
template <typename OtherType>
|
||||
constexpr V3D(const V3D<OtherType> other):
|
||||
x(static_cast<Type>(other.x)),
|
||||
y(static_cast<Type>(other.y)),
|
||||
z(static_cast<Type>(other.z)){
|
||||
static_assert(std::is_arithmetic<Type>::value, "Type must be a number");
|
||||
static_assert(std::is_arithmetic<OtherType>::value, "OtherType must be a number");
|
||||
}
|
||||
|
||||
V3D& operator=(const V3D &other){
|
||||
this->x = other.x;
|
||||
@@ -36,7 +50,7 @@ class V3D{
|
||||
return *this;
|
||||
}
|
||||
|
||||
V3D& operator/=(const uint32_t scalar){
|
||||
V3D& operator/=(const Type scalar){
|
||||
if(scalar == 0){
|
||||
return *this;
|
||||
}
|
||||
@@ -46,7 +60,7 @@ class V3D{
|
||||
return *this;
|
||||
}
|
||||
|
||||
V3D& operator*=(const uint32_t scalar){
|
||||
V3D& operator*=(const Type scalar){
|
||||
this->x *= scalar;
|
||||
this->y *= scalar;
|
||||
this->z *= scalar;
|
||||
@@ -58,9 +72,9 @@ class V3D{
|
||||
}
|
||||
|
||||
float magnitude(){
|
||||
return std::sqrt(this->x * this->x + this->y * this->y + this->z * this-> z);
|
||||
return std::sqrt(static_cast<float>(this->x * this->x + this->y * this->y + this->z * this->z));
|
||||
}
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t z;
|
||||
Type x;
|
||||
Type y;
|
||||
Type z;
|
||||
};
|
||||
Reference in New Issue
Block a user