mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 13:01:37 +02:00
get weights when first_collasped_propagated
This commit is contained in:
@@ -59,12 +59,9 @@ function get_state_weight(weights, state) = weights[search([state], weights)[0]]
|
||||
function wf_collapse(wf, x, y, weights) =
|
||||
let(
|
||||
states = wf_eigenstates_at(wf, x, y),
|
||||
wets = is_undef(weights) ?
|
||||
let(all_weights = wf_weights(wf)) [for(state = states) get_state_weight(all_weights, state)] :
|
||||
weights,
|
||||
threshold = rand() * sum(wets)
|
||||
threshold = rand() * sum(weights)
|
||||
)
|
||||
_wf_collapse(wf, x, y, states, wets, len(states), threshold);
|
||||
_wf_collapse(wf, x, y, states, weights, len(states), threshold);
|
||||
|
||||
function _wf_collapse(wf, x, y, states, weights, leng, threshold, i = 0) =
|
||||
threshold < 0 || i == leng ? wf :
|
||||
|
@@ -11,11 +11,15 @@ function tile_wfc(size, sample) =
|
||||
w = tilemap_width(tm),
|
||||
h = tilemap_height(tm),
|
||||
compatibilities = tilemap_compatibilities(tm),
|
||||
wf = tilemap_wf(tm),
|
||||
all_weights = wf_weights(wf),
|
||||
states = wf_eigenstates_at(wf, x, y),
|
||||
weights = [for(state = states) get_state_weight(all_weights, state)],
|
||||
first_collasped_propagated = propagate(
|
||||
w,
|
||||
h,
|
||||
compatibilities,
|
||||
wf_collapse(tilemap_wf(tm), x, y),
|
||||
wf_collapse(wf, x, y, weights),
|
||||
x,
|
||||
y
|
||||
),
|
||||
|
Reference in New Issue
Block a user