mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 14:04:53 +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) =
|
function wf_collapse(wf, x, y, weights) =
|
||||||
let(
|
let(
|
||||||
states = wf_eigenstates_at(wf, x, y),
|
states = wf_eigenstates_at(wf, x, y),
|
||||||
wets = is_undef(weights) ?
|
threshold = rand() * sum(weights)
|
||||||
let(all_weights = wf_weights(wf)) [for(state = states) get_state_weight(all_weights, state)] :
|
|
||||||
weights,
|
|
||||||
threshold = rand() * sum(wets)
|
|
||||||
)
|
)
|
||||||
_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) =
|
function _wf_collapse(wf, x, y, states, weights, leng, threshold, i = 0) =
|
||||||
threshold < 0 || i == leng ? wf :
|
threshold < 0 || i == leng ? wf :
|
||||||
|
@@ -11,11 +11,15 @@ function tile_wfc(size, sample) =
|
|||||||
w = tilemap_width(tm),
|
w = tilemap_width(tm),
|
||||||
h = tilemap_height(tm),
|
h = tilemap_height(tm),
|
||||||
compatibilities = tilemap_compatibilities(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(
|
first_collasped_propagated = propagate(
|
||||||
w,
|
w,
|
||||||
h,
|
h,
|
||||||
compatibilities,
|
compatibilities,
|
||||||
wf_collapse(tilemap_wf(tm), x, y),
|
wf_collapse(wf, x, y, weights),
|
||||||
x,
|
x,
|
||||||
y
|
y
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user