-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create matrix.h
and matrix_stack.h
#1975
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3c28341
create matrix.h
Dragorn421 c0c879b
split into matrix.h + matrix_stack.h
Dragorn421 d1e3b4b
Merge branch 'main' into h_matrix
Dragorn421 c34bc60
fix include guard...
Dragorn421 d35d40d
fix retail bss
Dragorn421 8f40621
sys_matrix.h, skin_matrx.h, and bss
Dragorn421 131e4f1
Merge branch 'main' into h_matrix
Dragorn421 3301332
revert makefile -Werror=implicit-function-declaration
Dragorn421 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef MATRIX_H | ||
#define MATRIX_H | ||
|
||
#include "ultra64.h" | ||
#include "z64math.h" | ||
|
||
struct GraphicsContext; | ||
|
||
void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); | ||
void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); | ||
void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest); | ||
void SkinMatrix_GetClear(MtxF** mfp); | ||
void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest); | ||
s32 SkinMatrix_Invert(MtxF* src, MtxF* dest); | ||
void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z); | ||
void SkinMatrix_SetRotateZYX(MtxF* mf, s16 x, s16 y, s16 z); | ||
void SkinMatrix_SetTranslate(MtxF* mf, f32 x, f32 y, f32 z); | ||
void SkinMatrix_SetTranslateRotateYXZScale(MtxF* dest, f32 scaleX, f32 scaleY, f32 scaleZ, s16 rotX, s16 rotY, s16 rotZ, | ||
f32 translateX, f32 translateY, f32 translateZ); | ||
void SkinMatrix_SetTranslateRotateZYX(MtxF* dest, s16 rotX, s16 rotY, s16 rotZ, f32 translateX, f32 translateY, | ||
f32 translateZ); | ||
Mtx* SkinMatrix_MtxFToNewMtx(struct GraphicsContext* gfxCtx, MtxF* src); | ||
void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#ifndef MATRIX_STACK_H | ||
#define MATRIX_STACK_H | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
|
||
#include "ultra64.h" | ||
#include "z64math.h" | ||
|
||
struct GameState; | ||
struct GraphicsContext; | ||
|
||
// Matrix stack operations | ||
|
||
typedef enum { | ||
/* 0 */ MTXMODE_NEW, // generates a new matrix | ||
/* 1 */ MTXMODE_APPLY // applies transformation to the current matrix | ||
} MatrixMode; | ||
|
||
void Matrix_Init(struct GameState* gameState); | ||
void Matrix_Push(void); | ||
void Matrix_Pop(void); | ||
void Matrix_Get(MtxF* dest); | ||
void Matrix_Put(MtxF* src); | ||
void Matrix_Mult(MtxF* mf, u8 mode); | ||
void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode); | ||
void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode); | ||
void Matrix_RotateX(f32 x, u8 mode); | ||
void Matrix_RotateY(f32 y, u8 mode); | ||
void Matrix_RotateZ(f32 z, u8 mode); | ||
void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode); | ||
void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation); | ||
void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot); | ||
void Matrix_MultVec3f(Vec3f* src, Vec3f* dest); | ||
void Matrix_ReplaceRotation(MtxF* mf); | ||
void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode); | ||
|
||
#if OOT_DEBUG | ||
|
||
Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line); | ||
#define MATRIX_TO_MTX(gfxCtx, file, line) Matrix_ToMtx(gfxCtx, file, line) | ||
|
||
Mtx* Matrix_NewMtx(struct GraphicsContext* gfxCtx, const char* file, int line); | ||
#define MATRIX_NEW(gfxCtx, file, line) Matrix_NewMtx(gfxCtx, file, line) | ||
|
||
#else | ||
|
||
Mtx* Matrix_ToMtx(Mtx* dest); | ||
#define MATRIX_TO_MTX(gfxCtx, file, line) Matrix_ToMtx(gfxCtx) | ||
|
||
Mtx* Matrix_NewMtx(struct GraphicsContext* gfxCtx); | ||
#define MATRIX_NEW(gfxCtx, file, line) Matrix_NewMtx(gfxCtx) | ||
|
||
#endif | ||
|
||
// Operations not involving the matrix stack | ||
|
||
extern Mtx gMtxClear; | ||
extern MtxF gMtxFClear; | ||
|
||
Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest); | ||
void Matrix_MtxFCopy(MtxF* dest, MtxF* src); | ||
void Matrix_MtxToMtxF(Mtx* src, MtxF* dest); | ||
void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf); | ||
void Matrix_Transpose(MtxF* mf); | ||
void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag); | ||
void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag); | ||
void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, | ||
f32 translateZ); | ||
|
||
#if OOT_DEBUG | ||
|
||
MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line); | ||
#define MATRIX_CHECK_FLOATS(mtx, file, line) Matrix_CheckFloats(mtx, file, line) | ||
|
||
#else | ||
|
||
#define MATRIX_CHECK_FLOATS(mtx, file, line) (mtx) | ||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "global.h" | ||
#include "sys_matrix.h" | ||
|
||
// clang-format off | ||
Mtx gMtxClear = gdSPDefMtx( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "global.h" | ||
#include "terminal.h" | ||
#include "skin_matrix.h" | ||
|
||
// clang-format off | ||
MtxF sMtxFClear = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include guard name doesn't match