Nano WebGPU API - v0.11.0
    Preparing search index...

    Class PrimitivesFactory

    PrimitivesFactory manages a per-context lazy-loaded cache of standard geometric shapes. Promotes high-performance vertex/index buffer resource sharing and avoids redundant GPU allocations.

    Index

    Constructors

    Methods

    • Returns the shared arrow geometry, instantiating it on the very first call.

      Parameters

      • ctx: Context

        Active context.

      • radialSegments: number = 8

        Subdivision segments. Defaults to 8.

      Returns Geometry

      The cached or newly allocated Arrow Geometry.

    • Returns the shared cone geometry, instantiating it on the very first call.

      Parameters

      • ctx: Context

        Active context.

      • radialSegments: number = 16

        Subdivision segments around base. Defaults to 16.

      Returns Geometry

      The cached or newly allocated Cone Geometry.

    • Returns the shared unit cube geometry, instantiating it on the very first call.

      Parameters

      • ctx: Context

        Active context.

      • size: number = 1.0

        Sizing dimension. Only applied if the cube is first instantiated here. Defaults to 1.0.

      Returns Geometry

      The cached or newly allocated Cube Geometry.

    • Returns the shared unit plane geometry, instantiating it on the very first call.

      Parameters

      • ctx: Context

        Active context.

      • width: number = 1.0

        Span width along the X axis. Defaults to 1.0.

      • height: number = 1.0

        Span depth along the Z axis. Defaults to 1.0.

      Returns Geometry

      The cached or newly allocated Plane Geometry.

    • Returns the shared sphere geometry, instantiating it on the very first call.

      Parameters

      • ctx: Context

        Active context.

      • radius: number = 1.0

        Radial size of the sphere. Defaults to 1.0.

      • widthSegments: number = 16

        Horizontal subdivision segments. Defaults to 16.

      • heightSegments: number = 16

        Vertical subdivision segments. Defaults to 16.

      Returns Geometry

      The cached or newly allocated Sphere Geometry.