diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-12-13 11:50:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-13 11:50:28 -0700 |
| commit | b934e98fc34964970ab5efacb2fb7c3372ae0b1a (patch) | |
| tree | cd96e5fabec7fdcc098d0de33b3b7e2754fb6cd5 /src/engine/Matrix.cpp | |
| parent | e6acb59ef4797ce27ddc9e21982c3f4e40824b52 (diff) | |
Refactor Track Class To Instantiate On Track Load (#587)
* Initial Commit
* First compilation of Registry template
* Further changes
* wip changes
* Impl TrackBrowser and Registry Info
* Remove const from TInfo
* Prep GetWorld
* Name refactor
* Refactor gWorldInstance to GetWorld()
* wip
* Should work now
* Data menu work again
* Fix editor staying open after program close
* Rename LoadLevel to LoadTrackDataFromJson
* More changes
* Add statue
* Add search to content browser using tags
* Fix statue pos and register tags
* Fix actor loading
* Fix delete all bug which deleted cameras
* reduce some boiler plate in actor and object
* Remove unused rulesets
* Search bar for all tabs
* fix data screen
* fix actor spawning
* temp editor fix
* Clean up
* improve extra mode transformation
* fix podium crash
* Fix editor clicking
* Fix editor clicking 2
* fix extra in custom track
* Fix FI for three actors
* Fix divide by zero error
* Ids managed by Registry
* Add scary comment
---------
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Co-authored-by: coco875 <pereira.jannin@gmail.com>
Diffstat (limited to 'src/engine/Matrix.cpp')
| -rw-r--r-- | src/engine/Matrix.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/engine/Matrix.cpp b/src/engine/Matrix.cpp index 4fafdd972..0f5cdde73 100644 --- a/src/engine/Matrix.cpp +++ b/src/engine/Matrix.cpp @@ -59,14 +59,14 @@ void SetTextMatrix(Mat4 mf, f32 x, f32 y, f32 arg3, f32 arg4) { // AddMatrix but with custom gfx ptr arg and flags are predefined Gfx* AddTextMatrix(Gfx* displayListHead, Mat4 mtx) { // Push a new matrix to the stack - gWorldInstance.Mtx.Objects.emplace_back(); + GetWorld()->Mtx.Objects.emplace_back(); // Convert to a fixed-point matrix - FrameInterpolation_RecordMatrixMtxFToMtx((MtxF*)mtx, &gWorldInstance.Mtx.Objects.back()); - guMtxF2L(mtx, &gWorldInstance.Mtx.Objects.back()); + FrameInterpolation_RecordMatrixMtxFToMtx((MtxF*)mtx, &GetWorld()->Mtx.Objects.back()); + guMtxF2L(mtx, &GetWorld()->Mtx.Objects.back()); // Load the matrix - gSPMatrix(displayListHead++, &gWorldInstance.Mtx.Objects.back(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(displayListHead++, &GetWorld()->Mtx.Objects.back(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); return displayListHead; } @@ -195,43 +195,43 @@ void AddLocalRotation(Mat4 mat, IRotator rot) { extern "C" { void AddHudMatrix(Mat4 mtx, s32 flags) { - AddMatrix(gWorldInstance.Mtx.Objects, mtx, flags); + AddMatrix(GetWorld()->Mtx.Objects, mtx, flags); } Mtx* GetScreenMatrix(void) { - return &gWorldInstance.Mtx.Screen2D; + return &GetWorld()->Mtx.Screen2D; } Mtx* GetOrthoMatrix(void) { - return &gWorldInstance.Mtx.Ortho; + return &GetWorld()->Mtx.Ortho; } Mtx* GetPerspMatrix(size_t cameraId) { - return &gWorldInstance.Mtx.Persp[cameraId]; + return &GetWorld()->Mtx.Persp[cameraId]; } Mtx* GetLookAtMatrix(size_t cameraId) { - return &gWorldInstance.Mtx.LookAt[cameraId]; + return &GetWorld()->Mtx.LookAt[cameraId]; } void AddObjectMatrix(Mat4 mtx, s32 flags) { - AddMatrix(gWorldInstance.Mtx.Objects, mtx, flags); + AddMatrix(GetWorld()->Mtx.Objects, mtx, flags); } Mtx* GetShadowMatrix(size_t playerId) { - return &gWorldInstance.Mtx.Shadows[playerId]; + return &GetWorld()->Mtx.Shadows[playerId]; } Mtx* GetKartMatrix(size_t playerId) { - return &gWorldInstance.Mtx.Karts[playerId]; + return &GetWorld()->Mtx.Karts[playerId]; } void AddEffectMatrix(Mat4 mtx, s32 flags) { - AddMatrix(gWorldInstance.Mtx.Objects, mtx, flags); + AddMatrix(GetWorld()->Mtx.Objects, mtx, flags); } void AddEffectMatrixOrtho(void) { - auto& stack = gWorldInstance.Mtx.Objects; + auto& stack = GetWorld()->Mtx.Objects; stack.emplace_back(); guOrtho(&stack.back(), 0.0f, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0.0f, -100.0f, 100.0f, 1.0f); @@ -240,7 +240,7 @@ extern "C" { } Mtx* GetEffectMatrix(void) { - return GetMatrix(gWorldInstance.Mtx.Objects); + return GetMatrix(GetWorld()->Mtx.Objects); } @@ -249,14 +249,14 @@ extern "C" { * We might need to adjust which ones we clear. */ void ClearMatrixPools(void) { - gWorldInstance.Mtx.Objects.clear(); - // gWorldInstance.Mtx.Shadows.clear(); - //gWorldInstance.Mtx.Karts.clear(); - // gWorldInstance.Mtx.Effects.clear(); + GetWorld()->Mtx.Objects.clear(); + // GetWorld()->Mtx.Shadows.clear(); + //GetWorld()->Mtx.Karts.clear(); + // GetWorld()->Mtx.Effects.clear(); } void ClearObjectsMatrixPool(void) { - gWorldInstance.Mtx.Objects.clear(); + GetWorld()->Mtx.Objects.clear(); } } |
