mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	flat and invert are now separate flags
This commit is contained in:
		
							
								
								
									
										40
									
								
								config.cpp
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								config.cpp
									
									
									
									
									
								
							| @@ -840,6 +840,14 @@ EX void initConfig() { | |||||||
|   param_b(geom3::auto_configure, "auto_configure_3d", "auto_configure_3d") |   param_b(geom3::auto_configure, "auto_configure_3d", "auto_configure_3d") | ||||||
|   -> editable("set 3D settings automatically", 'A'); |   -> editable("set 3D settings automatically", 'A'); | ||||||
|  |  | ||||||
|  |   param_b(geom3::inverted_embedding, "inverted_3d", "inverted_3d") | ||||||
|  |   -> editable("invert convex/concave", 'I') | ||||||
|  |   -> set_reaction([] { geom3::switch_fpp(); geom3::switch_fpp(); }); | ||||||
|  |  | ||||||
|  |   param_b(geom3::flat_embedding, "flat_3d", "flat_3d") | ||||||
|  |   -> editable("flat, not equidistant", 'F') | ||||||
|  |   -> set_reaction([] { geom3::switch_fpp(); geom3::switch_fpp(); }); | ||||||
|  |  | ||||||
|   param_enum(geom3::spatial_embedding, "spatial_embedding", "spatial_embedding", geom3::seDefault) |   param_enum(geom3::spatial_embedding, "spatial_embedding", "spatial_embedding", geom3::seDefault) | ||||||
|   ->editable(geom3::spatial_embedding_options, "3D embedding method", 'E') |   ->editable(geom3::spatial_embedding_options, "3D embedding method", 'E') | ||||||
|   ->set_reaction([] { |   ->set_reaction([] { | ||||||
| @@ -2207,15 +2215,12 @@ EX void edit_levellines(char c) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| EX geom3::eSpatialEmbedding shown_spatial_embedding() { | EX geom3::eSpatialEmbedding shown_spatial_embedding() { | ||||||
|   if(GDIM == 2) { |   if(GDIM == 2) return geom3::seNone; | ||||||
|     if(pmodel == mdDisk && pconf.camera_angle) |  | ||||||
|       return geom3::seTPP; |  | ||||||
|     else |  | ||||||
|       return geom3::seNone; |  | ||||||
|     } |  | ||||||
|   return geom3::spatial_embedding; |   return geom3::spatial_embedding; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | EX bool in_tpp() { return pmodel == mdDisk && pconf.camera_angle; } | ||||||
|  |  | ||||||
| EX void show_spatial_embedding() { | EX void show_spatial_embedding() { | ||||||
|   cmode = sm::SIDE | sm::MAYDARK | sm::CENTER | sm::PANNING | sm::SHOWCURSOR; |   cmode = sm::SIDE | sm::MAYDARK | sm::CENTER | sm::PANNING | sm::SHOWCURSOR; | ||||||
|   gamescreen(); |   gamescreen(); | ||||||
| @@ -2229,14 +2234,11 @@ EX void show_spatial_embedding() { | |||||||
|  |  | ||||||
|   for(int i=0; i<isize(seo); i++) { |   for(int i=0; i<isize(seo); i++) { | ||||||
|     auto se = geom3::eSpatialEmbedding(i); |     auto se = geom3::eSpatialEmbedding(i); | ||||||
|     if(!geom3::auto_configure && geom3::is_suboption(se)) continue; |  | ||||||
|     dialog::addBoolItem(XLAT(seo[i].first), emb == i, 'a' + i); |     dialog::addBoolItem(XLAT(seo[i].first), emb == i, 'a' + i); | ||||||
|     dialog::add_action([se, emb] { |     dialog::add_action([se, emb] { | ||||||
|       if(GDIM == 3) { if(geom3::auto_configure) geom3::switch_fpp(); else geom3::switch_always3(); } |       if(GDIM == 3) { if(geom3::auto_configure) geom3::switch_fpp(); else geom3::switch_always3(); } | ||||||
|       if(se == geom3::seNone && emb == geom3::seTPP) geom3::switch_tpp(); |       if(in_tpp()) geom3::switch_tpp(); | ||||||
|       if(se == geom3::seTPP && emb == geom3::seNone) geom3::switch_tpp(); |       if(se != geom3::seNone) { | ||||||
|       if(se != geom3::seNone && se != geom3::seTPP) { |  | ||||||
|         println(hlog, "set spatial_embedding to ", int(se)); |  | ||||||
|         geom3::spatial_embedding = se; |         geom3::spatial_embedding = se; | ||||||
|         if(geom3::auto_configure) geom3::switch_fpp(); else geom3::switch_always3(); |         if(geom3::auto_configure) geom3::switch_fpp(); else geom3::switch_always3(); | ||||||
|         delete_sky(); |         delete_sky(); | ||||||
| @@ -2248,6 +2250,22 @@ EX void show_spatial_embedding() { | |||||||
|   dialog::addBreak(100); |   dialog::addBreak(100); | ||||||
|   dialog::addHelp(XLAT(seo[emb].second)); |   dialog::addHelp(XLAT(seo[emb].second)); | ||||||
|   dialog::addBreak(100); |   dialog::addBreak(100); | ||||||
|  |  | ||||||
|  |   if(geom3::auto_configure) { | ||||||
|  |     if(emb == geom3::seNone) { | ||||||
|  |       dialog::addBoolItem(XLAT("third-person perspective"), in_tpp(), 'T'); | ||||||
|  |       dialog::add_action(geom3::switch_tpp); | ||||||
|  |       dialog::addBreak(100); | ||||||
|  |       } | ||||||
|  |     else { | ||||||
|  |       if(geom3::supports_flat()) add_edit(geom3::flat_embedding); | ||||||
|  |       else dialog::addBreak(100); | ||||||
|  |       if(geom3::supports_invert()) add_edit(geom3::inverted_embedding); | ||||||
|  |       else dialog::addBreak(100); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   dialog::addBreak(100); | ||||||
|   dialog::addBack(); |   dialog::addBack(); | ||||||
|  |  | ||||||
|   dialog::display(); |   dialog::display(); | ||||||
|   | |||||||
							
								
								
									
										51
									
								
								geometry.cpp
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								geometry.cpp
									
									
									
									
									
								
							| @@ -1074,14 +1074,9 @@ EX namespace geom3 { | |||||||
|   #if HDR |   #if HDR | ||||||
|   enum eSpatialEmbedding { |   enum eSpatialEmbedding { | ||||||
|     seNone, |     seNone, | ||||||
|     seTPP, |  | ||||||
|     seDefault, |     seDefault, | ||||||
|     seFlat, |  | ||||||
|     seInverted, |  | ||||||
|     seLowerCurvature, |     seLowerCurvature, | ||||||
|     seLowerCurvatureInverted, |  | ||||||
|     seMuchLowerCurvature, |     seMuchLowerCurvature, | ||||||
|     seMuchLowerCurvatureInverted, |  | ||||||
|     seProduct, |     seProduct, | ||||||
|     seNil, |     seNil, | ||||||
|     seSol, seNIH, seSolN, |     seSol, seNIH, seSolN, | ||||||
| @@ -1090,30 +1085,25 @@ EX namespace geom3 { | |||||||
|   #endif |   #endif | ||||||
|  |  | ||||||
|   EX vector<pair<string, string>> spatial_embedding_options = { |   EX vector<pair<string, string>> spatial_embedding_options = { | ||||||
|     {"2D engine",       "Use HyperRogue's 2D engine to simulate 'default 3D' top-down."}, |     {"2D engine",       "Use HyperRogue's 2D engine to simulate same curvature. Works well in top-down and third-person perspective."}, | ||||||
|     {"2D engine in TPP","HyperRogue's 2D engine, but using third-person perspective."}, |     {"same curvature",  "Embed as an equidistant surface in the 3D version of the same geometry."}, | ||||||
|     {"default 3D",      "Embed as a equidistant surface in the 3D version of the same geometry."}, |     {"lower curvature", "Embed as a surface in a space of lower curvature."}, | ||||||
|     {"flat",            "Embed as a flat surface in the 3D version of the same geometry."}, |     {"much lower curvature", "Embed sphere as a sphere in hyperbolic space."}, | ||||||
|     {"inverted",        "Embed as a equidistant surface, but this time it is inverted."}, |  | ||||||
|     {"lower curvature", "Embed as a convex surface in a space of lower curvature."}, |  | ||||||
|     {"lower curvature inverted", "Embed as a concave surface in a space of lower curvature."}, |  | ||||||
|     {"much lower curvature", "Embed sphere as a convex sphere in hyperbolic space."}, |  | ||||||
|     {"much lower curvature inverted", "Embed sphere as a concave sphere in hyperbolic space."}, |  | ||||||
|     {"product",          "Add one extra dimension in the Euclidean way."}, |     {"product",          "Add one extra dimension in the Euclidean way."}, | ||||||
|     {"Nil",              "Embed into Nil. Works only with Euclidean. You need to set the variation to Pure."}, |     {"Nil",              "Embed into Nil. Works only with Euclidean. You need to set the variation to Pure."}, | ||||||
|     {"Sol",              "Embed into Sol. Works only with Euclidean. You need to set the variation to Pure."}, |     {"Sol",              "Embed into Sol. Works only with Euclidean. You need to set the variation to Pure."}, | ||||||
|     {"stretched hyperbolic",              "Embed into stretched hyperbolic geometry. Works only with Euclidean. You need to set the variation to Pure."}, |     {"stretched hyperbolic",              "Embed into stretched hyperbolic geometry. Works only with Euclidean. You need to set the variation to Pure."}, | ||||||
|     {"stretched Sol",              "Embed into stretched Sol geometry. Works only with Euclidean. You need to set the variation to Pure."}, |     {"stretched Sol",              "Embed into stretched Sol geometry. Works only with Euclidean. You need to set the variation to Pure."}, | ||||||
|     {"stretched hyperbolic inverted",              "Embed into stretched hyperbolic geometry as a concave horosphere. Works only with Euclidean. You need to set the variation to Pure."}, |  | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|   EX eSpatialEmbedding spatial_embedding = seDefault; |   EX eSpatialEmbedding spatial_embedding = seDefault; | ||||||
|   EX ld euclid_embed_scale = 1; |   EX ld euclid_embed_scale = 1; | ||||||
|   EX bool auto_configure = true; |   EX bool auto_configure = true; | ||||||
|  |   EX bool flat_embedding = false; | ||||||
|  |   EX bool inverted_embedding = false; | ||||||
|  |  | ||||||
|   EX bool is_suboption(eSpatialEmbedding se) { |   EX bool supports_flat() { return spatial_embedding == seDefault; } | ||||||
|     return among(se, seTPP, seInverted, seFlat, seLowerCurvatureInverted, seMuchLowerCurvatureInverted, seNIH_inv); |   EX bool supports_invert() { return among(spatial_embedding, seDefault, seLowerCurvature, seMuchLowerCurvature, seNil, seSol, seNIH, seSolN); } | ||||||
|     } |  | ||||||
|  |  | ||||||
|   EX vector<geometryinfo> ginf_backup; |   EX vector<geometryinfo> ginf_backup; | ||||||
|  |  | ||||||
| @@ -1202,13 +1192,13 @@ EX namespace geom3 { | |||||||
|             g.sig[2] = g.sig[3]; |             g.sig[2] = g.sig[3]; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|           if(among(spatial_embedding, seLowerCurvature, seLowerCurvatureInverted)) { |           if(spatial_embedding == seLowerCurvature) { | ||||||
|             if(g.kind == gcEuclid) g = ginf[gSpace534].g; |             if(g.kind == gcEuclid) g = ginf[gSpace534].g; | ||||||
|             if(g.kind == gcSphere) g = ginf[gCubeTiling].g; |             if(g.kind == gcSphere) g = ginf[gCubeTiling].g; | ||||||
|             g.gameplay_dimension = 2; |             g.gameplay_dimension = 2; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|           if(among(spatial_embedding, seMuchLowerCurvature, seMuchLowerCurvatureInverted)) { |           if(spatial_embedding == seMuchLowerCurvature) { | ||||||
|             g = ginf[gSpace534].g; |             g = ginf[gSpace534].g; | ||||||
|             g.gameplay_dimension = 2; |             g.gameplay_dimension = 2; | ||||||
|             } |             } | ||||||
| @@ -1232,11 +1222,6 @@ EX namespace geom3 { | |||||||
|             g.gameplay_dimension = 2; |             g.gameplay_dimension = 2; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|           if(spatial_embedding == seNIH_inv && ieuc_or_binary) { |  | ||||||
|             g = ginf[gNIH].g; |  | ||||||
|             g.gameplay_dimension = 2; |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|           if(spatial_embedding == seSolN && ieuc_or_binary) { |           if(spatial_embedding == seSolN && ieuc_or_binary) { | ||||||
|             g = ginf[gSolN].g; |             g = ginf[gSolN].g; | ||||||
|             g.gameplay_dimension = 2; |             g.gameplay_dimension = 2; | ||||||
| @@ -1308,29 +1293,21 @@ EX void switch_always3() { | |||||||
|         vid.depth = 0; |         vid.depth = 0; | ||||||
|         vid.wall_height = -1; |         vid.wall_height = -1; | ||||||
|         vid.eye = 0.5; |         vid.eye = 0.5; | ||||||
|         if(among(spatial_embedding, seLowerCurvatureInverted, seMuchLowerCurvatureInverted)) { |         if(inverted_embedding) { | ||||||
|           vid.wall_height = 1.4; |           vid.wall_height = 1.4; | ||||||
|           vid.eye = -0.2; |           vid.eye = -0.2; | ||||||
|           vid.depth = 0.5; |           vid.depth = 0.5; | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       if(spatial_embedding == seFlat) { |       if(spatial_embedding == seDefault && flat_embedding) { | ||||||
|         vid.eye -= vid.depth / 2; |         vid.eye -= vid.depth / 2; | ||||||
|         vid.depth = 0; |         vid.depth = 0; | ||||||
|         } |         } | ||||||
|       if(spatial_embedding == seInverted) { |       if(spatial_embedding == seDefault && !flat_embedding && inverted_embedding) { | ||||||
|         vid.eye -= vid.depth * 1.5; |         vid.eye -= vid.depth * 1.5; | ||||||
|         vid.depth *= -1; |         vid.depth *= -1; | ||||||
|         } |         } | ||||||
|       if(euc_in_hyp() && spatial_embedding == seLowerCurvatureInverted) { |       if((euc_in_hyp() || euc_in_noniso()) && inverted_embedding) { | ||||||
|         vid.wall_height *= -1; |  | ||||||
|         vid.eye = 2 * vid.depth; |  | ||||||
|         } |  | ||||||
|       if(euc_in_hyp() && spatial_embedding == seMuchLowerCurvatureInverted) { |  | ||||||
|         vid.wall_height *= -1; |  | ||||||
|         vid.eye = 2 * vid.depth; |  | ||||||
|         } |  | ||||||
|       if(euc_in_noniso() && spatial_embedding == seNIH_inv) { |  | ||||||
|         vid.wall_height *= -1; |         vid.wall_height *= -1; | ||||||
|         vid.eye = 2 * vid.depth; |         vid.eye = 2 * vid.depth; | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue