mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	adjusted RogueViz to use the new 3D functions
This commit is contained in:
		| @@ -106,7 +106,7 @@ namespace flocking { | |||||||
|       transmatrix I, Rot; |       transmatrix I, Rot; | ||||||
|       bool use_rot = true; |       bool use_rot = true; | ||||||
|        |        | ||||||
|       if(prod) { |       if(mproduct) { | ||||||
|         I = inverse(m->at); |         I = inverse(m->at); | ||||||
|         Rot = inverse(m->ori); |         Rot = inverse(m->ori); | ||||||
|         } |         } | ||||||
| @@ -204,7 +204,7 @@ namespace flocking { | |||||||
|       fixmatrix(pats[i]); |       fixmatrix(pats[i]); | ||||||
|        |        | ||||||
|       /* RogueViz does not correctly rotate them */ |       /* RogueViz does not correctly rotate them */ | ||||||
|       if(prod) { |       if(mproduct) { | ||||||
|         hyperpoint h = oris[i] * xtangent(1); |         hyperpoint h = oris[i] * xtangent(1); | ||||||
|         pats[i] = pats[i] * spin(-atan2(h[1], h[0])); |         pats[i] = pats[i] * spin(-atan2(h[1], h[0])); | ||||||
|         oris[i] = spin(+atan2(h[1], h[0])) * oris[i]; |         oris[i] = spin(+atan2(h[1], h[0])) * oris[i]; | ||||||
| @@ -234,7 +234,7 @@ namespace flocking { | |||||||
|         gmatrix.clear(); |         gmatrix.clear(); | ||||||
|         vdata[0].m->pat = shiftless(View * calc_relative_matrix(vdata[0].m->base, centerover, C0) * vdata[0].m->at); |         vdata[0].m->pat = shiftless(View * calc_relative_matrix(vdata[0].m->base, centerover, C0) * vdata[0].m->at); | ||||||
|         View = inverse(vdata[0].m->pat.T) * View; |         View = inverse(vdata[0].m->pat.T) * View; | ||||||
|         if(prod) { |         if(mproduct) { | ||||||
|           NLP = inverse(vdata[0].m->ori); |           NLP = inverse(vdata[0].m->ori); | ||||||
|            |            | ||||||
|           NLP = hr::cspin90(1, 2) * spin90() * NLP; |           NLP = hr::cspin90(1, 2) * spin90() * NLP; | ||||||
| @@ -265,7 +265,7 @@ namespace flocking { | |||||||
|           vdata[i].m->pat = gmatrix[vdata[i].m->base] * vdata[i].m->at; |           vdata[i].m->pat = gmatrix[vdata[i].m->base] * vdata[i].m->at; | ||||||
|           auto h1 = unshift(tC0(vdata[i].m->pat)); |           auto h1 = unshift(tC0(vdata[i].m->pat)); | ||||||
|           cnt++;           |           cnt++;           | ||||||
|           if(prod) { |           if(mproduct) { | ||||||
|             auto d1 = product_decompose(h1); |             auto d1 = product_decompose(h1); | ||||||
|             lev += d1.first; |             lev += d1.first; | ||||||
|             h += d1.second; |             h += d1.second; | ||||||
| @@ -275,7 +275,7 @@ namespace flocking { | |||||||
|           } |           } | ||||||
|         if(cnt) { |         if(cnt) { | ||||||
|           h = normalize_flat(h); |           h = normalize_flat(h); | ||||||
|           if(prod) h = zshift(h, lev / cnt); |           if(mproduct) h = orthogonal_move(h, lev / cnt); | ||||||
|           View = inverse(actual_view_transform) * gpushxto0(h) * actual_view_transform * View; |           View = inverse(actual_view_transform) * gpushxto0(h) * actual_view_transform * View; | ||||||
|           shift_view(ztangent(follow_dist)); |           shift_view(ztangent(follow_dist)); | ||||||
|           } |           } | ||||||
|   | |||||||
| @@ -124,7 +124,7 @@ void create_sokowalls(cell *c) { | |||||||
|     hyperpoint h0 = get_corner_position(c, b); |     hyperpoint h0 = get_corner_position(c, b); | ||||||
|     hyperpoint h1 = get_corner_position(c, b+1); |     hyperpoint h1 = get_corner_position(c, b+1); | ||||||
|     hyperpoint h2 = normalize(h0 * (qfr-fr) + h1 * fr); |     hyperpoint h2 = normalize(h0 * (qfr-fr) + h1 * fr); | ||||||
|     return mscale(h2, 1 / (1 - a / 6.1)); |     return orthogonal_move_fol(h2, 1 / (1 - a / 6.1)); | ||||||
|     }; |     }; | ||||||
|    |    | ||||||
|   for(int a=0; a<9; a++)  |   for(int a=0; a<9; a++)  | ||||||
|   | |||||||
| @@ -57,7 +57,7 @@ void prepare_tf() { | |||||||
|       hx[3] = 1; |       hx[3] = 1; | ||||||
|       if(hyperbolic) hx = spin(45._deg) * hx; |       if(hyperbolic) hx = spin(45._deg) * hx; | ||||||
|       hx = normalize(hx); |       hx = normalize(hx); | ||||||
|       hx = zshift(hx, h[2]*(t*(sphere ? 3 : 7))); |       hx = orthogonal_move(hx, h[2]*(t*(sphere ? 3 : 7))); | ||||||
|  |  | ||||||
|       return {0, hx};  |       return {0, hx};  | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -20,14 +20,14 @@ void set_wall(cell *c, color_t col) { | |||||||
| map<cellwalker, int> plane; | map<cellwalker, int> plane; | ||||||
|  |  | ||||||
| cellwalker flatspin(cellwalker cw, int i) { | cellwalker flatspin(cellwalker cw, int i) { | ||||||
|   if(hybri && cw.spin < cw.at->type - 2) |   if(mhybrid && cw.spin < cw.at->type - 2) | ||||||
|     cw.spin = gmod(cw.spin + (cw.mirrored ? -i : i), cw.at->type - 2); |     cw.spin = gmod(cw.spin + (cw.mirrored ? -i : i), cw.at->type - 2); | ||||||
|   return cw; |   return cw; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| cellwalker gstrafe(cellwalker cw, int i) { | cellwalker gstrafe(cellwalker cw, int i) { | ||||||
|   if(reg3::in()) return currentmap->strafe(cw, i); |   if(reg3::in()) return currentmap->strafe(cw, i); | ||||||
|   if(prod) { |   if(mproduct) { | ||||||
|     if(i == cw.at->type-2 || i == cw.at->type-1) |     if(i == cw.at->type-2 || i == cw.at->type-1) | ||||||
|       return cellwalker(cw.at->move(i), cw.spin); |       return cellwalker(cw.at->move(i), cw.spin); | ||||||
|     else for(int k: {-1, 1}) |     else for(int k: {-1, 1}) | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ color_t rainbow_color_at(hyperpoint h) { | |||||||
|   } |   } | ||||||
|    |    | ||||||
| void set_cell(cell *c) { | void set_cell(cell *c) { | ||||||
|   if(hybri) { |   if(mhybrid) { | ||||||
|     cell *c1 = hybrid::get_where(c).first; |     cell *c1 = hybrid::get_where(c).first; | ||||||
|     if(c1->land != laHive) hybrid::in_underlying_geometry([&] { set_cell(c1); }); |     if(c1->land != laHive) hybrid::in_underlying_geometry([&] { set_cell(c1); }); | ||||||
|     c->land = c1->land; |     c->land = c1->land; | ||||||
|   | |||||||
| @@ -452,7 +452,7 @@ void queuedisk(const shiftmatrix& V, const colorpair& cp, bool legend, const str | |||||||
|     queuepolyat(V, sh, 0x80, PPR::MONSTER_SHADOW);  |     queuepolyat(V, sh, 0x80, PPR::MONSTER_SHADOW);  | ||||||
|     poly_outline = p;  |     poly_outline = p;  | ||||||
|     if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); }); |     if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); }); | ||||||
|     queuepolyat(V1 = mscale(V, cgi.BODY), sh, darken_a(cp.color1), PPR::MONSTER_HEAD); |     queuepolyat(V1 = orthogonal_move_fol(V, cgi.BODY), sh, darken_a(cp.color1), PPR::MONSTER_HEAD); | ||||||
|     if(info) queueaction(PPR::MONSTER_HEAD, [] () { SVG_LINK(""); }); |     if(info) queueaction(PPR::MONSTER_HEAD, [] () { SVG_LINK(""); }); | ||||||
|     } |     } | ||||||
|   else { |   else { | ||||||
|   | |||||||
| @@ -635,7 +635,7 @@ namespace sag { | |||||||
|  |  | ||||||
|   ld pdist(hyperpoint hi, hyperpoint hj) { |   ld pdist(hyperpoint hi, hyperpoint hj) { | ||||||
|     if(sol) return min(geo_dist(hi, hj), geo_dist(hj, hi)); |     if(sol) return min(geo_dist(hi, hj), geo_dist(hj, hi)); | ||||||
|     if(prod && angular) { |     if(mproduct && angular) { | ||||||
|  |  | ||||||
|       auto di = product_decompose(hi); |       auto di = product_decompose(hi); | ||||||
|       auto dj = product_decompose(hj); |       auto dj = product_decompose(hj); | ||||||
| @@ -1146,7 +1146,7 @@ void geo_stats() { | |||||||
|     out("nodes", isize(sagcells)); |     out("nodes", isize(sagcells)); | ||||||
|     out("maxsagdist", max_sag_dist); |     out("maxsagdist", max_sag_dist); | ||||||
|     out("dim", (euclid && WDIM == 2 && euc::eu.user_axes[1][1] == 1) ? 1 : WDIM); |     out("dim", (euclid && WDIM == 2 && euc::eu.user_axes[1][1] == 1) ? 1 : WDIM); | ||||||
|     out("geometry", S3 >= OINF ? "tree" : hyperbolic ? "hyperbolic" : sphere ? "sphere" : euclid ? "euclid" : nil ? "nil" : sol ? "solv" : prod ? "product" : "other"); |     out("geometry", S3 >= OINF ? "tree" : hyperbolic ? "hyperbolic" : sphere ? "sphere" : euclid ? "euclid" : nil ? "nil" : sol ? "solv" : mproduct ? "product" : "other"); | ||||||
|     out("closed", max_sag_dist == isize(sagcells) ? 0 : closed_manifold ? 1 : 0); |     out("closed", max_sag_dist == isize(sagcells) ? 0 : closed_manifold ? 1 : 0); | ||||||
|     out("angular", angular); |     out("angular", angular); | ||||||
|     for(int p: {1, 10, 50}) { out(format("sagdist%02d", p), sorted_sagdist[(p * sorted_sagdist.size()) / 100]); } |     for(int p: {1, 10, 50}) { out(format("sagdist%02d", p), sorted_sagdist[(p * sorted_sagdist.size()) / 100]); } | ||||||
|   | |||||||
| @@ -423,7 +423,7 @@ void show() { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| void prepare_for_interpolation(hyperpoint& h) { | void prepare_for_interpolation(hyperpoint& h) { | ||||||
|   if(prod) { |   if(gproduct) { | ||||||
|     h[3] = zlevel(h); |     h[3] = zlevel(h); | ||||||
|     ld t = exp(h[3]); |     ld t = exp(h[3]); | ||||||
|     h[0] /= t; |     h[0] /= t; | ||||||
| @@ -433,7 +433,7 @@ void prepare_for_interpolation(hyperpoint& h) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| void after_interpolation(hyperpoint& h) { | void after_interpolation(hyperpoint& h) { | ||||||
|   if(prod) { |   if(gproduct) { | ||||||
|     ld v = exp(h[3]) / sqrt(abs(intval(h, Hypc))); |     ld v = exp(h[3]) / sqrt(abs(intval(h, Hypc))); | ||||||
|     h[0] *= v; |     h[0] *= v; | ||||||
|     h[1] *= v; |     h[1] *= v; | ||||||
|   | |||||||
| @@ -83,11 +83,11 @@ transmatrix random_snow_matrix(cell *c) { | |||||||
|     h[2] = -h[2]; |     h[2] = -h[2]; | ||||||
|     return rgpushxto0(h); |     return rgpushxto0(h); | ||||||
|     } |     } | ||||||
|   else if(prod) { |   else if(mproduct) { | ||||||
|     transmatrix T = PIU(random_snow_matrix(c)); |     transmatrix T = PIU(random_snow_matrix(c)); | ||||||
|     return mscale(T, (randd() - .5) * cgi.plevel); |     return orthogonal_move(T, (randd() - .5) * cgi.plevel); | ||||||
|     } |     } | ||||||
|   else if(hybri && !prod) { |   else if(mhybrid && !mproduct) { | ||||||
|     return rots::lift_matrix(PIU(random_snow_matrix(c))); // * zpush((randd() - .5) * cgi.plevel); |     return rots::lift_matrix(PIU(random_snow_matrix(c))); // * zpush((randd() - .5) * cgi.plevel); | ||||||
|     } |     } | ||||||
|   else if(nonisotropic || bt::in()) { |   else if(nonisotropic || bt::in()) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue