1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

improved Rug in various models

This commit is contained in:
Zeno Rogue 2020-04-17 02:21:44 +02:00
parent e978ed9eac
commit 7f96c67755
3 changed files with 17 additions and 6 deletions

View File

@ -362,6 +362,14 @@ EX void initConfig() {
addsaver(reserve_limit, "memory_reserve", 128); addsaver(reserve_limit, "memory_reserve", 128);
addsaver(show_memory_warning, "show_memory_warning"); addsaver(show_memory_warning, "show_memory_warning");
auto& rconf = vid.rug_config;
addsaverenum(rconf.model, "rug-projection", mdEquidistant);
addsaver(rconf.scale, "rug-projection-scale", 1);
addsaver(rconf.alpha, "rug-projection-alpha", 1);
addsaver(rconf.clip_min, "rug-projection-clip-min", -1);
addsaver(rconf.clip_max, "rug-projection-clip-max", +1);
addsaver(rconf.stretch, "rug-projection-stretch", 1);
addsaver(rconf.halfplane_scale, "rug-projection-halfplane scale", 1);
addsaver(rug::renderonce, "rug-renderonce"); addsaver(rug::renderonce, "rug-renderonce");
addsaver(rug::rendernogl, "rug-rendernogl"); addsaver(rug::rendernogl, "rug-rendernogl");
addsaver(rug::texturesize, "rug-texturesize"); addsaver(rug::texturesize, "rug-texturesize");
@ -893,6 +901,7 @@ string solhelp() {
} }
EX void edit_sightrange() { EX void edit_sightrange() {
USING_NATIVE_GEOMETRY_IN_RUG;
if(vid.use_smart_range) { if(vid.use_smart_range) {
ld& det = WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3; ld& det = WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3;
dialog::editNumber(det, 1, 50, 1, WDIM == 2 ? 8 : 30, XLAT("minimum visible cell in pixels"), ""); dialog::editNumber(det, 1, 50, 1, WDIM == 2 ? 8 : 30, XLAT("minimum visible cell in pixels"), "");

View File

@ -343,18 +343,19 @@ EX namespace models {
cmode = sm::SIDE | sm::MAYDARK | sm::CENTER; cmode = sm::SIDE | sm::MAYDARK | sm::CENTER;
gamescreen(0); gamescreen(0);
dialog::init(XLAT("models & projections")); dialog::init(XLAT("models & projections"));
USING_NATIVE_GEOMETRY_IN_RUG;
for(int i=0; i<mdGUARD; i++) { for(int i=0; i<mdGUARD; i++) {
eModel m = eModel(i); eModel m = eModel(i);
if(m == mdFormula && ISMOBILE) continue; if(m == mdFormula && ISMOBILE) continue;
if(model_available(m)) { if(model_available(m)) {
dialog::addBoolItem(get_model_name(m), pmodel == m, (i < 26 ? 'a'+i : 'A'+i-26)); dialog::addBoolItem(get_model_name(m), vpconf.model == m, (i < 26 ? 'a'+i : 'A'+i-26));
dialog::add_action([m] () { dialog::add_action([m] () {
if(m == mdFormula) { if(m == mdFormula) {
edit_formula(); edit_formula();
return; return;
} }
pmodel = m; vpconf.model = m;
polygonal::solve(); polygonal::solve();
vpconf.alpha = 1; vpconf.scale = 1; vpconf.alpha = 1; vpconf.scale = 1;
if(pmodel == mdBand && sphere) if(pmodel == mdBand && sphere)
@ -401,7 +402,7 @@ EX namespace models {
USING_NATIVE_GEOMETRY_IN_RUG; USING_NATIVE_GEOMETRY_IN_RUG;
dialog::init(XLAT("models & projections")); dialog::init(XLAT("models & projections"));
dialog::addSelItem(XLAT("projection type"), get_model_name(pmodel), 'm'); dialog::addSelItem(XLAT("projection type"), get_model_name(vpconf.model), 'm');
dialog::add_action_push(model_list); dialog::add_action_push(model_list);
if(nonisotropic && !sl2) if(nonisotropic && !sl2)
@ -527,7 +528,7 @@ EX namespace models {
}); });
} }
if(is_3d(vpconf)) { if(is_3d(vpconf) && GDIM == 2) {
dialog::addSelItem(XLAT("camera rotation in 3D models"), fts(vpconf.ballangle) + "°", 'b'); dialog::addSelItem(XLAT("camera rotation in 3D models"), fts(vpconf.ballangle) + "°", 'b');
dialog::add_action(config_camera_rotation); dialog::add_action(config_camera_rotation);
} }
@ -670,7 +671,7 @@ EX namespace models {
dialog::addItem(XLAT("history mode"), 'a'); dialog::addItem(XLAT("history mode"), 'a');
dialog::add_action_push(history::history_menu); dialog::add_action_push(history::history_menu);
#if CAP_RUG #if CAP_RUG
if(GDIM == 2) { if(GDIM == 2 || rug::rugged) {
dialog::addItem(XLAT("hypersian rug mode"), 'u'); dialog::addItem(XLAT("hypersian rug mode"), 'u');
dialog::add_action_push(rug::show); dialog::add_action_push(rug::show);
} }

View File

@ -1081,9 +1081,10 @@ EX void drawRugScene() {
rug.V = rugView; rug.V = rugView;
rug.offset_texture = 0; rug.offset_texture = 0;
rug.tinf = &tinf; rug.tinf = &tinf;
rug.flags = POLY_TRIANGLES | POLY_FAT | POLY_PRINTABLE; rug.flags = POLY_TRIANGLES | POLY_FAT | POLY_PRINTABLE | POLY_ALWAYS_IN | POLY_ISSIDE;
dynamicval<projection_configuration> p(pconf, rconf); dynamicval<projection_configuration> p(pconf, rconf);
calcparam();
drawqueue(); drawqueue();
} }