Utilities for constructing block palettes and working with texture colors.
Utilities for constructing block palettes and working with texture colors.
(block-materials)
Materials that can be used as blocks. Still needs more filtering, so may yield some weird results.
Materials that can be used as blocks. Still needs more filtering, so may yield some weird results.
(gradient-gen {:keys [palette spread bleed bleed-distance]
:or {palette [:bedrock :deepslate-bricks :deepslate :stone-bricks
:cracked-stone-bricks :stone]
spread 3
bleed 0.2
bleed-distance 2}})
Given a palette (sequence of keywords), return a function which takes an index (number), and returns a material that is either the material at that entry in the palette, or a neighboring material, with further off materials increasingly unlikely to be picked. This allows using a palette with somewhat gradual transitions.
:spread
is the amount of blocks distance that each material in the palette
will take up.
:bleed-distance
is how many blocks distance a neighboring material is allowed to
"bleed" into the next.
:bleed
is the probability that a neighboring block bleeds into the next
"zone", with 1
meaning it has the same probability as the main material
for the given zone. This probability halves for every block further into the
next zone you are.
Given a palette (sequence of keywords), return a function which takes an index (number), and returns a material that is either the material at that entry in the palette, or a neighboring material, with further off materials increasingly unlikely to be picked. This allows using a palette with somewhat gradual transitions. `:spread` is the amount of blocks distance that each material in the palette will take up. `:bleed-distance` is how many blocks distance a neighboring material is allowed to "bleed" into the next. `:bleed` is the probability that a neighboring block bleeds into the next "zone", with `1` meaning it has the same probability as the main material for the given zone. This probability halves for every block further into the next zone you are.
The two most prominent colors in each material's texture.
The two most prominent colors in each material's texture.
(material-gradient start end steps)
Given a start material, an end material, and a number of steps, generate a sequence of block materials that form a gradient.
Given a start material, an end material, and a number of steps, generate a sequence of block materials that form a gradient.
(nearest-material color)
(nearest-material color1 color2)
Find the block material that most closely matches the color or colors.
Find the block material that most closely matches the color or colors.
(neighbors material)
Get materials that are close in color to the given material. Returns a seq of all materials with their score, sorted from best match to worst.
Get materials that are close in color to the given material. Returns a seq of all materials with their score, sorted from best match to worst.
(rand-palette probs)
Takes a palette probability map (keyword to number), and return a random material, honoring the probabilities.
Takes a palette probability map (keyword to number), and return a random material, honoring the probabilities.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close