Integrate all the progress into master #6
|
@ -30,10 +30,10 @@ namespace GTETest {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto matrix = GTE::MATRIX::rotation(0, 0, rotation);
|
const auto matrix = GTE::MATRIX{
|
||||||
matrix.trans[0] = (Assets::Main::DoenerFishInfo.size.width/2);
|
GTE::ROTMATRIX::rotated(-rotation, rotation, -rotation),
|
||||||
matrix.trans[1] = (Assets::Main::DoenerFishInfo.size.height/2);
|
GTE::TRANSFERVECTOR::translated((Assets::Main::DoenerFishInfo.size.width/2), (Assets::Main::DoenerFishInfo.size.height/2))
|
||||||
|
};
|
||||||
doener_fish.apply(matrix);
|
doener_fish.apply(matrix);
|
||||||
rotation += 5_DEG;
|
rotation += 5_DEG;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,14 +19,12 @@ namespace GTETest {
|
||||||
|
|
||||||
void apply(const GTE::MATRIX& matrix) {
|
void apply(const GTE::MATRIX& matrix) {
|
||||||
static const auto apply_to = [](const GTE::MATRIX& matrix, GTE::SVECTOR vector) -> GPU::Vertex {
|
static const auto apply_to = [](const GTE::MATRIX& matrix, GTE::SVECTOR vector) -> GPU::Vertex {
|
||||||
GTE::MATRIX move_back = GTE::MATRIX::identity();
|
GTE::MATRIX move_back = GTE::MATRIX{
|
||||||
|
GTE::ROTMATRIX::identity(), GTE::TRANSFERVECTOR::translated(-matrix.transfer.x, -matrix.transfer.y, -matrix.transfer.z)
|
||||||
|
};
|
||||||
GTE::SVECTOR output;
|
GTE::SVECTOR output;
|
||||||
int32_t flag;
|
int32_t flag;
|
||||||
|
|
||||||
move_back.trans[0] = -matrix.trans[0];
|
|
||||||
move_back.trans[1] = -matrix.trans[1];
|
|
||||||
move_back.trans[2] = -matrix.trans[2];
|
|
||||||
|
|
||||||
GTE::comp_matrix(matrix, move_back, move_back);
|
GTE::comp_matrix(matrix, move_back, move_back);
|
||||||
return GTE::apply_matrix(move_back, vector, output).to<GPU::Vertex>();
|
return GTE::apply_matrix(move_back, vector, output).to<GPU::Vertex>();
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace JabyEngine {
|
||||||
Sets a 3x3 matrix m as a constant rotation matrix.
|
Sets a 3x3 matrix m as a constant rotation matrix.
|
||||||
matrix: The rotation matrix to set
|
matrix: The rotation matrix to set
|
||||||
*/
|
*/
|
||||||
static void set_rot_matrix(const MATRIX& matrix) {
|
static void set_rot_matrix(const ROTMATRIX& matrix) {
|
||||||
__asm__ volatile("lw $12, 0(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("lw $12, 0(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("lw $13, 4(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("lw $13, 4(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("ctc2 $12, $0" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("ctc2 $12, $0" :: "r"(&matrix) : "$12", "$13", "$14");
|
||||||
|
@ -49,7 +49,7 @@ namespace JabyEngine {
|
||||||
Writes the current 3x3 constant rotation matrix to matrix
|
Writes the current 3x3 constant rotation matrix to matrix
|
||||||
(This doesn't require us to use memory clobber)
|
(This doesn't require us to use memory clobber)
|
||||||
*/
|
*/
|
||||||
static void get_rot_matrix(MATRIX &matrix) {
|
static void get_rot_matrix(ROTMATRIX &matrix) {
|
||||||
__asm__ volatile("cfc2 $12, $0" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("cfc2 $12, $0" :: "r"(&matrix) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("cfc2 $13, $1" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("cfc2 $13, $1" :: "r"(&matrix) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("sw $12, 0(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("sw $12, 0(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
||||||
|
@ -67,13 +67,13 @@ namespace JabyEngine {
|
||||||
|
|
||||||
Sets a constant parallel transfer vector specified by m
|
Sets a constant parallel transfer vector specified by m
|
||||||
*/
|
*/
|
||||||
static void set_trans_matrix(const MATRIX& matrix) {
|
static void set_trans_vector(const TRANSFERVECTOR& vector) {
|
||||||
__asm__ volatile("lw $12, 20(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("lw $12, 0(%0)" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("lw $13, 24(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("lw $13, 4(%0)" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("ctc2 $12, $5" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("ctc2 $12, $5" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("lw $14, 28(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("lw $14, 8(%0)" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("ctc2 $13, $6" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("ctc2 $13, $6" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("ctc2 $14, $7" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("ctc2 $14, $7" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -82,13 +82,13 @@ namespace JabyEngine {
|
||||||
Writes the current constant parallel transfer vector to matrix
|
Writes the current constant parallel transfer vector to matrix
|
||||||
(This doesn't require us to use memory clobber)
|
(This doesn't require us to use memory clobber)
|
||||||
*/
|
*/
|
||||||
static void get_trans_matrix(MATRIX& matrix) {
|
static void get_trans_vector(TRANSFERVECTOR& vector) {
|
||||||
__asm__ volatile("cfc2 $14, $7" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("cfc2 $14, $7" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("cfc2 $13, $6" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("cfc2 $13, $6" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("sw $14, 28(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("sw $14, 8(%0)" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("cfc2 $12, $5" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("cfc2 $12, $5" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("sw $13, 24(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("sw $13, 4(%0)" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("sw $12, 20(%0)" :: "r"(&matrix) : "$12", "$13", "$14");
|
__asm__ volatile("sw $12, 0(%0)" :: "r"(&vector) : "$12", "$13", "$14");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -113,7 +113,7 @@ namespace JabyEngine {
|
||||||
Multiplies two matrices m0 and m1.
|
Multiplies two matrices m0 and m1.
|
||||||
The function destroys the constant rotation matrix
|
The function destroys the constant rotation matrix
|
||||||
*/
|
*/
|
||||||
MATRIX& multiply_matrix(const MATRIX& m0, const MATRIX& m1, MATRIX& result);
|
ROTMATRIX& multiply_matrix(const ROTMATRIX& m0, const ROTMATRIX& m1, ROTMATRIX& result);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CompMatrix
|
CompMatrix
|
||||||
|
@ -124,11 +124,11 @@ namespace JabyEngine {
|
||||||
return: returns result
|
return: returns result
|
||||||
*/
|
*/
|
||||||
static MATRIX& comp_matrix(const MATRIX& m0, const MATRIX& m1, MATRIX& result) {
|
static MATRIX& comp_matrix(const MATRIX& m0, const MATRIX& m1, MATRIX& result) {
|
||||||
multiply_matrix(m0, m1, result);
|
multiply_matrix(m0.rotation, m1.rotation, result.rotation);
|
||||||
set_trans_matrix(m0);
|
set_trans_vector(m0.transfer);
|
||||||
GTE::ldlv0(reinterpret_cast<const VECTOR&>(m1.trans));
|
GTE::ldlv0(reinterpret_cast<const VECTOR&>(m1.transfer));
|
||||||
GTE::rt();
|
GTE::rt();
|
||||||
GTE::stlvnl(reinterpret_cast<VECTOR&>(result.trans));
|
GTE::stlvnl(reinterpret_cast<VECTOR&>(result.transfer));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load column vector of MATRIX to universal register
|
// Load column vector of MATRIX to universal register
|
||||||
static __always_inline void ldclmv(const MATRIX& matrix, size_t col) {
|
static __always_inline void ldclmv(const ROTMATRIX& matrix, size_t col) {
|
||||||
__asm__ volatile("lhu $12, 0(%0)" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14");
|
__asm__ volatile("lhu $12, 0(%0)" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("lhu $13, 6(%0)" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14");
|
__asm__ volatile("lhu $13, 6(%0)" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14");
|
||||||
__asm__ volatile("lhu $14, 12(%0)" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14");
|
__asm__ volatile("lhu $14, 12(%0)" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14");
|
||||||
|
@ -50,7 +50,7 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store MATRIX column from 16 bit universal register
|
// Store MATRIX column from 16 bit universal register
|
||||||
static __always_inline void stclmv(MATRIX& matrix, size_t col) {
|
static __always_inline void stclmv(ROTMATRIX& matrix, size_t col) {
|
||||||
__asm__ volatile("mfc2 $12, $9" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14", "memory");
|
__asm__ volatile("mfc2 $12, $9" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14", "memory");
|
||||||
__asm__ volatile("mfc2 $13, $10" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14", "memory");
|
__asm__ volatile("mfc2 $13, $10" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14", "memory");
|
||||||
__asm__ volatile("mfc2 $14, $11" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14", "memory");
|
__asm__ volatile("mfc2 $14, $11" :: "r"(reinterpret_cast<uintptr_t>(&matrix) + (col << 1)) : "$12", "$13", "$14", "memory");
|
||||||
|
|
|
@ -10,14 +10,13 @@ namespace JabyEngine {
|
||||||
T x;
|
T x;
|
||||||
T y;
|
T y;
|
||||||
T z;
|
T z;
|
||||||
T pad;
|
|
||||||
|
|
||||||
static constexpr VECTOR create() {
|
static constexpr VECTOR create() {
|
||||||
return VECTOR::create(0, 0, 0);
|
return VECTOR::create(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr VECTOR create(T x, T y, T z) {
|
static constexpr VECTOR create(T x, T y, T z) {
|
||||||
return VECTOR{.x = x, .y = y, .z = z, .pad = 0};
|
return VECTOR{.x = x, .y = y, .z = z};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename S>
|
template<typename S>
|
||||||
|
@ -31,28 +30,41 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
using VECTOR = internal::VECTOR<int32_t>;
|
||||||
|
using SVECTOR = internal::VECTOR<int16_t>;
|
||||||
|
|
||||||
// TODO: Split MATRIX into ROTMATRIX and TRANSFERVECTOR or something like that. But first get it running
|
struct ROTMATRIX {
|
||||||
struct MATRIX {
|
int16_t matrix[3][3];
|
||||||
int16_t rot[3][3]; // Rotation matrix
|
|
||||||
int32_t trans[3]; // Translation vector
|
|
||||||
|
|
||||||
static constexpr MATRIX identity() {
|
static constexpr ROTMATRIX identity() {
|
||||||
return MATRIX{
|
return ROTMATRIX{.matrix = {
|
||||||
.rot = {
|
|
||||||
{4096, 0, 0},
|
{4096, 0, 0},
|
||||||
{0, 4096, 0},
|
{0, 4096, 0},
|
||||||
{0, 0, 4096}
|
{0, 0, 4096}
|
||||||
},
|
}
|
||||||
.trans = {0, 0, 0}
|
|
||||||
};
|
};
|
||||||
}
|
} // TODO: replace int32_t with something weird for the DEG stuff??
|
||||||
|
static ROTMATRIX rotated(int32_t x, int32_t y, int32_t z);
|
||||||
static MATRIX rotation(int32_t x, int32_t y, int32_t z);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using VECTOR = internal::VECTOR<int32_t>;
|
struct TRANSFERVECTOR : public VECTOR {
|
||||||
using SVECTOR = internal::VECTOR<int16_t>;
|
static constexpr TRANSFERVECTOR identity() {
|
||||||
|
return TRANSFERVECTOR::translated();
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr TRANSFERVECTOR translated(int32_t x = 0, int32_t y = 0, int32_t z = 0) {
|
||||||
|
return TRANSFERVECTOR{{.x = x, .y = y, .z = z}};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MATRIX {
|
||||||
|
ROTMATRIX rotation;
|
||||||
|
TRANSFERVECTOR transfer;
|
||||||
|
|
||||||
|
static constexpr MATRIX identity() {
|
||||||
|
return MATRIX{.rotation = ROTMATRIX::identity(), .transfer = TRANSFERVECTOR::identity()};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static constexpr auto one_degree = FULL_CIRCLE/360;
|
static constexpr auto one_degree = FULL_CIRCLE/360;
|
||||||
static constexpr auto one_tenth_degree = FULL_CIRCLE/3600;
|
static constexpr auto one_tenth_degree = FULL_CIRCLE/3600;
|
||||||
|
|
|
@ -32,74 +32,6 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_gte() {
|
|
||||||
#define gte_MulMatrix0(r1,r2,r3) \
|
|
||||||
{ gte_SetRotMatrix(r1); \
|
|
||||||
gte_ldclmv(r2); \
|
|
||||||
gte_rtir(); \
|
|
||||||
gte_stclmv(r3); \
|
|
||||||
gte_ldclmv((char*)r2+2);\
|
|
||||||
gte_rtir(); \
|
|
||||||
gte_stclmv((char*)r3+2);\
|
|
||||||
gte_ldclmv((char*)r2+4);\
|
|
||||||
gte_rtir(); \
|
|
||||||
gte_stclmv((char*)r3+4); }
|
|
||||||
|
|
||||||
const auto m0 = GTE::MATRIX::identity();
|
|
||||||
const auto m1 = GTE::MATRIX::identity();
|
|
||||||
auto m2 = GTE::MATRIX::identity();
|
|
||||||
|
|
||||||
asm("# PLANSCHI START");
|
|
||||||
JabyEngine::GTE::multiply_matrix(m0, m1, m2);
|
|
||||||
asm("# PLANSCHI END");
|
|
||||||
|
|
||||||
#define PI 3.14159265 // v 90°???
|
|
||||||
|
|
||||||
static const auto display_stuff = [](int32_t angle) {
|
|
||||||
static const auto wanna_be_float = [](int32_t value) -> int32_t {
|
|
||||||
return (value*10000)/(4096);
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto sin_value = sin(GTE::in_degree(angle));
|
|
||||||
const auto cos_value = cos(GTE::in_degree(angle));
|
|
||||||
|
|
||||||
printf("Sine of %i = %i (%i)\n", angle, sin_value, wanna_be_float(sin_value));
|
|
||||||
printf("Cos of %i = %i (%i)\n", angle, cos_value, wanna_be_float(cos_value));
|
|
||||||
};
|
|
||||||
|
|
||||||
static const auto print_matrix = [](const GTE::MATRIX& matrix) {
|
|
||||||
printf("{%i, %i, %i}\n", matrix.rot[0][0], matrix.rot[0][1], matrix.rot[0][2]);
|
|
||||||
printf("{%i, %i, %i}\n", matrix.rot[1][0], matrix.rot[1][1], matrix.rot[1][2]);
|
|
||||||
printf("{%i, %i, %i}\n", matrix.rot[2][0], matrix.rot[2][1], matrix.rot[2][2]);
|
|
||||||
printf("{%i, %i, %i}\n", matrix.trans[0], matrix.trans[1], matrix.trans[2]);
|
|
||||||
};
|
|
||||||
|
|
||||||
static const auto make_matrix = [](int16_t mult) -> GTE::MATRIX {
|
|
||||||
return GTE::MATRIX {
|
|
||||||
.rot = {
|
|
||||||
{static_cast<int16_t>(1*mult), static_cast<int16_t>(2*mult), static_cast<int16_t>(3*mult)},
|
|
||||||
{static_cast<int16_t>(2*mult), static_cast<int16_t>(3*mult), static_cast<int16_t>(1*mult)},
|
|
||||||
{static_cast<int16_t>(3*mult), static_cast<int16_t>(1*mult), static_cast<int16_t>(2*mult)},
|
|
||||||
},
|
|
||||||
.trans = {6*mult, 7*mult, 8*mult}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
display_stuff(25);
|
|
||||||
display_stuff(45);
|
|
||||||
display_stuff(75);
|
|
||||||
display_stuff(90);
|
|
||||||
|
|
||||||
for(size_t n = 0; n < 3; n++) {
|
|
||||||
GTE::push_matrix_and_set(make_matrix(n + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
for(size_t n = 0; n < 3; n++) {
|
|
||||||
print_matrix(GTE::get_and_pop_matrix());
|
|
||||||
printf("---\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace boot {
|
namespace boot {
|
||||||
namespace Start {
|
namespace Start {
|
||||||
static void setup() {
|
static void setup() {
|
||||||
|
@ -128,7 +60,6 @@ namespace JabyEngine {
|
||||||
GPU::display_logo();
|
GPU::display_logo();
|
||||||
GTE::setup();
|
GTE::setup();
|
||||||
test_bios_font();
|
test_bios_font();
|
||||||
test_gte();
|
|
||||||
|
|
||||||
//Pause??
|
//Pause??
|
||||||
SPU::setup();
|
SPU::setup();
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace JabyEngine {
|
||||||
return v1;
|
return v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MATRIX& multiply_matrix(const MATRIX& m0, const MATRIX& m1, MATRIX& result) {
|
ROTMATRIX& multiply_matrix(const ROTMATRIX& m0, const ROTMATRIX& m1, ROTMATRIX& result) {
|
||||||
set_rot_matrix(m0);
|
set_rot_matrix(m0);
|
||||||
|
|
||||||
JabyEngine::GTE::ldclmv(m1, 0);
|
JabyEngine::GTE::ldclmv(m1, 0);
|
||||||
|
@ -72,15 +72,15 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_matrix(const MATRIX& matrix) {
|
void set_matrix(const MATRIX& matrix) {
|
||||||
set_rot_matrix(matrix);
|
set_rot_matrix(matrix.rotation);
|
||||||
set_trans_matrix(matrix);
|
set_trans_vector(matrix.transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
MATRIX get_matrix() {
|
MATRIX get_matrix() {
|
||||||
MATRIX matrix;
|
MATRIX matrix;
|
||||||
|
|
||||||
get_rot_matrix(matrix);
|
get_rot_matrix(matrix.rotation);
|
||||||
get_trans_matrix(matrix);
|
get_trans_vector(matrix.transfer);
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,24 +106,24 @@ namespace JabyEngine {
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
MATRIX MATRIX :: rotation(int32_t x, int32_t y, int32_t z) {
|
ROTMATRIX ROTMATRIX :: rotated(int32_t x, int32_t y, int32_t z) {
|
||||||
using namespace MatrixHelper;
|
using namespace MatrixHelper;
|
||||||
|
|
||||||
const auto sincos_x = SinCosPair::create_for(x);
|
const auto sincos_x = SinCosPair::create_for(x);
|
||||||
const auto sincos_y = SinCosPair::create_for(y);
|
const auto sincos_y = SinCosPair::create_for(y);
|
||||||
const auto sincos_z = SinCosPair::create_for(z);
|
const auto sincos_z = SinCosPair::create_for(z);
|
||||||
|
|
||||||
auto rotX = MATRIX::identity();
|
auto rotX = ROTMATRIX::identity();
|
||||||
rotX.rot[1][1] = sincos_x.cos; rotX.rot[1][2] = -sincos_x.sin;
|
rotX.matrix[1][1] = sincos_x.cos; rotX.matrix[1][2] = -sincos_x.sin;
|
||||||
rotX.rot[2][1] = sincos_x.sin; rotX.rot[2][2] = sincos_x.cos;
|
rotX.matrix[2][1] = sincos_x.sin; rotX.matrix[2][2] = sincos_x.cos;
|
||||||
|
|
||||||
auto rotY = MATRIX::identity();
|
auto rotY = ROTMATRIX::identity();
|
||||||
rotY.rot[0][0] = sincos_y.cos; rotY.rot[0][2] = sincos_y.sin;
|
rotY.matrix[0][0] = sincos_y.cos; rotY.matrix[0][2] = sincos_y.sin;
|
||||||
rotY.rot[2][0] = -sincos_y.sin; rotY.rot[2][2] = sincos_y.cos;
|
rotY.matrix[2][0] = -sincos_y.sin; rotY.matrix[2][2] = sincos_y.cos;
|
||||||
|
|
||||||
auto rotZ = MATRIX::identity();
|
auto rotZ = ROTMATRIX::identity();
|
||||||
rotZ.rot[0][0] = sincos_z.cos; rotZ.rot[0][1] = -sincos_z.sin;
|
rotZ.matrix[0][0] = sincos_z.cos; rotZ.matrix[0][1] = -sincos_z.sin;
|
||||||
rotZ.rot[1][0] = sincos_z.sin; rotZ.rot[1][1] = sincos_z.cos;
|
rotZ.matrix[1][0] = sincos_z.sin; rotZ.matrix[1][1] = sincos_z.cos;
|
||||||
|
|
||||||
push_matrix();
|
push_matrix();
|
||||||
multiply_matrix(rotX, rotY, rotX);
|
multiply_matrix(rotX, rotY, rotX);
|
||||||
|
|
Loading…
Reference in New Issue