mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	improvements to sphere flipping
This commit is contained in:
		| @@ -927,7 +927,7 @@ EX int rhypot(int a, int b) { return (int) sqrt(a*a - b*b); } | ||||
| EX ld realradius() { | ||||
|   ld vradius = current_display->radius; | ||||
|   if(sphere) { | ||||
|     if(sphereflipped())  | ||||
|     if(flip_sphere()) | ||||
|       vradius /= sqrt(pconf.alpha*pconf.alpha - 1); | ||||
|     else | ||||
|       vradius = 1e12; // use the following | ||||
|   | ||||
| @@ -2184,7 +2184,7 @@ EX void quickqueue() { | ||||
|  | ||||
| /* todo */ | ||||
| ld xintval(const shiftpoint& h) { | ||||
|   if(sphereflipped()) return -h.h[2]; | ||||
|   if(sphere_flipped) return -h.h[2]; | ||||
|   if(hyperbolic) return -h.h[2]; | ||||
|   return -intval(h.h, C0); | ||||
|   } | ||||
| @@ -2198,7 +2198,7 @@ int qp[PMAX], qp0[PMAX]; | ||||
|  | ||||
| color_t darken_color(color_t& color, bool outline) { | ||||
|   int alpha = color & 255; | ||||
|   if(sphere && pmodel == mdDisk && pconf.alpha <= 1) | ||||
|   if(sphere && pmodel == mdDisk && pconf.alpha <= 0.99) | ||||
|     return 0; | ||||
|   else { | ||||
|     if(outline && alpha < 255)  | ||||
| @@ -2279,7 +2279,7 @@ EX void draw_backside() { | ||||
|         ptd->draw(); | ||||
|     } | ||||
|  | ||||
|   spherespecial = sphereflipped() ? 1 : -1; | ||||
|   spherespecial = sphere_flipped ? 1 : -1; | ||||
|   reset_projection(); | ||||
|    | ||||
|   if(pmodel == mdRotatedHyperboles) { | ||||
|   | ||||
| @@ -5030,7 +5030,8 @@ EX bool nonisotropic_weird_transforms; | ||||
|  | ||||
| EX void make_actual_view() { | ||||
|   sphereflip = Id; | ||||
|   if(sphereflipped()) sphereflip[LDIM][LDIM] = -1; | ||||
|   sphere_flipped = flip_sphere(); | ||||
|   if(sphere_flipped) sphereflip[LDIM][LDIM] = -1; | ||||
|   actual_view_transform = sphereflip;   | ||||
|   if(vid.yshift && WDIM == 2) actual_view_transform = ypush(vid.yshift) * actual_view_transform; | ||||
|   #if MAXMDIM >= 4 | ||||
|   | ||||
| @@ -11,9 +11,11 @@ namespace hr { | ||||
| hyperpoint ghxy, ghgxy; | ||||
| shiftpoint ghpm = shiftless(C02); | ||||
|  | ||||
| #if HDR | ||||
| inline bool sphereflipped() { return sphere && pconf.alpha > 1.1; } | ||||
| #endif | ||||
| EX ld flip_limit = 1.1; | ||||
|  | ||||
| EX bool flip_sphere() { return sphere && pconf.alpha > flip_limit; } | ||||
|  | ||||
| EX bool sphere_flipped; | ||||
|  | ||||
| void ghcheck(hyperpoint &ret, const shiftpoint &H) { | ||||
|   if(hypot_d(2, ret-ghxy) < hypot_d(2, ghgxy-ghxy)) { | ||||
|   | ||||
							
								
								
									
										2
									
								
								vr.cpp
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								vr.cpp
									
									
									
									
									
								
							| @@ -577,7 +577,7 @@ EX hyperpoint model_location(shiftpoint h, bool& bad) { | ||||
|     h.h = hmd_pre_for[2] * h.h; | ||||
|     eModel md = pmodel_3d_version(); | ||||
|     apply_other_model(h, hscr, md); | ||||
|     bad = in_vr_sphere && get_side(hscr) == (sphereflipped() ? -1 : 1); | ||||
|     bad = in_vr_sphere && get_side(hscr) == (sphere_flipped ? -1 : 1); | ||||
|    | ||||
|     hscr[3] = 1; | ||||
|     return hscr; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue