patterns:: treestarter parameter

This commit is contained in:
Zeno Rogue 2022-08-26 12:42:07 +02:00
parent eef03514ca
commit aa539335b4
2 changed files with 13 additions and 4 deletions

View File

@ -649,6 +649,8 @@ EX void initConfig() {
param_b(no_find_player, "no_find_player");
param_b(game_keys_scroll, "game_keys_scroll");
param_b(reg3::cubes_reg3, "cubes_reg3");
param_f(linepatterns::tree_starter, "tree_starter")
-> editable(0, 1, 0.05, "tree-drawing parameter", "How much of edges to draw for tree patterns (to show how the tree edges are oriented).", 't');
param_b(arb::apeirogon_consistent_coloring, "apeirogon_consistent_coloring", true)
-> editable("apeirogon_consistent_coloring", 'c');

View File

@ -2693,13 +2693,15 @@ EX namespace linepatterns {
)
);
EX ld tree_starter = 0.25;
EX linepattern patTree = linepattern("underlying tree", 0x00d0d000, cheating,
ALLCELLS(
if(is_master(c)) {
int dir = updir(c->master);
if(dir == -1) continue;
hyperpoint end = currentmap->master_relative(c, true) * currentmap->adj(c->master, dir) * C0;
hyperpoint start = mid(C0, mid(C0, mid(C0, end)));
hyperpoint start = normalize(C0 + tree_starter * (end - C0));
gridlinef(V, start, V, end, col, 2 + vid.linequality);
}
)
@ -2710,7 +2712,7 @@ EX namespace linepatterns {
int dir = updir_alt(c->master);
if(dir == -1) continue;
hyperpoint end = currentmap->master_relative(c, true) * currentmap->adj(c->master, dir) * C0;
hyperpoint start = mid(C0, mid(C0, mid(C0, end)));
hyperpoint start = normalize(C0 + tree_starter * (end - C0));
gridlinef(V, start, V, end, col, 2 + vid.linequality);
}
)
@ -2861,8 +2863,11 @@ EX namespace linepatterns {
EX linepattern patTriTree = linepattern("triangle grid: tree edges", 0xFFFFFF00, always_available,
ALLCELLS(
cell *parent = ts::right_parent(c, curr_dist);
if(gmatrix.count(parent))
gridlinef(V, C0, V * currentmap->adj(c, neighborId(c, parent)), C0, col, 2 + vid.linequality);
if(gmatrix.count(parent)) {
hyperpoint end = tC0(currentmap->adj(c, neighborId(c, parent)));
hyperpoint start = normalize(C0 + tree_starter * (end - C0));
gridlinef(V, start, V, end, col, 2 + vid.linequality);
}
)
);
EX linepattern patTriOther = linepattern("triangle grid: other edges", 0xFFFFFF00, always_available,
@ -3024,6 +3029,8 @@ EX namespace linepatterns {
dialog::editNumber(width, 0, 10, 0.1, 1, XLAT("line width"), "");
});
add_edit(tree_starter);
dialog::addBoolItem_action("edit widths individually", indiv, 'I');
if(GDIM == 3)