mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	fixed binocular vision (isotropic only for now)
This commit is contained in:
		| @@ -246,6 +246,7 @@ EX void start_projection(int ed, bool perspective) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| EX void eyewidth_translate(int ed) { | EX void eyewidth_translate(int ed) { | ||||||
|  |   glhr::using_eyeshift = false; | ||||||
|   if(ed) glhr::projection_multiply(glhr::translate(-ed * current_display->eyewidth(), 0, 0)); |   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.);   |       GLfloat sc = current_display->radius / (cd->ysize/2.);   | ||||||
|       glhr::projection_multiply(glhr::scale(sc, -sc, -1)); |       glhr::projection_multiply(glhr::scale(sc, -sc, -1)); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|      |      | ||||||
|     if(ed) { |     if(ed) { | ||||||
|       if(pers3) |       if(pers3) { | ||||||
|         glhr::projection_multiply(glhr::tmtogl(xpush(vid.ipd * ed/2))); |         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 |       else | ||||||
|         glhr::projection_multiply(glhr::translate(vid.ipd * ed/2, 0, 0)); |         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); } | 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) { | EX void set_modelview(const glmatrix& modelview) { | ||||||
|   #if CAP_NOSHADER |   #if CAP_NOSHADER | ||||||
|   if(noshaders) { |   if(noshaders) { | ||||||
| @@ -446,7 +449,15 @@ EX void set_modelview(const glmatrix& modelview) { | |||||||
|   #endif |   #endif | ||||||
|   if(!current) return; |   if(!current) return; | ||||||
|   if(!uses_mvp(current_shader_projection)) { |   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; |       current_modelview = modelview; | ||||||
|       glUniformMatrix4fv(current->uMV, 1, 0, modelview.as_array()); |       glUniformMatrix4fv(current->uMV, 1, 0, modelview.as_array()); | ||||||
|       } |       } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue