ComputeBufferSplineSource

← prev index next →

Draws a spline whose polyline is computed on the GPU by a compute node — the way to render a curve generated by a simulation or parallel kernel (a particle trail, an evolving wave, any per-vertex position array a compute pass writes).

Remarks

This is the GPU-fed member of the spline-source family: a spline-source supplies the curve geometry for a AbstractSpline, so it lives as the single geometry child of a sk-spline. It owns no geometry of its own and allocates no buffers — it names a sk-compute-node producer and reads that node's output polyline, which the renderer binds zero-copy; CPU-side queries (pointAt, bounds, cloner matrices) come from the inherited readback path and are null until the first readback completes.

Key attributes. compute-node is a #id reference to the sk-compute-node that produces the polyline — the direct, common wire-in. compute-property-key selects which of that node's outputs to read (default output.0). is-closed declares whether the generated polyline forms a closed loop (last vertex joins the first). Like every spline-source it also carries the family's distribution / distribution-count controls: a spline-source is itself a points-source, so a sk-cloner given one places clones along the curve, and these controls choose how the curve is sampled into those positions.

Related. It is one input modality of the spline-source family alongside sk-svg-spline-source, sk-points-spline-source, sk-trail-spline-source, sk-morph-spline-source, and its GPU sibling sk-custom-wgsl-spline-source (which generates the polyline from inline WGSL instead of a separate producer). Its producer is a sk-compute-node; its host is a sk-spline, whose curve then draws with a stroke paint or carries an sk-align-to-spline-constraint.

Constructor

constructor()

Properties

Other Properties

PropertyTypeDefaultDescriptionDeclared by
computeNodeanimatable AbstractComputeNode | null The directly referenced compute node, or null when the source is ComputeBufferSplineSource
computePropertyKey string "output.0" The computed-property key read from the referenced compute node ComputeBufferSplineSource
pointCountread-only number Cloner-facing point count. Tracks distribution; for a GPU source GPUPolylineSplineSource
localMatricesread-only Float32Array<ArrayBufferLike> | null Per-vertex [ T·width | N·width | B·width | P ] frame matrices, or null until data is available. GPUPolylineSplineSource
distributionanimatable SplineDistributionMode How clone points are placed along the spline — at the control points, at GPUPolylineSplineSource
distributionCount number The number of evenly spaced points to place when the distribution is GPUPolylineSplineSource
vertexCountread-only number Number of vertices in the linearized polyline. GPUPolylineSplineSource
isValidread-only boolean Whether the source initialized successfully and holds at least one vertex. GPUPolylineSplineSource
isClosedanimatable boolean false Whether the spline forms a closed loop (last vertex joins the first). GPUPolylineSplineSource
polylineread-only readonly Readonly<SplinePoint>[] [] Read-only view of the internal 3D polyline points. GPUPolylineSplineSource
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

Methods

MethodDescriptionDeclared by
pointAt(t: number): SplinePoint | null Returns a point on the spline at normalized parameter t. GPUPolylineSplineSource
getBoundsInSpace(fullTransform: Float32Array): PolylineBounds | null Axis-aligned bounding box of the produced points, expressed in the given target space, or null if there is no data yet. GPUPolylineSplineSource
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

Example

const gpuData = new WebGPUSplineData(trailBuffer, 0, 128, device);
const source = new ComputeBufferSplineSource();
source.gpuData = gpuData;

const spline = new Spline({ id: 'trail', source });