SharedPrimitives class abstract final

Process-wide, immutable unit primitives for retained GPU rendering.

Retained renderers cache GPU buffers by Geometry identity, so every CubeGeometry() call becomes a separate vertex/index upload even when the vertex data is identical. Scale the shared unit primitive through the node transform instead: a hangar built from SharedPrimitives.unitCube uploads one cube for all of its walls, pillars, doors and consoles.

The instances are shared and must never be mutated. Geometry arrays are already treated as immutable by the retained adapter; this class simply gives every caller the same instance.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

unitCube → CubeGeometry
1 m cube centered on the origin (24 vertices, 12 triangles).
final
unitCylinder → CylinderGeometry
Cylinder of diameter 1 m and height 1 m along Y, 16 segments.
final
unitCylinderCoarse → CylinderGeometry
Cylinder of diameter 1 m and height 1 m along Y, 8 segments (posts, torch handles, thin trims where silhouette smoothness is not visible).
final
unitCylinderFine → CylinderGeometry
Cylinder of diameter 1 m and height 1 m along Y, 32 segments: for large columns, drums and discs seen from arm's length.
final
unitPlane → PlaneGeometry
1 m × 1 m horizontal quad centered on the origin, facing +Y.
final
unitSphere → SphereGeometry
Sphere of diameter 1 m, 16 segments (smooth, ~290 vertices).
final
unitSphereCoarse → SphereGeometry
Sphere of diameter 1 m, 8 segments (coarse, for projectiles and gems).
final
unitSphereFine → SphereGeometry
Sphere of diameter 1 m, 32 segments (~1 100 vertices): for hero objects larger than ~0.5 m whose silhouette the viewer inspects up close.
final

Static Methods

cuboidScale(double width, double height, double depth) → Vector3
Convenience scale vector for a cuboid of the given extents.