Support retriving rotation matrix

This commit is contained in:
jaby 2024-01-31 22:22:25 -05:00
parent d9aa03e6fe
commit a40a69a878
1 changed files with 20 additions and 0 deletions

View File

@ -41,6 +41,26 @@ namespace JabyEngine {
__asm__ volatile("ctc2 $14, $4" :: "r"(&matrix) : "$12", "$13", "$14");
}
static MATRIX get_rot_matrix() {
MATRIX matrix = {0};
// TODO: v why is this needed?
// TODO: v what is this? v
// TODO: v v what exactly is this register?
__asm__ volatile("cfc2 $12, $0" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("cfc2 $13, $1" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("sw $12, 0(%0)" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("sw $13, 4(%0)" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("cfc2 $12, $2" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("cfc2 $13, $3" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("cfc2 $14, $4" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("sw $12, 8(%0)" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("sw $13, 12(%0)" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
__asm__ volatile("sw $14, 16(%0)" :: "r"(&matrix) : "$12", "$13", "$14", "memory");
return matrix;
}
/*
SetTransMatrix