1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-18 15:00:26 +00:00

3D:: correct shift matrix in stereo mode

This commit is contained in:
Zeno Rogue 2019-06-25 11:22:47 +02:00
parent a6d9f8f679
commit 0f98146d20
3 changed files with 16 additions and 2 deletions

View File

@ -297,8 +297,12 @@ void display_data::set_projection(int ed) {
} }
if(ed) glhr::projection_multiply(glhr::translate(vid.ipd * ed/2, 0, 0)); if(ed) {
if(pers3)
glhr::projection_multiply(glhr::tmtogl(xpush(vid.ipd * ed/2)));
else
glhr::projection_multiply(glhr::translate(vid.ipd * ed/2, 0, 0));
}
if(pers3) { if(pers3) {
glhr::fog_max(1/sightranges[geometry], darkena(backcolor, 0, 0xFF)); glhr::fog_max(1/sightranges[geometry], darkena(backcolor, 0, 0xFF));

View File

@ -4006,6 +4006,8 @@ namespace glhr {
extern shader_projection new_shader_projection; extern shader_projection new_shader_projection;
glmatrix tmtogl(const transmatrix& T);
void set_depthtest(bool b); void set_depthtest(bool b);
glmatrix translate(ld x, ld y, ld z); glmatrix translate(ld x, ld y, ld z);
void color2(color_t color, ld scale = 1); void color2(color_t color, ld scale = 1);

View File

@ -82,6 +82,14 @@ glmatrix scale(ld x, ld y, ld z) {
return tmp; return tmp;
} }
glmatrix tmtogl(const transmatrix& T) {
glmatrix tmp;
for(int i=0; i<4; i++)
for(int j=0; j<4; j++)
tmp[i][j] = T[i][j];
return tmp;
}
glmatrix ortho(ld x, ld y, ld z) { glmatrix ortho(ld x, ld y, ld z) {
return scale(1/x, 1/y, 1/z); return scale(1/x, 1/y, 1/z);
} }