added some missing CAP_ guards

This commit is contained in:
Zeno Rogue 2023-02-18 12:53:52 +01:00
parent 53483005cf
commit d108f27dcf
4 changed files with 24 additions and 0 deletions

View File

@ -2277,6 +2277,7 @@ EX void display_embedded_errors() {
}
}
if(meuclid && spatial_embedding == seProductS) {
#if CAP_RUG
rug::clifford_torus ct;
bool err = sqhypot_d(2, ct.xh) < 1e-3 && sqhypot_d(2, ct.yh) < 1e-3;
if(err) {
@ -2290,6 +2291,9 @@ EX void display_embedded_errors() {
geom3::apply_settings_full(); start_game(); }); });
return;
}
#else
dialog::addInfo(XLAT("error: not supported"), 0xC00000);
#endif
}
if(msphere && !among(spatial_embedding, seNone, seDefault, seLowerCurvature, seMuchLowerCurvature, seProduct, seProductS)) {
dialog::addInfo(XLAT("error: this method does not work in spherical geometry"), 0xC00000);
@ -2330,6 +2334,7 @@ EX void show_spatial_embedding() {
if(emb == geom3::seNone) {
dialog::addBoolItem(XLAT("third-person perspective"), in_tpp(), 'T');
dialog::add_action(geom3::switch_tpp);
#if CAP_RUG
dialog::addBoolItem(XLAT("Hypersian Rug"), rug::rugged, 'u');
dialog::add_action([] {
if(in_tpp()) geom3::switch_tpp();
@ -2338,6 +2343,7 @@ EX void show_spatial_embedding() {
}
else rug::close();
});
#endif
dialog::addBreak(100);
}
else {
@ -2463,10 +2469,12 @@ EX void show3D() {
dialog::addSelItem(XLAT("projection"), current_proj_name(), 'M');
dialog::add_action_push(models::model_menu);
}
#if CAP_RUG
if(GDIM == 2) {
dialog::addItem(XLAT("configure Hypersian Rug"), 'u');
dialog::add_action_push(rug::show);
}
#endif
#if MAXMDIM >= 4
if(GDIM == 3) add_edit_fov('f');

View File

@ -68,9 +68,13 @@ EX namespace geom3 {
};
EX bool clifford_torus_valid() {
#if CAP_RUG
rug::clifford_torus ct;
ld h = ct.xh | ct.yh;
return !(sqhypot_d(2, ct.xh) < 1e-3 || sqhypot_d(2, ct.yh) < 1e-3 || abs(h) > 1e-3);
#else
return false;
#endif
}
EX string why_wrong(eSpatialEmbedding sp) {
@ -198,6 +202,7 @@ EX namespace geom3 {
}
EX void configure_clifford_torus() {
#if CAP_RUG
dynamicval<ld> dtessf(cgi.tessf, 1);
rug::clifford_torus ct;
@ -220,9 +225,11 @@ EX namespace geom3 {
vid.depth = alpha - 1;
vid.wall_height = min(1 / euclid_embed_scale_mean(), (90._deg - alpha) * 0.9);
vid.eye = vid.wall_height / 2 - vid.depth;
#endif
}
EX void configure_cylinder() {
#if CAP_RUG
dynamicval<ld> dtessf(cgi.tessf, 1);
rug::clifford_torus ct;
hyperpoint vec;
@ -233,6 +240,7 @@ EX namespace geom3 {
euclid_embed_scale = TAU / hypot_d(2, vec);
euclid_embed_scale_y = 1;
euclid_embed_rotate = atan2(vec[1], vec[0]) / degree;
#endif
}
EX }
@ -425,22 +433,26 @@ struct emb_none : embedding_method {
struct emb_actual : embedding_method {
hyperpoint base_to_logical(hyperpoint h) override {
#if CAP_BT
if(bt::in()) {
auto h1 = bt::inverse_horopoint(h);
h1[2] = 0; h1[3] = 1;
return h1;
}
#endif
h /= h[2];
h[2] = 0; h[3] = 1;
return h;
}
hyperpoint logical_to_base(hyperpoint h) override {
#if CAP_BT
if(bt::in()) {
auto h1 = bt::get_horopoint(h);
h1[3] = 1;
return h1;
}
#endif
h[2] = 1; h = normalize(h);
h[3] = 1;
return h;

View File

@ -694,6 +694,7 @@ EX void world_list() {
switch_to(c);
dialog::end_list();
dialog::addBreak(100);
#if CAP_EDIT
dialog::addItem("add a saved world to the scene", 'a');
dialog::add_action([] {
dialog::openFileDialog(levelfile, XLAT("level to load:"), ".lev", [] () {
@ -713,6 +714,7 @@ EX void world_list() {
}
});
});
#endif
dialog::addBack();
dialog::display();
}

View File

@ -532,7 +532,9 @@ EX struct renderbuffer *airbuf;
EX void swap_if_missing(bool missing) {
if(!missing) return;
arb::swap_vertices();
#if CAP_IRR
irr::swap_vertices();
#endif
}
EX void make_air() {