mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	a new option for pseudohedral
This commit is contained in:
		| @@ -2764,8 +2764,12 @@ EX int config3 = addHook(hooks_configfile, 100, [] { | ||||
|  | ||||
|   param_f(vid.depth_bonus, "depth_bonus", 0) | ||||
|     ->editable(-5, 5, .1, "depth bonus in pseudohedral", "", 'b'); | ||||
|   param_b(vid.pseudohedral, "pseudohedral", false) | ||||
|     ->editable("make the tiles flat", 'p'); | ||||
|   param_enum(vid.pseudohedral, "pseudohedral", "pseudohedral", phOFF) | ||||
|     ->editable( | ||||
|     {{"OFF", "the tiles are curved"}, | ||||
|     {"inscribed", "the tiles are inscribed"}, | ||||
|     {"circumscribed", "the tiles are circumscribed"}}, | ||||
|     "make the tiles flat", 'p'); | ||||
|   param_f(vid.depth, "depth", "3D depth", 1) | ||||
|     ->editable(0, 5, .1, "Ground level below the plane", "", 'd') | ||||
|     ->set_extra([] { | ||||
|   | ||||
| @@ -274,6 +274,10 @@ template<class T> void sizeto(T& t, int n) { | ||||
|   if(isize(t) <= n) t.resize(n+1); | ||||
|   } | ||||
|  | ||||
| template<class T, class U> void sizeto(T& t, int n, const U& val) { | ||||
|   if(isize(t) <= n) t.resize(n+1, val); | ||||
|   } | ||||
|  | ||||
| void geometry_information::bshape_regular(floorshape &fsh, int id, int sides, ld shift, ld size, cell *c) { | ||||
|    | ||||
|   sizeto(fsh.b, id); | ||||
| @@ -377,6 +381,24 @@ void geometry_information::finish_apeirogon(hyperpoint center) { | ||||
|     } | ||||
|   } | ||||
|  | ||||
| hyperpoint get_circumscribed_corner(cell *c, int t, hyperpoint h) { | ||||
|  | ||||
|   hyperpoint h0 = currentmap->adjmod(c, t) * h; | ||||
|   hyperpoint h1 = currentmap->adjmod(c, t-1) * h; | ||||
|   transmatrix T; | ||||
|   array<hyperpoint, 3> hs = {h, h0, h1}; | ||||
|   set_column(T, 3, C03); | ||||
|   hyperpoint res = C03; | ||||
|   for(int i=0; i<3; i++) { | ||||
|     hyperpoint ahs = hs[i]; | ||||
|     if(hyperbolic) ahs[3] *= -1; | ||||
|     set_column(T, i, ahs); | ||||
|     res[i] = dot_d(4, hs[i], ahs); | ||||
|     } | ||||
|   T = transpose(T); | ||||
|   return inverse(T) * res; | ||||
|   } | ||||
|  | ||||
| // !siid equals pseudohept(c) | ||||
|  | ||||
| void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, int sidir) { | ||||
| @@ -685,7 +707,8 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i | ||||
|         if(1) { | ||||
|           int s = fsh.b[id].s; | ||||
|           int e = fsh.b[id].e-1; | ||||
|           if(vid.pseudohedral) { | ||||
|  | ||||
|           if(vid.pseudohedral == phInscribed) { | ||||
|             hyperpoint ctr = Hypc; | ||||
|             for(int t=0; t<e-s; t++) | ||||
|               ctr += kleinize(cgi.emb->orthogonal_move(hpc[s+t], dfloor_table[k])); | ||||
| @@ -699,7 +722,24 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i | ||||
|                 }); | ||||
|               } | ||||
|             } | ||||
|           if(!vid.pseudohedral) for(int t=0; t<e-s; t++) { | ||||
|           if(vid.pseudohedral == phCircumscribed) { | ||||
|  | ||||
|             vector<hyperpoint> hs(c->type); | ||||
|             hyperpoint z = Hypc; z[2] = dfloor_table[k]; | ||||
|             hyperpoint ctr = cgi.emb->logical_to_actual(z); | ||||
|             for(int t=0; t<c->type; t++) hs[t] = get_circumscribed_corner(c, t, ctr); | ||||
|             // for(int t=0; t<c->type; t++) hs[t] = xspinpush0(t * TAU / c->type, 0.2); //  kleinize(get_circumscribed_corner(c, t, ctr)); | ||||
|             println(hlog, "hs is: ", hs, " dft=", dfloor_table[k], " type=", c->type, " id=", id); | ||||
|  | ||||
|             for(int t=0; t<c->type; t++) { | ||||
|               hyperpoint v1 = hs[t] - ctr; | ||||
|               hyperpoint v2 = atmod(hs, t+1) - ctr; | ||||
|               texture_order([&] (ld x, ld y) { | ||||
|                 hpcpush(normalize(ctr + v1 * x + v2 * y)); | ||||
|                 }); | ||||
|               } | ||||
|             } | ||||
|           if(vid.pseudohedral == phOFF) for(int t=0; t<e-s; t++) { | ||||
|  | ||||
|             hyperpoint v1 = cgi.emb->actual_to_logical(hpc[s+t]); | ||||
|             hyperpoint v2 = cgi.emb->actual_to_logical(hpc[s+t+1]); | ||||
| @@ -856,21 +896,7 @@ void geometry_information::generate_floorshapes() { | ||||
|    | ||||
|   #if CAP_ARCM | ||||
|   else if(arcm::in()) { | ||||
|     arcm::parent_index_of(&modelh) = 0; | ||||
|     auto &ac = arcm::current; | ||||
|     for(int i=0; i<2*ac.N + 2; i++) { | ||||
|       if(ac.regular && i>=2 && i < 2*ac.N) continue; | ||||
|       arcm::id_of(&modelh) = i; | ||||
|       model.type = isize(ac.triangles[i]); | ||||
|       if(DUAL) model.type /= 2, arcm::parent_index_of(&modelh) = !(i&1); | ||||
|        | ||||
|       if(BITRUNCATED) | ||||
|         generate_floorshapes_for(i, &model, !arcm::pseudohept(&model), arcm::pseudohept(&model) ? 0 : 1^(i&1)); | ||||
|       else if(geosupport_football() == 2) | ||||
|         generate_floorshapes_for(i, &model, !arcm::pseudohept(&model), i >= 4 ? 1 : 0); | ||||
|       else | ||||
|         generate_floorshapes_for(i, &model, 0, 0); | ||||
|       } | ||||
|     /* will be generated on the fly */ | ||||
|     } | ||||
|   #endif | ||||
|    | ||||
| @@ -1053,6 +1079,22 @@ EX void set_floor(const transmatrix& spin, hpcshape& sh) { | ||||
|   qfi.usershape = -1; | ||||
|   } | ||||
|  | ||||
| /** currently only for arcm */ | ||||
| EX void ensure_floorshape_generated(int id, cell *c) { | ||||
|   hpcshape nul; nul.s = -1; | ||||
|   sizeto(cgi.shFloor.b, id, nul); | ||||
|   if(cgi.shFloor.b[id].s == -1) { | ||||
|     if(BITRUNCATED) | ||||
|       cgi.generate_floorshapes_for(id, c, !arcm::pseudohept(c), arcm::pseudohept(c) ? 0 : 1^(id&1)); | ||||
|     else if(geosupport_football() == 2) | ||||
|       cgi.generate_floorshapes_for(id, c, !arcm::pseudohept(c), id >= 4 ? 1 : 0); | ||||
|     else | ||||
|       cgi.generate_floorshapes_for(id, c, 0, 0); | ||||
|     cgi.finishshape(); | ||||
|     cgi.extra_vertices(); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| EX int shvid(cell *c) { | ||||
|   return currentmap->shvid(c); | ||||
|   } | ||||
| @@ -1124,7 +1166,9 @@ EX struct dqi_poly *draw_shapevec(cell *c, const shiftmatrix& V, const vector<hp | ||||
|   #endif | ||||
|   #if CAP_ARCM | ||||
|   else if(arcm::in()) { | ||||
|     return &queuepolyat(V, shv[shvid(c)], col, prio); | ||||
|     int id = shvid(c); | ||||
|     ensure_floorshape_generated(id, c); | ||||
|     return &queuepolyat(V, shv[id], col, prio); | ||||
|     } | ||||
|   #endif | ||||
|   else if(GOLDBERG && ishex1(c))  | ||||
|   | ||||
| @@ -1282,8 +1282,10 @@ EX string cgi_string() { | ||||
|     V("ASH", ONOFF(vid.gp_autoscale_heights)); | ||||
|     V("LT", fts(vid.lake_top)); | ||||
|     V("LB", fts(vid.lake_bottom)); | ||||
|     if(GDIM == 3 && vid.pseudohedral) | ||||
|       V("PS", fts(vid.depth_bonus)); | ||||
|     if(GDIM == 3 && vid.pseudohedral) { | ||||
|       V("PSH", fts(vid.pseudohedral)); | ||||
|       V("PSD", fts(vid.depth_bonus)); | ||||
|       } | ||||
|     V("LS", fts(vid.lake_shallow)); | ||||
|     V("SSu", fts(vid.sun_size)); | ||||
|     V("SSt", fts(vid.star_size)); | ||||
|   | ||||
							
								
								
									
										4
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -317,6 +317,8 @@ enum eThreatLevel { tlNoThreat, tlSpam, tlNormal, tlHighThreat }; | ||||
|  | ||||
| constexpr ld use_the_default_value = -20.0625; | ||||
|  | ||||
| enum ePseudohedral { phOFF, phInscribed, phCircumscribed }; | ||||
|  | ||||
| struct videopar { | ||||
|   projection_configuration projection_config, rug_config; | ||||
|   ld yshift; | ||||
| @@ -425,7 +427,7 @@ struct videopar { | ||||
|   bool height_limits; | ||||
|   ld rock_wall_ratio; | ||||
|   ld human_wall_ratio; | ||||
|   bool pseudohedral; // in 3D modes | ||||
|   ePseudohedral pseudohedral; | ||||
|   ld depth_bonus;   // to fiix the placement of 3D models in pseudogonal -- not working currently | ||||
|  | ||||
|   int tc_alpha, tc_depth, tc_camera; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue