mcclim/block-icon.lisp
The atlas's tile edge, in texels. It is 16 for the same reason Minecraft's is: it is enough to read a material and few enough to author by hand.
How much of the light each visible face gets. The ratios matter more than the numbers: equal faces read as a hexagon rather than as a cube.
The shared block atlas, built on first use.
Generating it walks every tile of every material, which is far too much to do
per frame and trivial to do once. clear-block-icon-cache drops it, which is
how a redefined paint-block-atlas-tile method reaches the icons.
Forget every rasterized icon and the atlas behind them.
The atlas tile block shows on face, falling back the way the world does.
Pack an atlas word into a CLIM pattern word at shade.
The atlas keeps red in the low byte; a pattern wants it in the third, which is the same turn-around the video path makes.
Draw block as a size by size isometric cube of rgba words.
The cube is the standard two-to-one projection: a diamond size wide and half
that tall for the top, and two parallelograms of the same half-height below
it. Every pixel asks which of the three faces it belongs to and reads the
matching texel, so the icon carries the material's real texture rather than
its average colour.
block's isometric icon at size, rasterized on first ask and kept.
Draw block's cube with its top-left corner at X,Y.
The atlas's tile edge, in texels. It is 16 for the same reason Minecraft's is: it is enough to read a material and few enough to author by hand.
How much of the light each visible face gets. The ratios matter more than the numbers: equal faces read as a hexagon rather than as a cube.
()The shared block atlas, built on first use. Generating it walks every tile of every material, which is far too much to do per frame and trivial to do once. CLEAR-BLOCK-ICON-CACHE drops it, which is how a redefined PAINT-BLOCK-ATLAS-TILE method reaches the icons.
(tile x y)Return the packed RGBA pixel of atlas tile TILE at tile-local X,Y. Each named tile is one EQL method, so a live image can repaint a single material and rebuild the atlas without touching the rest of the palette.
Logical disjunction of tests and raw truth values.
()Return the little world's horizontal RGBA8 atlas as packed pixel words. RGB is the material's procedural colour and A is opaque coverage. The array spans the full tile capacity; tiles past the painted count stay zero, waiting for a material to claim them.
(block face)(word shade)Pack an atlas word into a CLIM pattern word at SHADE. The atlas keeps red in the low byte; a pattern wants it in the third, which is the same turn-around the video path makes.
The minimum of compatible quantities.
Multiplication and scalar scaling.
Extract the unsigned bit field (BYTE SIZE POSITION) of one unsigned scalar.
(atlas tile column row)(tile &optional (domain *block-atlas-tile-domain*))The maximum of compatible quantities.
Addition over compatible quantities.
(block size)Draw BLOCK as a SIZE by SIZE isometric cube of RGBA words. The cube is the standard two-to-one projection: a diamond SIZE wide and half that tall for the top, and two parallelograms of the same half-height below it. Every pixel asks which of the three faces it belongs to and reads the matching texel, so the icon…
Convert one scalar float or unsigned value to a 32-bit float.
Division of two represented quantities.
Subtraction or unary negation.
Logical conjunction of tests and raw truth values.
Test whether one compatible scalar is at most another.
Test whether one compatible scalar is less than another.
(block &optional (size 32))(stream block x y &optional (size 32))
Isometric block icons.
A material shown to the player as a flat swatch is a colour; shown as a cube it is the thing they are about to place. These are the same procedural tiles the block atlas generates for the world, projected onto the three faces of a 2:1 dimetric cube and lit the way the world lights them -- top full, left in half shadow, right darker still.
Each icon is rasterized once into an
rgbaarray and kept as a CLIM pattern, so drawing one is a single image command rather than seven hundred little parallelograms. That is what makes it affordable to put the same icon in the hotbar, the inventory grid, the quickbar, and the item inspector.