Places clones at an explicit list of transforms you supply — the way to array copies at hand-authored or externally computed positions when no procedural shape fits.
JavaScript API:
BufferPointsSource
This is the raw data-driven member of the points-source family (see
ShaderFunctionPointsSource): a points-source defines the set of
positions at which a sk-cloner places copies of its content, so it lives
as a child of a <sk-cloner> and the cloner's other child is the template
cloned at each point. Where the procedural sources generate their points from a
formula, this one takes them verbatim from a buffer of placement matrices you
provide — one 4×4 matrix per clone, carrying its full position, rotation, and
scale — which is the escape hatch for imported layouts or CPU-generated
distributions that no built-in shape captures.
Key attributes. local-matrices is the placement buffer: a list of
column-major mat4x4 frames (16 numbers each), one per clone, given as an array
of 16-number arrays. Each matrix's translation column positions that clone; its
upper-left basis orients and scales it (an identity basis with a position in the
last column places a clone with no rotation). The clone count is simply the
number of matrices supplied.
Related. For placements generated on the GPU instead of authored, see
sk-compute-buffer-points-source and sk-custom-wgsl-points-source;
for placements taken from a mesh see sk-mesh-vertex-points-source and
sk-mesh-surface-points-source; for another cloner's output see
sk-cloner-points-source. For built-in procedural shapes see
sk-grid-points-source and sk-sphere-points-source. Its host is
always a sk-cloner.
Serve these docs to run the live example.
WebGPU needs a secure context — open this page via grunt serve
rather than double-clicking the file. The Markup tab works from disk.
<!-- The placements are listed by hand — no shape formula. `local-matrices` is
an array of column-major mat4 frames (16 numbers each), one per clone: the
last four numbers are the position, and the upper-left 3×3 basis carries
rotation and scale. The cloner opts into those with `apply-scale` (honor each
frame's scale) and `align-to-normal` (orient each clone to its frame's +Y).
The four cubes show it: (1) baseline, (2) scaled 1.4, (3) tilted ~35°,
(4) tilted ~40° the other way and scaled 0.7. Edit any frame to retransform
that clone. -->
<sk-scene>
<sk-directional-light p="40deg" h="30deg" intensity="1.0"></sk-directional-light>
<sk-ambient-light intensity="0.35"></sk-ambient-light>
<sk-plain-material id="mat" base-color="steelblue"></sk-plain-material>
<sk-cloner mode="vertex" apply-scale align-to-normal>
<sk-buffer-points-source local-matrices="[
[1,0,0,0, 0,1,0,0, 0,0,1,0, -3,0,0,1],
[1.4,0,0,0, 0,1.4,0,0, 0,0,1.4,0, -1,0,0,1],
[1,0,0,0, 0,0.819,0.574,0, 0,-0.574,0.819,0, 1,0,0,1],
[0.536,0.45,0,0, -0.45,0.536,0,0, 0,0,0.7,0, 3,0,0,1]
]"></sk-buffer-points-source>
<!-- Template cloned at each supplied matrix. -->
<sk-cube size="0.8">
<sk-surface-paint material="#mat"></sk-surface-paint>
</sk-cube>
</sk-cloner>
</sk-scene>
| Attribute | Type | Default | Description |
|---|---|---|---|
local-matricesrequired |
<matrix3d-list> (<matrix3d>[,<matrix3d>]*) |
— | The per-element local matrices: a flat Float32Array of column-major |