From 9498a1de0350758703e1eaefa93aeba799630c40 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 15 Dec 2022 12:48:25 +0100 Subject: [PATCH] more intuitive 3D setting --- config.cpp | 71 +++++++++++++++++++++++++++++++++++++++------------- geometry.cpp | 13 ++++++++-- 2 files changed, 64 insertions(+), 20 deletions(-) diff --git a/config.cpp b/config.cpp index ba736936..433c6de8 100644 --- a/config.cpp +++ b/config.cpp @@ -837,6 +837,9 @@ EX void initConfig() { param_f(geom3::euclid_embed_scale, "euclid_embed_scale", "euclid_embed_scale"); + param_b(geom3::auto_configure, "auto_configure_3d", "auto_configure_3d") + -> editable("set 3D settings automatically", 'A'); + param_enum(geom3::spatial_embedding, "spatial_embedding", "spatial_embedding", geom3::seDefault) ->editable(geom3::spatial_embedding_options, "3D embedding method", 'E') ->set_reaction([] { @@ -2203,6 +2206,53 @@ EX void edit_levellines(char c) { }); } +EX geom3::eSpatialEmbedding shown_spatial_embedding() { + if(GDIM == 2) { + if(pmodel == mdDisk && pconf.camera_angle) + return geom3::seTPP; + else + return geom3::seNone; + } + return geom3::spatial_embedding; + } + +EX void show_spatial_embedding() { + cmode = sm::SIDE | sm::MAYDARK | sm::CENTER | sm::PANNING | sm::SHOWCURSOR; + gamescreen(); + dialog::init(XLAT("3D styles")); + auto emb = shown_spatial_embedding(); + add_edit(geom3::auto_configure); + + dialog::addBreak(100); + + auto &seo = geom3::spatial_embedding_options; + + for(int i=0; i=4 if(WDIM == 2) { - if(WDIM == 2) add_edit(geom3::spatial_embedding); - dialog::addBoolItem(XLAT("configure FPP automatically"), GDIM == 3, 'F'); - dialog::add_action(geom3::switch_fpp); + dialog::addSelItem("3D style", geom3::spatial_embedding_options[shown_spatial_embedding()].first, 'E'); + dialog::add_action_push(show_spatial_embedding); + dialog::addBreak(50); } #endif - dialog::addBreak(50); - - if(GDIM == 2) { - dialog::addBoolItem(XLAT("configure TPP automatically"), pmodel == mdDisk && pconf.camera_angle, 'T'); - dialog::add_action(geom3::switch_tpp); - } - - dialog::addBreak(50); - -#if MAXMDIM >= 4 - if(WDIM == 2) { - dialog::addBoolItem(XLAT("use the full 3D models"), vid.always3, 'U'); - dialog::add_action(geom3::switch_always3); - } -#endif if(vid.use_smart_range == 0 && GDIM == 2) { add_edit(vid.highdetail); add_edit(vid.middetail); diff --git a/geometry.cpp b/geometry.cpp index 94280e7b..9f660b18 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1073,6 +1073,8 @@ EX namespace geom3 { #if HDR enum eSpatialEmbedding { + seNone, + seTPP, seDefault, seFlat, seInverted, @@ -1088,7 +1090,9 @@ EX namespace geom3 { #endif EX vector> spatial_embedding_options = { - {"default", "Embed as a equidistant surface in the 3D version of the same geometry. This is the model used by HyperRogue in its 2D graphics."}, + {"2D engine", "Use HyperRogue's 2D engine to simulate 'default 3D' top-down."}, + {"2D engine in TPP","HyperRogue's 2D engine, but using third-person perspective."}, + {"default 3D", "Embed as a equidistant surface in the 3D version of the same geometry."}, {"flat", "Embed as a flat surface in the 3D version of the same geometry."}, {"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."}, @@ -1103,8 +1107,13 @@ EX namespace geom3 { {"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; + EX eSpatialEmbedding spatial_embedding = seDefault; EX ld euclid_embed_scale = 1; + EX bool auto_configure = true; + + EX bool is_suboption(eSpatialEmbedding se) { + return among(se, seTPP, seInverted, seFlat, seLowerCurvatureInverted, seMuchLowerCurvatureInverted, seNIH_inv); + } EX vector ginf_backup;