SphereGeometry class Geometry
A UV sphere centered on the origin.
segments is the number of divisions around the equator and
rings the number of divisions from pole to pole. Vertex normals
point radially outward and texture coordinates wrap longitude in u
and latitude in v.
- Inheritance
-
- Object
- Geometry
- UnskinnedGeometry
- MeshGeometry
- SphereGeometry
Constructors
- SphereGeometry({double radius = 0.5, int segments = 32, int rings = 16})
-
Builds a sphere of the given
radiusand tessellation.factory
Properties
- collisionShape → Shape
-
The matching physics collision shape, a sphere of the same radius.
no setter
- depthOnlyVertex → ({VertexLayoutDescriptor layout, Shader shader})?
-
The vertex shader and layout the depth-style passes (the directional
shadow map, the camera depth prepass, and the object-selection mask)
should use for this geometry, or null to reuse vertexShader with
instancedVertexLayout.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- instancedVertexLayout → VertexLayoutDescriptor?
-
The explicit pipeline vertex layout this geometry's vertex shader
expects, or null for the shader bundle's default interleaved layout.
no setterinherited
- isReadable → bool Geometry
-
Whether this geometry retains CPU-side vertex data, making
extractMeshData available.
no setterinherited
- isUpdatable → bool
-
Whether this geometry can be updated in place.
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 - packedData → ({Uint8List? indexBytes, bool indices32Bit, Uint8List vertexBytes})
-
The packed interleaved vertex bytes (and packed index bytes with their
width), in the engine's interleaved unskinned layout. Interleaved lazily
from the per-attribute CPU streams on first access. The scene serializer
emits the de-interleaved
soaDatainstead; this stays as a convenience for callers wanting the interleaved form.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
- storage → GeometryStorage
-
How this geometry's GPU buffers are managed; see GeometryStorage.
finalinherited
- vertexCount → int
-
The number of vertices currently drawn.
no setterinherited
- vertexShader → Shader
-
The vertex shader used when rendering this geometry.
no setterinherited
Methods
-
applyMeshData(
MeshData data) → void -
Replaces this updatable geometry's data from a MeshData snapshot.
inherited
-
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.inherited -
draw(
RenderPass pass, {int instanceCount = 1}) → void -
Emits this geometry's draw call after bind has prepared the render pass.
inherited
-
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
-
rebuild(
{required Float32List positions, Float32List? normals, Float32List? texCoords, Float32List? colors, List< int> ? indices}) → void -
Replaces all of this geometry's data, allowing the vertex and index
counts to change.
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 -
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
-
updateColors(
Float32List colors, {int? dirtyStart, int? dirtyCount}) → void -
Replaces every vertex color, keeping the vertex count unchanged.
inherited
-
updateNormals(
Float32List normals, {int? dirtyStart, int? dirtyCount}) → void -
Replaces every vertex normal, keeping the vertex count unchanged.
inherited
-
updatePositions(
Float32List positions, {int? dirtyStart, int? dirtyCount}) → void -
Replaces every vertex position, keeping the vertex count unchanged.
inherited
-
updateTexCoords(
Float32List texCoords, {int? dirtyStart, int? dirtyCount}) → void -
Replaces every texture coordinate, keeping the vertex count
unchanged.
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