This class describes the properties and methods to set up a Projected Mesh (i.e. a basic Mesh with ProjectedObject3D transformations matrices and a Camera to use for projection), implemented in the ProjectedMeshBaseMixin:

  • Handle the frustum culling (check if the ProjectedObject3D currently lies inside the Camera frustum)
  • Add callbacks for when the Mesh enters or leaves the Camera frustum

Hierarchy (view full)

Constructors

Properties

type: string

The type of the MeshBaseClass

uuid: string

The universal unique id of the MeshBaseClass

index: number

Index of this MeshBaseClass, i.e. creation order

material: RenderMaterial

Geometry used by this MeshBaseClass

outputTarget: RenderTarget

RenderTarget to render this Mesh to instead of the canvas context, if any.

renderOrder: number

Controls the order in which this MeshBaseClass should be rendered by our Scene

_transparent: boolean

Whether this MeshBaseClass should be treated as transparent. Impacts the render pipeline blend properties

_visible: boolean

Flag indicating whether to draw this MeshBaseClass or not

_ready: boolean

Flag indicating whether this MeshBaseClass is ready to be drawn

userData: Record<string, unknown>

Empty object to store any additional data or custom properties into your Mesh.

_onReadyCallback: (() => void)

function assigned to the onReady callback

Type declaration

    • (): void
    • function assigned to the onReady callback

      Returns void

_onBeforeRenderCallback: (() => void)

function assigned to the onBeforeRender callback

Type declaration

_onRenderCallback: (() => void)

function assigned to the onRender callback

Type declaration

    • (): void
    • function assigned to the onRender callback

      Returns void

_onAfterRenderCallback: (() => void)

function assigned to the onAfterRender callback

Type declaration

    • (): void
    • function assigned to the onAfterRender callback

      Returns void

_onAfterResizeCallback: (() => void)

function assigned to the onAfterResize callback

Type declaration

    • (): void
    • function assigned to the onAfterResize callback

      Returns void

onReady: ((callback) => ProjectedMeshBaseClass | MeshBaseClass)

Callback to execute when a Mesh is ready - i.e. its material and geometry are ready.

Type declaration

Param: callback

callback to run when MeshBaseClass is ready

Returns

  • our Mesh
onBeforeRender: ((callback) => ProjectedMeshBaseClass | MeshBaseClass)

Callback to execute before updating the Scene matrix stack. This means it is called early and allows to update transformations values before actually setting the Mesh matrices (if any). This also means it won't be called if the Mesh has not been added to the Scene. The callback won't be called if the Renderer is not ready or the Mesh itself is neither ready nor visible.

Type declaration

    • (callback): ProjectedMeshBaseClass | MeshBaseClass
    • Callback to execute before updating the Scene matrix stack. This means it is called early and allows to update transformations values before actually setting the Mesh matrices (if any). This also means it won't be called if the Mesh has not been added to the Scene. The callback won't be called if the Renderer is not ready or the Mesh itself is neither ready nor visible.

      Parameters

      • callback: (() => void)

        callback to run just before updating the Scene matrix stack.

          • (): void
          • Returns void

      Returns ProjectedMeshBaseClass | MeshBaseClass

      • our Mesh

Param: callback

callback to run just before updating the Scene matrix stack.

Returns

  • our Mesh
onRender: ((callback) => ProjectedMeshBaseClass | MeshBaseClass)

Callback to execute right before actually rendering the Mesh. Useful to update uniforms for example. The callback won't be called if the Renderer is not ready or the Mesh itself is neither ready nor visible.

Type declaration

Param: callback

callback to run just before rendering the MeshBaseClass.

Returns

  • our Mesh
onAfterRender: ((callback) => ProjectedMeshBaseClass | MeshBaseClass)

Callback to execute just after a Mesh has been rendered. The callback won't be called if the Renderer is not ready or the Mesh itself is neither ready nor visible.

Type declaration

Param: callback

callback to run just after MeshBaseClass has been rendered

Returns

  • our Mesh
onAfterResize: ((callback) => ProjectedMeshBaseClass | MeshBaseClass)

Callback to execute just after a Mesh has been resized.

Type declaration

Param: callback

callback to run just after MeshBaseClass has been resized

Returns

  • our Mesh
renderer: CameraRenderer

The CameraRenderer used

domFrustum: DOMFrustum

The ProjectedMesh DOMFrustum class object

frustumCulling: FrustumCullingCheck

Frustum culling check to use. Accepts OBB, sphere or a boolean. Default to OBB. When set to true, OBB is used.

DOMFrustumMargins: RectCoords

Margins (in pixels) to applied to the DOM Frustum to determine if this ProjectedMesh should be frustum culled or not

Options used to create this ProjectedMeshBaseClass

_onReEnterViewCallback: (() => void)

function assigned to the onReEnterView callback

Type declaration

    • (): void
    • function assigned to the onReEnterView callback

      Returns void

_onLeaveViewCallback: (() => void)

function assigned to the onLeaveView callback

Type declaration

    • (): void
    • function assigned to the onLeaveView callback

      Returns void

onReEnterView: ((callback) => ProjectedMeshBaseClass)

Callback to execute when a Mesh is reentering the view frustum.

Type declaration

Param: callback

callback to run when ProjectedMeshBaseClass is reentering the view frustum

Returns

  • our Mesh
onLeaveView: ((callback) => ProjectedMeshBaseClass)

Callback to execute when a Mesh is leaving the view frustum.

Type declaration

Param: callback

callback to run when ProjectedMeshBaseClass is leaving the view frustum

Returns

  • our Mesh

Accessors

  • get clipSpaceBoundingSphere(): {
        center: Vec3;
        radius: number;
    }
  • Get the geometry bounding sphere in clip space.

    Returns {
        center: Vec3;
        radius: number;
    }

    • center: Vec3

      Center of the bounding sphere.

    • radius: number

      Radius of the bounding sphere.

Methods