mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
moved underlying space drawer from rots to hybrid, and renamed the rest of rots:: to twist::
This commit is contained in:
parent
57759e95bc
commit
3d9c4c838e
@ -1598,8 +1598,8 @@ EX void initConfig() {
|
||||
});
|
||||
|
||||
param_i(s2xe::qrings, "s2xe-rings");
|
||||
param_f(rots::underlying_scale, "rots-underlying-scale");
|
||||
param_b(rots::underlying_as_pc, "underlying_as_pc")
|
||||
param_f(hybrid::underlying_scale, "rots-underlying-scale");
|
||||
param_b(hybrid::underlying_as_pc, "underlying_as_pc")
|
||||
-> editable("draw PC on the underlying map", 'P');
|
||||
|
||||
param_b(vid.bubbles_special, "bubbles-special", 1);
|
||||
|
@ -1069,10 +1069,10 @@ EX void showEuclideanMenu() {
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(mhybrid) {
|
||||
auto r = rots::underlying_scale;
|
||||
auto r = hybrid::underlying_scale;
|
||||
dialog::addSelItem(XLAT("view the underlying geometry"), r > 0 ? fts(r)+"x" : ONOFF(false), '6');
|
||||
dialog::add_action([] {
|
||||
dialog::editNumber(rots::underlying_scale, 0, 1, 0.05, 0.25, XLAT("view the underlying geometry"),
|
||||
dialog::editNumber(hybrid::underlying_scale, 0, 1, 0.05, 0.25, XLAT("view the underlying geometry"),
|
||||
geometry == gTwistedProduct ?
|
||||
XLAT("The space you are currently in a twisted product space. ")
|
||||
: XLAT("You are currently in a product space.") +
|
||||
@ -1083,7 +1083,7 @@ EX void showEuclideanMenu() {
|
||||
);
|
||||
dialog::bound_low(0);
|
||||
dialog::bound_up(1);
|
||||
dialog::get_di().extra_options = [] () { rots::draw_underlying(true); };
|
||||
dialog::get_di().extra_options = [] () { hybrid::draw_underlying(true); };
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
@ -5575,7 +5575,7 @@ EX void calcparam() {
|
||||
|
||||
ld aradius = sphere ? cd->radius / (pconf.alpha - 1) : cd->radius;
|
||||
#if MAXMDIM >= 4
|
||||
if(euclid && rots::drawing_underlying) aradius *= 2.5;
|
||||
if(euclid && hybrid::drawing_underlying) aradius *= 2.5;
|
||||
#endif
|
||||
|
||||
if(dronemode) { cd->ycenter -= cd->radius; cd->ycenter += vid.fsize/2; cd->ycenter += vid.fsize/2; cd->radius *= 2; }
|
||||
|
2
hud.cpp
2
hud.cpp
@ -492,7 +492,7 @@ EX void drawStats() {
|
||||
bool cornermode = (vid.xres > vid.yres * 85/100 && vid.yres > vid.xres * 85/100);
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(among(geometry, gProduct, gTwistedProduct)) rots::draw_underlying(!cornermode);
|
||||
if(mhybrid) hybrid::draw_underlying(!cornermode);
|
||||
#endif
|
||||
|
||||
{
|
||||
|
@ -1648,7 +1648,7 @@ EX hyperpoint direct_exp(hyperpoint v) {
|
||||
#endif
|
||||
#if MAXMDIM >= 4
|
||||
if(nil) return nilv::formula_exp(v);
|
||||
if(sl2 || stretch::in()) return stretch::mstretch ? nisot::numerical_exp(v) : rots::formula_exp(v);
|
||||
if(sl2 || stretch::in()) return stretch::mstretch ? nisot::numerical_exp(v) : twist::formula_exp(v);
|
||||
#endif
|
||||
if(gproduct) return product::direct_exp(v);
|
||||
ld d = hypot_d(GDIM, v);
|
||||
|
@ -3276,7 +3276,7 @@ EX bool do_draw(cell *c, const shiftmatrix& T) {
|
||||
}
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(rots::drawing_underlying && euclid && hdist0(tC0(T)) > 6) return false;
|
||||
if(hybrid::drawing_underlying && euclid && hdist0(tC0(T)) > 6) return false;
|
||||
#endif
|
||||
if(just_gmatrix && sphere) return true;
|
||||
if(!do_draw(c)) return false;
|
||||
|
166
nonisotropic.cpp
166
nonisotropic.cpp
@ -1730,6 +1730,85 @@ EX namespace hybrid {
|
||||
};
|
||||
}
|
||||
|
||||
EX ld underlying_scale = 0;
|
||||
EX bool drawing_underlying = false;
|
||||
EX bool underlying_as_pc = true;
|
||||
|
||||
EX void draw_underlying(bool cornermode) {
|
||||
if(underlying_scale <= 0) return;
|
||||
ld d = hybrid::get_where(centerover).second;
|
||||
d *= cgi.plevel;
|
||||
transmatrix T = twist::uzpush(-d) * spin(-2*d);
|
||||
|
||||
if(det(T) < 0) T = centralsym * T;
|
||||
|
||||
ld orig_d = d;
|
||||
if(mproduct) d = 0;
|
||||
|
||||
hyperpoint h = inverse(View * spin(master_to_c7_angle()) * T) * C0;
|
||||
|
||||
auto g = std::move(gmatrix);
|
||||
auto g0 = std::move(gmatrix0);
|
||||
|
||||
ld alpha = atan2(ortho_inverse(NLP) * point3(1, 0, 0));
|
||||
|
||||
dynamicval<transmatrix> dn(NLP);
|
||||
dynamicval<transmatrix> dv(View);
|
||||
|
||||
bool inprod = mproduct;
|
||||
transmatrix pView = View;
|
||||
|
||||
if(inprod) {
|
||||
ld z = zlevel(tC0(View));
|
||||
|
||||
/* special case when we are actually in E2xE as a rotation space */
|
||||
if(in_e2xe() && abs(cgi.plevel * hybrid::csteps - TAU) < 1e-6) alpha = orig_d - z;
|
||||
|
||||
println(hlog, "depth = ", cgi.plevel * hybrid::csteps, " orig_d = ", orig_d, " z = ", z);
|
||||
|
||||
pView = spin(alpha) * View;
|
||||
|
||||
for(int a=0; a<3; a++) pView[a] *= exp(-z);
|
||||
}
|
||||
|
||||
cell *co = hybrid::get_where(centerover).first;
|
||||
|
||||
hybrid::in_underlying_geometry([&] {
|
||||
cgi.require_shapes();
|
||||
dynamicval<int> pcc(corner_centering, cornermode ? 1 : 2);
|
||||
dynamicval<bool> pf(playerfound, true);
|
||||
dynamicval<cell*> m5(centerover, co);
|
||||
dynamicval<transmatrix> m2(View, inprod ? pView : ypush(0) * twist::qtm(h));
|
||||
if(PURE && !inprod) View = View * pispin;
|
||||
View = inverse(stretch::mstretch_matrix) * spin(2*d) * View;
|
||||
dynamicval<shiftmatrix> m3(playerV, shiftless(Id));
|
||||
dynamicval<transmatrix> m4(actual_view_transform, Id);
|
||||
dynamicval<shiftmatrix> m6(cwtV, shiftless(Id));
|
||||
dynamicval<eModel> pm(pmodel, mdDisk);
|
||||
dynamicval<ld> pss(pconf.scale, (sphere ? 10 : euclid ? .4 : 1) * underlying_scale);
|
||||
dynamicval<ld> psa(pconf.alpha, sphere ? 10 : 1);
|
||||
dynamicval<hrmap*> p(hybrid::pmap, NULL);
|
||||
dynamicval<int> psr(sightrange_bonus, 0);
|
||||
|
||||
dynamicval<int> psx(vid.use_smart_range, 2);
|
||||
dynamicval<ld> psy(vid.smart_range_detail, 1);
|
||||
dynamicval<bool> pdu(drawing_underlying, true);
|
||||
|
||||
calcparam();
|
||||
reset_projection(); current_display->set_all(0, 0);
|
||||
ptds.clear();
|
||||
drawthemap();
|
||||
if(underlying_as_pc) drawPlayer(moPlayer, centerover, sphere ? shiftless(xpush(M_PI) * spin90()) : shiftless(spin90()), 0xFFFFFFFF, 0);
|
||||
drawqueue();
|
||||
if(!underlying_as_pc) displaychr(current_display->xcenter, current_display->ycenter, 0, 24 * mapfontscale / 100, '+', 0xFFFFFFFF);
|
||||
glflush();
|
||||
});
|
||||
gmatrix = std::move(g);
|
||||
gmatrix0 = std::move(g0);
|
||||
calcparam();
|
||||
reset_projection(); current_display->set_all(0, 0); make_actual_view();
|
||||
}
|
||||
|
||||
EX }
|
||||
|
||||
EX namespace product {
|
||||
@ -2243,8 +2322,7 @@ EX namespace slr {
|
||||
|
||||
EX }
|
||||
|
||||
EX namespace rots {
|
||||
EX ld underlying_scale = 0;
|
||||
EX namespace twist {
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
EX transmatrix uxpush(ld x) {
|
||||
@ -2280,7 +2358,7 @@ EX namespace rots {
|
||||
|
||||
EX std::map<int, transmatrix> saved_matrices_ray;
|
||||
|
||||
struct hrmap_rotation_space : hybrid::hrmap_hybrid {
|
||||
struct hrmap_twisted : hybrid::hrmap_hybrid {
|
||||
|
||||
std::map<int, transmatrix> saved_matrices;
|
||||
|
||||
@ -2389,84 +2467,6 @@ EX namespace rots {
|
||||
|
||||
return M;
|
||||
}
|
||||
|
||||
EX bool drawing_underlying = false;
|
||||
EX bool underlying_as_pc = true;
|
||||
|
||||
EX void draw_underlying(bool cornermode) {
|
||||
if(underlying_scale <= 0) return;
|
||||
ld d = hybrid::get_where(centerover).second;
|
||||
d *= cgi.plevel;
|
||||
transmatrix T = rots::uzpush(-d) * spin(-2*d);
|
||||
|
||||
if(det(T) < 0) T = centralsym * T;
|
||||
|
||||
ld orig_d = d;
|
||||
if(mproduct) d = 0;
|
||||
|
||||
hyperpoint h = inverse(View * spin(master_to_c7_angle()) * T) * C0;
|
||||
|
||||
auto g = std::move(gmatrix);
|
||||
auto g0 = std::move(gmatrix0);
|
||||
|
||||
ld alpha = atan2(ortho_inverse(NLP) * point3(1, 0, 0));
|
||||
|
||||
dynamicval<transmatrix> dn(NLP);
|
||||
dynamicval<transmatrix> dv(View);
|
||||
|
||||
bool inprod = mproduct;
|
||||
transmatrix pView = View;
|
||||
|
||||
if(inprod) {
|
||||
ld z = zlevel(tC0(View));
|
||||
|
||||
/* special case when we are actually in E2xE as a rotation space */
|
||||
if(in_e2xe() && abs(cgi.plevel * hybrid::csteps - TAU) < 1e-6) alpha = orig_d - z;
|
||||
|
||||
println(hlog, "depth = ", cgi.plevel * hybrid::csteps, " orig_d = ", orig_d, " z = ", z);
|
||||
|
||||
pView = spin(alpha) * View;
|
||||
|
||||
for(int a=0; a<3; a++) pView[a] *= exp(-z);
|
||||
}
|
||||
|
||||
cell *co = hybrid::get_where(centerover).first;
|
||||
|
||||
hybrid::in_underlying_geometry([&] {
|
||||
cgi.require_shapes();
|
||||
dynamicval<int> pcc(corner_centering, cornermode ? 1 : 2);
|
||||
dynamicval<bool> pf(playerfound, true);
|
||||
dynamicval<cell*> m5(centerover, co);
|
||||
dynamicval<transmatrix> m2(View, inprod ? pView : ypush(0) * qtm(h));
|
||||
if(PURE && !inprod) View = View * pispin;
|
||||
View = inverse(stretch::mstretch_matrix) * spin(2*d) * View;
|
||||
dynamicval<shiftmatrix> m3(playerV, shiftless(Id));
|
||||
dynamicval<transmatrix> m4(actual_view_transform, Id);
|
||||
dynamicval<shiftmatrix> m6(cwtV, shiftless(Id));
|
||||
dynamicval<eModel> pm(pmodel, mdDisk);
|
||||
dynamicval<ld> pss(pconf.scale, (sphere ? 10 : euclid ? .4 : 1) * underlying_scale);
|
||||
dynamicval<ld> psa(pconf.alpha, sphere ? 10 : 1);
|
||||
dynamicval<hrmap*> p(hybrid::pmap, NULL);
|
||||
dynamicval<int> psr(sightrange_bonus, 0);
|
||||
|
||||
dynamicval<int> psx(vid.use_smart_range, 2);
|
||||
dynamicval<ld> psy(vid.smart_range_detail, 1);
|
||||
dynamicval<bool> pdu(drawing_underlying, true);
|
||||
|
||||
calcparam();
|
||||
reset_projection(); current_display->set_all(0, 0);
|
||||
ptds.clear();
|
||||
drawthemap();
|
||||
if(underlying_as_pc) drawPlayer(moPlayer, centerover, sphere ? shiftless(xpush(M_PI) * spin90()) : shiftless(spin90()), 0xFFFFFFFF, 0);
|
||||
drawqueue();
|
||||
if(!underlying_as_pc) displaychr(current_display->xcenter, current_display->ycenter, 0, 24 * mapfontscale / 100, '+', 0xFFFFFFFF);
|
||||
glflush();
|
||||
});
|
||||
gmatrix = std::move(g);
|
||||
gmatrix0 = std::move(g0);
|
||||
calcparam();
|
||||
reset_projection(); current_display->set_all(0, 0); make_actual_view();
|
||||
}
|
||||
|
||||
/** @brief exponential function for both slr and Berger sphere */
|
||||
|
||||
@ -3047,7 +3047,7 @@ EX namespace nisot {
|
||||
#endif
|
||||
if(mproduct) return new product::hrmap_product;
|
||||
#if MAXMDIM >= 4
|
||||
if(mhybrid) return new rots::hrmap_rotation_space;
|
||||
if(mhybrid) return new twist::hrmap_twisted;
|
||||
if(nil) return new nilv::hrmap_nil;
|
||||
#endif
|
||||
return NULL;
|
||||
@ -3105,7 +3105,7 @@ EX namespace nisot {
|
||||
}
|
||||
else if(argis("-rot_uscale")) {
|
||||
PHASEFROM(2);
|
||||
shift_arg_formula(rots::underlying_scale);
|
||||
shift_arg_formula(hybrid::underlying_scale);
|
||||
return 0;
|
||||
}
|
||||
else if(argis("-nilperiod")) {
|
||||
|
@ -2641,7 +2641,7 @@ EX int rmap_get_id_of(cell *c) {
|
||||
EX void reset_raycaster() {
|
||||
our_raycaster = nullptr;
|
||||
reset_rmap = true;
|
||||
rots::saved_matrices_ray = {};
|
||||
twist::saved_matrices_ray = {};
|
||||
}
|
||||
|
||||
EX void reset_raycaster_map() {
|
||||
|
@ -240,8 +240,8 @@ auto hooks =
|
||||
if(mode == pmStart) {
|
||||
set_geometry(gSphere);
|
||||
set_variation(eVariation::bitruncated);
|
||||
set_geometry(gRotSpace);
|
||||
slide_backup(rots::underlying_scale, .25);
|
||||
hybrid::enable_rotspace();
|
||||
slide_backup(hybrid::underlying_scale, .25);
|
||||
slide_backup(qmode, m);
|
||||
IF_RAY(
|
||||
slide_backup(ray::max_cells, 32768);
|
||||
@ -266,8 +266,8 @@ auto hooks =
|
||||
if(mode == pmStart) {
|
||||
set_geometry(gKleinQuartic);
|
||||
set_variation(eVariation::bitruncated);
|
||||
set_geometry(gRotSpace);
|
||||
slide_backup(rots::underlying_scale, .25);
|
||||
hybrid::enable_rotspace();
|
||||
slide_backup(hybrid::underlying_scale, .25);
|
||||
slide_backup(qmode, m);
|
||||
IF_RAY(
|
||||
slide_backup(ray::max_cells, 32768);
|
||||
|
@ -99,8 +99,8 @@ transmatrix random_snow_matrix(cell *c) {
|
||||
transmatrix T = PIU(random_snow_matrix(c));
|
||||
return orthogonal_move(T, (randd() - .5) * cgi.plevel);
|
||||
}
|
||||
else if(mhybrid && !mproduct) {
|
||||
return rots::lift_matrix(PIU(random_snow_matrix(c))); // * zpush((randd() - .5) * cgi.plevel);
|
||||
else if(mtwisted) {
|
||||
return twist::lift_matrix(PIU(random_snow_matrix(c))); // * zpush((randd() - .5) * cgi.plevel);
|
||||
}
|
||||
else if(nonisotropic || bt::in()) {
|
||||
|
||||
@ -384,7 +384,7 @@ auto hchook = addHook(hooks_drawcell, 100, draw_snow)
|
||||
snow_slide(v, "SL(2,R)", "Here is SL(2,R), like Nil but based on hyperbolic plane instead. Geometric lensing effects are strong in both Nil and SL(2,R). (Starting with S^2 yields spherical geometry.)", [] {
|
||||
set_geometry(gNormal);
|
||||
set_variation(eVariation::pure);
|
||||
set_geometry(gRotSpace);
|
||||
set_geometry(gTwistedProduct);
|
||||
snow_lambda = 5;
|
||||
});
|
||||
IF_SOLV(snow_slide(v, "Solv", "Solv geometry. Like the non-isotropic hyperbolic geometry but where the horizontal and vertical curvatures work in the other way.", [] {
|
||||
|
Loading…
Reference in New Issue
Block a user