1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +00:00

sanity checked the matrices in swapmatrix

This commit is contained in:
Zeno Rogue 2019-05-10 04:03:07 +02:00
parent d9754ec57c
commit 152ca6aacf
2 changed files with 6 additions and 1 deletions

View File

@ -387,6 +387,7 @@ namespace geom3 {
void switch_always3() {
geom3::always3 = !geom3::always3;
need_reset_geometry = true;
swapmatrix(View);
callhooks(hooks_swapdim);
}
@ -422,6 +423,7 @@ namespace geom3 {
geom3::camera = 0;
if(pmodel == mdDisk) pmodel = mdPerspective;
need_reset_geometry = true;
swapmatrix(View);
callhooks(hooks_swapdim);
}
else {
@ -432,6 +434,7 @@ namespace geom3 {
geom3::depth = 1;
if(pmodel == mdPerspective) pmodel = mdDisk;
need_reset_geometry = true;
swapmatrix(View);
callhooks(hooks_swapdim);
}
}

View File

@ -359,9 +359,11 @@ void swapmatrix(transmatrix& T) {
for(int i=0; i<4; i++) swap(T[i][2], T[i][3]);
for(int i=0; i<4; i++) swap(T[2][i], T[3][i]);
if(DIM == 3) {
for(int i=0; i<4; i++) T[i][0] = T[0][i] = 0;
for(int i=0; i<4; i++) T[i][2] = T[2][i] = 0;
T[2][2] = 1;
}
fixmatrix(T);
for(int i=0; i<4; i++) for(int j=0; j<4; j++) if(isnan(T[i][j])) T = Id;
}
#endif