The base concept for a points-source: the set of positions at which a
Cloner places copies of its content.
Base class — has no declarative element of its own; subclasses inherit its members.
A points-source answers "where do the clones go?" — the surface of a sphere, a
3D grid, a mesh's vertices, or a GPU-computed distribution. A <sk-cloner>
takes one points-source and stamps a copy of its other child content at every
point, so a single small template becomes thousands of instances.
Structural relationship. A points-source belongs to a sk-cloner,
alongside the content to clone. The procedural members
generate their points on the GPU from a few parameters, so even very large
counts cost almost no memory: sk-sphere-points-source,
sk-cone-points-source, sk-cube-points-source,
sk-disc-points-source, sk-plane-points-source,
sk-torus-points-source, sk-capsule-points-source,
sk-platonic-sphere-points-source, sk-uv-sphere-points-source,
sk-grid-points-source, and sk-custom-wgsl-points-source. Other
points-sources supply positions from explicit data or other objects:
sk-buffer-points-source, sk-cloner-points-source,
sk-compute-buffer-points-source, sk-mesh-surface-points-source,
and sk-mesh-vertex-points-source.
The procedural members here generate their points on the GPU with O(1) memory,
so counts of 100K–1M+ instances stay cheap; a subclass supplies the point count
and uniform parameters and pairs them with a WGSL getPointAtIndex(index)
function that returns each clone's local transform.
The example clones a small sphere across a 10×10 grid of points.
Abstract base class — not instantiated directly. Construct one of its concrete subclasses; this class contributes the members below to them.
Inherited from: SkenraAnimatable
— see those pages for inherited members.
| Property | Type | Default | Description | Declared by |
|---|---|---|---|---|
pointCountread-only |
number |
— | Number of points provided by this source. | ShaderFunctionPointsSource |
localMatricesread-only |
Float32Array<ArrayBufferLike> | null |
— | CPU-side local matrices. | ShaderFunctionPointsSource |
typeread-only |
PointsSourceType |
"shader-function" |
The type of this points source. | ShaderFunctionPointsSource |
sceneread-only |
any |
— | Gets the Scene this animatable belongs to, if any. | SkenraAnimatable |
animationsread-only |
SkenraAnimation[] |
— | Public getter for the animations affecting this target. | SkenraAnimatable |
| Method | Description | Declared by |
|---|---|---|
getBoundsInSpace(fullTransform: Float32Array): { minX: number; maxX: number; minY: number; maxY: number; minZ: number; maxZ: number; } | null |
Computes the AABB in target space by transforming local bounds corners. | ShaderFunctionPointsSource |
setWorldReferenceNode(node: WorldReferenceNode | null): void |
Sets the reference node whose world matrix should be used for transforms. | ShaderFunctionPointsSource |
animate(firstArg: TypedKeyframe<this>[] | TypedPropertyIndexedKeyframes<this> | Record<string, any> | globalThis.Keyframe[] | globalThis.PropertyIndexedKeyframes | null, secondArg?: number | KeyframeAnimationOptions | globalThis.KeyframeAnimationOptions): SkenraAnimation & Animation |
Creates a new SkenraAnimation for this target per Web Animations API. | SkenraAnimatable |
removeAnimation(animation: SkenraAnimation): boolean |
Removes a specific animation from this object. | SkenraAnimatable |
constrain(type: K, config: ConstraintConfigMap[K]): ConstraintReturnMap[K] |
Creates a constraint on this Animatable using a fluent API. | SkenraAnimatable |
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.
<sk-scene>
<sk-plain-material id="mat" base-color="#7fa8d8"></sk-plain-material>
<sk-cloner mode="vertex">
<sk-grid-points-source count-x="10" count-z="10" spacing-x="1" spacing-z="1"></sk-grid-points-source>
<sk-sphere radius="0.2"><sk-surface-paint material="#mat"></sk-surface-paint></sk-sphere>
</sk-cloner>
</sk-scene>