Created deg struct for better usage of degree
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "../GPU/gpu_types.hpp"
|
||||
#include "../../math.h"
|
||||
#include "../../math.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace GTE {
|
||||
@@ -44,8 +44,9 @@ namespace JabyEngine {
|
||||
{0, 0, 4096}
|
||||
}
|
||||
};
|
||||
} // TODO: replace int32_t with something weird for the DEG stuff??
|
||||
static ROTMATRIX rotated(int32_t x, int32_t y, int32_t z);
|
||||
}
|
||||
|
||||
static ROTMATRIX rotated(deg_t x = deg_t::zero(), deg_t y = deg_t::zero(), deg_t z = deg_t::zero());
|
||||
};
|
||||
|
||||
struct TRANSFERVECTOR : public VECTOR {
|
||||
@@ -70,8 +71,8 @@ namespace JabyEngine {
|
||||
return MATRIX{.rotation = ROTMATRIX::identity(), .transfer = TRANSFERVECTOR::translated(x, y, z)};
|
||||
}
|
||||
|
||||
static constexpr MATRIX rotated(int32_t x_deg = 0, int32_t y_deg = 0, int32_t z_deg = 0) {
|
||||
return MATRIX{.rotation = ROTMATRIX::rotated(x_deg, y_deg, z_deg), .transfer = TRANSFERVECTOR::identity()};
|
||||
static MATRIX rotated(deg_t x = deg_t::zero(), deg_t y = deg_t::zero(), deg_t z = deg_t::zero()) {
|
||||
return MATRIX{.rotation = ROTMATRIX::rotated(x, y, z), .transfer = TRANSFERVECTOR::identity()};
|
||||
}
|
||||
|
||||
static MATRIX comp(MATRIX new_matrix, const MATRIX& matrix) {
|
||||
@@ -83,24 +84,5 @@ namespace JabyEngine {
|
||||
GPU::Vertex& apply_to(GPU::Vertex& vertex) const;
|
||||
GPU::Vertex apply_to(const GPU::Vertex& vertex) const;
|
||||
};
|
||||
|
||||
static constexpr auto one_degree = FULL_CIRCLE/360;
|
||||
static constexpr auto one_tenth_degree = FULL_CIRCLE/3600;
|
||||
|
||||
static constexpr int16_t in_degree(int32_t degree) {
|
||||
return degree*one_degree;
|
||||
}
|
||||
|
||||
static constexpr int16_t in_degree10(int32_t degree) {
|
||||
return degree*one_tenth_degree;
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr unsigned long long operator""_DEG(unsigned long long degree) {
|
||||
return GTE::in_degree(degree);
|
||||
}
|
||||
|
||||
static constexpr unsigned long long operator""_DEG10(unsigned long long degree) {
|
||||
return GTE::in_degree10(degree);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user