Geometry class abstract
Vertex (and optional index) data along with the vertex shader used to transform it.
Geometry is the geometry half of a MeshPrimitive — the shading half
is supplied by a Material. Built-in subclasses cover the two
supported vertex layouts:
- UnskinnedGeometry — 48-byte vertices: position, normal, UV, color.
- SkinnedGeometry — 80-byte vertices: unskinned + 4 joint indices + 4 joint weights. Used in conjunction with a Skin.
Construct an instance directly and call uploadVertexData (or
setVertices/setIndices with already-uploaded buffer views) to
supply mesh data, or use Geometry.fromFlatbuffer when deserializing
a .model payload. For procedurally generated meshes, MeshGeometry
and GeometryBuilder assemble a Geometry from vertex attribute
arrays without packing vertex bytes by hand.
- Implementers
Constructors
- Geometry()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- localBoundingSphere → Sphere?
-
Local-space bounding sphere paired with localBounds. Same
nullability semantics.
no setter
- 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 the.modelflatbuffer 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 setter - localBoundsVersion → int
-
A counter that increments each time setLocalBounds changes the
bounds.
no setter
- primitiveType ↔ PrimitiveType
-
How the vertex/index data is assembled into primitives when drawn.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- vertexShader → Shader
-
The vertex shader used when rendering this geometry.
no setter
Methods
-
bind(
RenderPass pass, HostBuffer transientsBuffer, Matrix4 modelTransform, Matrix4 cameraTransform, Vector3 cameraPosition) → void -
Binds vertex/index buffers and per-frame uniforms onto
passin preparation for a draw call. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setIndices(
BufferView indices, IndexType indexType) → void -
Binds an already-uploaded index buffer view, with element width
determined by
indexType. -
setJointsTexture(
Texture? texture, int width) → void - Hook for skinned geometries to receive the joints texture computed by Skin.getJointsTexture.
-
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). -
setVertexShader(
Shader shader) → void -
Assigns the vertex
shaderused when this geometry is drawn. -
setVertices(
BufferView vertices, int vertexCount) → void - Binds an already-uploaded vertex buffer view as this geometry's vertex source.
-
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.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromFlatbuffer(
MeshPrimitive fbPrimitive) → Geometry - Constructs a Geometry from a deserialized flatbuffer mesh primitive, choosing UnskinnedGeometry or SkinnedGeometry based on the embedded vertex buffer type.