BillboardGeometry class Geometry
A batch of camera-facing quads ("billboards"), expanded from per-instance data in the vertex shader and drawn in a single instanced call.
Each instance carries a center, a size, an in-plane rotation, a linear
RGBA color, a flipbook frame, and a velocity (used only by
BillboardFacing.velocityStretched). The center is in the geometry's
local space; the owning node's transform places and orients the whole
batch. Pair it with a SpriteMaterial (or any material whose fragment
shader reads v_uv and v_color).
Write instance data into instanceData (a flat Float32List of floatsPerInstance floats each) and call commit with the live count. The batch is the backing primitive for sprites, impostors, and the particle sprite renderer.
Constructors
- BillboardGeometry({int capacity = 256})
-
Creates a billboard batch sized for up to
capacityinstances.
Properties
- bindsModelTransformInstance → bool
-
Whether the color encoder should bind the node's model transform as a
one-element instance-rate buffer at the slot after this geometry's
vertex streams.
no setter
- capacity → int
-
The maximum number of instances this batch can draw.
final
- facing ↔ BillboardFacing
-
How the quads orient toward the camera.
getter/setter pair
- flipbookBlend ↔ bool
-
When true, fractional frame values crossfade between the two adjacent
flipbook cells (wrapping at the end of the grid) instead of snapping to
the nearest cell, so low-rate flipbooks still animate smoothly.
getter/setter pair
- flipbookColumns ↔ int
-
Flipbook atlas columns and rows.
1 x 1(the default) samples the whole texture; larger grids select the cell for each instance's frame.getter/setter pair - flipbookRows ↔ int
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- instanceCount → int
-
The number of instances drawn last commit.
no setter
- instanceData → Float32List
-
The flat per-instance buffer the caller writes into, capacity *
floatsPerInstance floats long. Lay out each instance as: center x,y,z;
size x,y; rotation; color r,g,b,a; frame; velocity x,y,z. Call commit
after writing.
no setter
- instancedVertexLayout → VertexLayoutDescriptor?
-
The explicit pipeline vertex layout this geometry's vertex shader
expects, or null for the shader bundle's default interleaved layout.
no setter
- isDoubleSided → bool
-
Whether this geometry should be drawn without back-face culling.
no setter
- isReadable → bool Geometry
-
Whether this geometry retains CPU-side vertex data, making
extractMeshData available.
no setterinherited
- localBoundingSphere → Sphere?
-
Local-space bounding sphere paired with localBounds. Same
nullability semantics.
no setterinherited
- localBounds → Aabb3?
-
Local-space axis-aligned bounding box of this geometry's vertex
positions, or
nullif bounds are unknown. Computed by uploadVertexData for procedural geometry, populated from baked scene-package bounds for imported geometry, and (for the advanced setVertices path where the caller manages its own GPU buffer) leftnullunless the caller assigns it via setLocalBounds.no setterinherited - primitiveType ↔ PrimitiveType
-
How the vertex/index data is assembled into primitives when drawn.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- velocityStretch ↔ double
-
World units of extra length added per unit of speed in
BillboardFacing.velocityStretched.
getter/setter pair
- vertexShader → Shader
-
The vertex shader used when rendering this geometry.
no setterinherited
- worldUp ↔ Vector3
-
The world up axis used to build the billboard basis (and the locked axis
for BillboardFacing.axisLocked). Defaults to +Y.
getter/setter pair
Methods
-
bind(
RenderPass pass, TransientWriter transientsBuffer, Matrix4 modelTransform, Matrix4 cameraTransform, Vector3 cameraPosition, {Shader? shaderOverride}) → void -
Binds vertex/index buffers and per-frame uniforms onto
passin preparation for a draw call.override -
commit(
int count) → void - Sets the number of live instances to draw and recomputes the batch's local bounds from their centers and sizes (so the owning item culls and, with an LodComponent, measures its screen size correctly).
-
draw(
RenderPass pass, {int instanceCount = 1}) → void -
Emits this geometry's draw call after bind has prepared the render pass.
override
-
extractMeshData(
) → MeshData Geometry -
Copies this geometry's retained CPU vertex/index data out as an
isolate-transferable MeshData snapshot.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCustomAttribute(
String name, Float32List data, {required int components}) → void Geometry -
Attaches a custom per-vertex attribute stream named
name, matching a material'sattributesentry (and the generated shader'sin <name>).inherited -
setIndices(
BufferView indices, IndexType indexType) → void -
Binds an already-uploaded index buffer view, with element width
determined by
indexType.inherited -
setInstance(
int index, {required Vector3 center, required double width, required double height, double rotation = 0.0, Vector4? color, double frame = 0.0, Vector3? velocity}) → void -
Writes one instance's fields at
indexinto instanceData. A convenience over hand-indexing the flat buffer; call commit when done. -
setJointsTexture(
Texture? texture, int width) → void -
Hook for skinned geometries to receive the joints texture computed
by Skin.getJointsTexture.
inherited
-
setLocalBounds(
Aabb3? aabb, Sphere? sphere) → void -
Override the bounds. Useful for callers driving setVertices from
a caller-managed
gpu.DeviceBufferwho want to participate in bounds-driven scene queries (e.g. frustum culling).inherited -
setVertexShader(
Shader shader) → void -
Assigns the vertex
shaderused when this geometry is drawn.inherited -
setVertexShaderName(
String name) → void -
Assigns the vertex shader by
namefrom baseShaderLibrary.inherited -
setVertices(
BufferView vertices, int vertexCount) → void -
Binds an already-uploaded vertex buffer view as this geometry's
vertex source.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
uploadVertexData(
ByteData vertices, int vertexCount, ByteData? indices, {IndexType indexType = gpu.IndexType.int16}) → void -
Allocates a
gpu.DeviceBufferand uploadsvertices(and optionalindices) into it in one step.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- floatsPerInstance → const int
- The number of floats per instance in instanceData: center (3), size (2), rotation (1), color (4), flipbook frame (1), velocity (3).