mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-29 07:23:01 +00:00
Fix crash, only translate cam space when its valid
This commit is contained in:
parent
b52fe0eaeb
commit
5310b0d496
1 changed files with 6 additions and 3 deletions
|
@ -279,8 +279,11 @@ void patch_mtx_interpolated(f32 delta) {
|
||||||
|
|
||||||
// calculate outside of for loop to reduce overhead
|
// calculate outside of for loop to reduce overhead
|
||||||
// technically this is improper use of mtxf functions, but coop doesn't target N64
|
// technically this is improper use of mtxf functions, but coop doesn't target N64
|
||||||
mtxf_inverse(camTranfInv.m, *sCameraNode->matrixPtr);
|
bool translateCamSpace = (sCameraNode->matrixPtr != NULL) && (sCameraNode->matrixPtrPrev != NULL);
|
||||||
mtxf_inverse(prevCamTranfInv.m, *sCameraNode->matrixPtrPrev);
|
if (translateCamSpace) {
|
||||||
|
mtxf_inverse(camTranfInv.m, *sCameraNode->matrixPtr);
|
||||||
|
mtxf_inverse(prevCamTranfInv.m, *sCameraNode->matrixPtrPrev);
|
||||||
|
}
|
||||||
|
|
||||||
for (s32 i = 0; i < gMtxTblSize; i++) {
|
for (s32 i = 0; i < gMtxTblSize; i++) {
|
||||||
Mtx bufMtx, bufMtxPrev;
|
Mtx bufMtx, bufMtxPrev;
|
||||||
|
@ -290,7 +293,7 @@ void patch_mtx_interpolated(f32 delta) {
|
||||||
|
|
||||||
Gfx *pos = gMtxTbl[i].pos;
|
Gfx *pos = gMtxTbl[i].pos;
|
||||||
|
|
||||||
if (gMtxTbl[i].usingCamSpace) {
|
if (gMtxTbl[i].usingCamSpace && translateCamSpace) {
|
||||||
// transform out of camera space so the matrix can interp in world space
|
// transform out of camera space so the matrix can interp in world space
|
||||||
mtxf_mul(bufMtx.m, bufMtx.m, camTranfInv.m);
|
mtxf_mul(bufMtx.m, bufMtx.m, camTranfInv.m);
|
||||||
mtxf_mul(bufMtxPrev.m, bufMtxPrev.m, prevCamTranfInv.m);
|
mtxf_mul(bufMtxPrev.m, bufMtxPrev.m, prevCamTranfInv.m);
|
||||||
|
|
Loading…
Reference in a new issue