Support apply_matrix on Vertex type

This commit is contained in:
2024-04-03 17:30:37 -05:00
parent 1bf91b2d75
commit 605162a55d
6 changed files with 57 additions and 39 deletions

View File

@@ -5,6 +5,20 @@ namespace JabyEngine {
namespace GTE {
static constexpr auto StackSize = 16;
/*
matrix: first input
Sets the 3x3 constant rotation matrix and the parallel transfer vector from input
*/
void set_matrix(const MATRIX& matrix);
/*
returns: current matrix
Gets the current 3x3 constant rotation matrix and the parallel transfer vector
*/
MATRIX get_matrix();
/*
RotTrans
@@ -99,8 +113,28 @@ namespace JabyEngine {
returns: result
Applies the matrix to the vector
The function destroys the constant rotation matrix and transfer vector
*/
SVECTOR& apply_matrix(const MATRIX& m0, const SVECTOR& v0, SVECTOR& v1);
static SVECTOR& apply_matrix(const MATRIX& m0, const SVECTOR& v0, SVECTOR& v1) {
set_matrix(m0);
JabyEngine::GTE::ldv0(v0);
JabyEngine::GTE::rt();
JabyEngine::GTE::stsv(v1);
return v1;
}
/*
Same as apply_matrix but works on Vertex
*/
static GPU::Vertex& apply_matrix(const MATRIX& m0, const GPU::Vertex& v0, GPU::Vertex& v1) {
set_matrix(m0);
JabyEngine::GTE::ldgv0(v0);
JabyEngine::GTE::rt();
JabyEngine::GTE::stgv(v1);
return v1;
}
/*
MulMatrix0
@@ -133,20 +167,6 @@ namespace JabyEngine {
return result;
}
/*
matrix: first input
Sets the 3x3 constant rotation matrix and the parallel transfer vector from input
*/
void set_matrix(const MATRIX& matrix);
/*
returns: current matrix
Gets the current 3x3 constant rotation matrix and the parallel transfer vector
*/
MATRIX get_matrix();
/*
matrix: optional input