1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-11-13 04:13:03 +00:00

fixed binocular vision (isotropic only for now)

This commit is contained in:
Zeno Rogue
2019-09-16 10:38:42 +02:00
parent 39a6c2131b
commit a59dc8be58
2 changed files with 21 additions and 4 deletions

View File

@@ -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());
}