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). Centers are in the geometry's local
space and the owning node's transform places and orients the whole batch.
Sizes scale with the node too, unless scaleSizesWithNode is off. Under a
non-uniform scale they take the smallest axis scale, ignoring flattened
axes, so quads stay square to the camera, stretching a node to widen a
spawn area does not enlarge its sprites, and flattening one into a disc
does not shrink them. A batch sizes to one node, so give each node its
own. 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
- defaultVertexLayout → VertexLayoutDescriptor?
-
The layout this geometry kind uses when the caller supplies none.
Subclasses that describe their vertices override this.
no setteroverride
- emitsStandardVaryings → bool
-
Whether this geometry's vertex shader writes the engine's standard
varyings (
material_varyings.glsl), which the surface debug views and their fallback shader read. Mesh geometry does; a geometry with its own fragment contract (billboards, splats) does not and is left out of the views.no setter - 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
- 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 - materialVertexVariant → String?
-
The
.fmatvertex-variant key for this geometry's mesh type, used to select a custom material's generated vertex shader (seeMaterial.materialVertexShader). Unskinned geometry is'unskinned'; SkinnedGeometry overrides this to'skinned'.no setter - morphTargets → MorphTargetData? Geometry
-
The morph target deltas this geometry carries, or null for unmorphed
geometry. Overridden by the morphed geometry subclasses.
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
- scaleSizesWithNode ↔ bool
-
Whether instance sizes scale with the owning node (the default). When
false, sizes are in world units whatever the node's scale.
getter/setter pair
- velocityStretch ↔ double
-
Extra length added per unit of world-space 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, double depthBias = 0.0}) → 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).
-
debugLayoutForAttributes(
VertexAttributeSchema schema) → VertexLayoutDescriptor? -
The pipeline layout for a draw whose vertex shader reads
schema, built from the custom streams this geometry has now. Null means the shader's reflected layout.inherited -
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 -
setDepthOnlyVertex(
Shader? shader, {VertexBufferDescriptor? positionStream}) → void Geometry -
Assigns the position-only vertex
shaderthe depth-style passes (shadow maps, the depth prepass, the selection mask) draw this geometry with, or clears it whenshaderis null.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 -
setMorphWeights(
Float32List? weights) → void -
Hook for morphed geometries to receive the owning node's morph weights.
inherited
-
setVertexLayout(
VertexLayoutDescriptor? layout, {bool bindsModelTransform = true}) → void -
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(
TypedData vertices, int vertexCount, TypedData? indices, {IndexType indexType = gpu.IndexType.int16}) → void -
Allocates GPU storage and uploads
vertices(and optionalindices) into it in one step.inherited -
uploadVertexStreams(
List< GeometryTypedData> streams, int vertexCount, {TypedData? indices, IndexType indexType = gpu.IndexType.int16, GeometryBufferArena? bufferArena}) → void -
Uploads vertex
streamsin a caller-defined format, one per vertex buffer slot in order, plus optionalindices.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).