mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
fixed binocular vision (isotropic only for now)
This commit is contained in:
parent
39a6c2131b
commit
a59dc8be58
@ -246,6 +246,7 @@ EX void start_projection(int ed, bool perspective) {
|
||||
}
|
||||
|
||||
EX void eyewidth_translate(int ed) {
|
||||
glhr::using_eyeshift = false;
|
||||
if(ed) glhr::projection_multiply(glhr::translate(-ed * current_display->eyewidth(), 0, 0));
|
||||
}
|
||||
|
||||
@ -439,11 +440,16 @@ void display_data::set_projection(int ed) {
|
||||
GLfloat sc = current_display->radius / (cd->ysize/2.);
|
||||
glhr::projection_multiply(glhr::scale(sc, -sc, -1));
|
||||
}
|
||||
|
||||
|
||||
if(ed) {
|
||||
if(pers3)
|
||||
glhr::projection_multiply(glhr::tmtogl(xpush(vid.ipd * ed/2)));
|
||||
if(pers3) {
|
||||
if(anyshiftclick)
|
||||
glhr::projection_multiply(glhr::tmtogl(xpush(vid.ipd * ed/2)));
|
||||
else {
|
||||
glhr::using_eyeshift = true;
|
||||
glhr::eyeshift = glhr::tmtogl(xpush(vid.ipd * ed/2));
|
||||
}
|
||||
}
|
||||
else
|
||||
glhr::projection_multiply(glhr::translate(vid.ipd * ed/2, 0, 0));
|
||||
}
|
||||
|
13
shaders.cpp
13
shaders.cpp
@ -436,6 +436,9 @@ bool operator != (const glmatrix& m1, const glmatrix& m2) {
|
||||
|
||||
bool uses_mvp(shader_projection sp) { return among(sp, shader_projection::standard, shader_projection::flatten); }
|
||||
|
||||
EX glmatrix eyeshift;
|
||||
EX bool using_eyeshift;
|
||||
|
||||
EX void set_modelview(const glmatrix& modelview) {
|
||||
#if CAP_NOSHADER
|
||||
if(noshaders) {
|
||||
@ -446,7 +449,15 @@ EX void set_modelview(const glmatrix& modelview) {
|
||||
#endif
|
||||
if(!current) return;
|
||||
if(!uses_mvp(current_shader_projection)) {
|
||||
if(modelview != current_modelview) {
|
||||
if(using_eyeshift) {
|
||||
glmatrix mvp = modelview * eyeshift;
|
||||
#if MINIMIZE_GL_CALLS
|
||||
if(mvp == current_matrix) return;
|
||||
current_matrix = mvp;
|
||||
#endif
|
||||
glUniformMatrix4fv(current->uMV, 1, 0, mvp.as_array());
|
||||
}
|
||||
else if(modelview != current_modelview) {
|
||||
current_modelview = modelview;
|
||||
glUniformMatrix4fv(current->uMV, 1, 0, modelview.as_array());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user