rhodonite
    Preparing search index...

    Class Mesh

    The Mesh class. This mesh object has primitives (geometries) or a reference of 'original mesh'. If the latter, this mesh object is an 'instanced mesh', which has no primitives. Instanced meshes refer original mesh's primitives when drawing.

    Implements

    Index
    • Constructor

      Parameters

      Returns Mesh

    tangentCalculationMode: number = 1

    Specification of when calculate the tangent of a vertex to apply Normal texture (for pbr/MToon shader) 0: Not calculate tangent (not apply normal texture) 1: (default) Use original tangent in a vertex, if a vertex has tangent attribute. If a vertex does not have it, calculate a tangent in a shader. 2: Use original tangent in a vertex, if a vertex has tangent attribute. If a vertex does not have it, precalculate a tangent in the javascript. 3: Calculate all tangent in a shader. 4: Precalculate all tangent in the javascript

    __mesh_uid_count: number = Mesh.invalidateMeshUID
    invalidateMeshUID: -1
    • get _instanceSidBase(): number
      Internal

      Gets the first stable instance slot of this mesh (WebGL multi-draw).

      Returns number

    • get _remapPrepassId(): number
      Internal

      Visit stamp of the per-pass instance prepass (WebGL multi-draw).

      Returns number

    • set _remapPrepassId(id: number): void

      Parameters

      • id: number

      Returns void

    • get _variationVBOUid(): number
      Internal

      Gets the variation VBO UID for internal use.

      Returns number

      The variation VBO resource handle

    • get AABB(): AABB

      Gets AABB in local space.

      Returns AABB

    • get meshEntitiesInner(): IMeshEntity[]

      Gets the inner mesh entities that belong to this mesh.

      Returns IMeshEntity[]

      Array of mesh entities

    • get meshUID(): number

      Gets the unique identifier for this mesh.

      Returns number

      The mesh UID

    • get primitivePositionUpdateCount(): number

      Gets the primitive position update count.

      Returns number

      The number of times primitive positions have been updated

    • get primitives(): Primitive[]

      Gets the array of primitives in this mesh.

      Returns Primitive[]

      Array of primitives

    • Internal

      Registers this mesh as belonging to a mesh component.

      Parameters

      • meshComponent: MeshComponent

        The mesh component that owns this mesh

      Returns void

    • Internal

      Calculates barycentric coordinates for all primitives in this mesh.

      Returns void

    • Internal

      Calculates face normals for primitives that don't have normal attributes.

      Returns void

    • Internal

      Returns void

    • Internal

      Clears the VAO entries that point at multi-draw group VAOs. The groups own those VAOs and delete them, so the mesh must forget them before the group is released.

      Returns void

    • Internal

      Ensures that this mesh owns a contiguous range of stable instance slots in the engine-wide instance SID table and writes the instance identity records.

      Returns number

      The first stable slot index (instanceBase).

    • Internal

      Marks this mesh's multi-draw groups (and the legacy setup) for a rebuild. Called when a primitive's attributes or indices change.

      Returns void

    • Internal

      Called when primitive position data is updated. Updates the position update counter and moves related entities to Load stage.

      Returns void

    • Internal

      Packs the visible instances into the engine-wide remap table so that the shader can resolve instanceBase + gl_InstanceID to a stable SID slot. WebGL multi-draw only.

      Parameters

      • culledEntityStamp: Uint32Array<ArrayBufferLike> | undefined

        Per-EntityUID stamps written by the render pass culling

      • cullTick: number

        The stamp value of the latest culling of the render pass

      Returns number

      The number of visible instances

    • Internal

      Packs the instance variation data of the instances that were not culled in a render pass into the front of the variation VBO, so that an instanced draw call renders only them. The VBO is rewritten only when its content changes. WebGL only.

      Instances whose entities are not handled by the render pass's culling keep being drawn.

      Parameters

      • culledEntityStamp: Uint32Array<ArrayBufferLike> | undefined

        Per-EntityUID stamps written by the culling of the render pass (undefined: draw all the instances)

      • cullTick: number

        The stamp value of the latest culling of the render pass

      Returns number

      The number of the instances to draw

    • Internal

      Removes the association with a mesh component.

      Parameters

      Returns void

    • Returns void

    • Adds primitive.

      Parameters

      Returns void

    • Apply a material variant to the mesh

      Parameters

      • variantName: string

        a variant name

      Returns void

    • Performs ray casting against this mesh to find intersection points.

      Parameters

      • srcPointInLocal: IVector3

        The ray origin point in local space

      • directionInLocal: IVector3

        The ray direction in local space

      • dotThreshold: number = 0

        The dot product threshold for back-face culling (default: 0)

      Returns RaycastResultEx1

      Ray casting result with intersection information

    • Deletes all 3D API vertex data for this mesh.

      Returns void

    • Deletes all VAO (Vertex Array Object) resources for this mesh. Group VAOs are owned by the MultiDrawRepository and are skipped.

      Returns void

    • Internal

      Deletes the variation VBO (Vertex Buffer Object).

      Returns boolean

      True if updated, false if not changed (not dirty)

    • Gets the current material variant name applied to this mesh. Returns empty string if no variant is applied or if primitives have different variants.

      Returns string

      The current variant name or empty string

    • Gets the primitive at the specified index.

      Parameters

      • i: number

        The index of the primitive to retrieve

      Returns Primitive

      The primitive at the specified index

    • Gets the index of a primitive within this mesh.

      Parameters

      • primitive: Primitive

        The primitive to find the index of

      Returns number

      The index of the primitive in the mesh

    • Gets the total number of primitives in this mesh.

      Returns number

      The number of primitives

    • Gets the VAO (Vertex Array Object) UID for the specified index.

      Parameters

      • index: number

        The index of the primitive

      Returns number

      The VAO resource handle

    • Gets the VAO (Vertex Array Object) UID for the specified primitive UID.

      Parameters

      • primitiveUid: number

        The UID of the primitive

      Returns number

      The VAO resource handle

    • Gets all available material variant names for this mesh.

      Returns string[]

      Array of variant names from all primitives

    • Checks if this mesh has blend-without-z-write primitives.

      Returns boolean

      True if blend-without-z-write primitives exist, false otherwise

    • Checks if this mesh has blend-with-z-write primitives.

      Returns boolean

      True if blend-with-z-write primitives exist, false otherwise

    • Checks if this mesh has opaque primitives.

      Returns boolean

      True if opaque primitives exist, false otherwise

    • Checks if this mesh has translucent primitives.

      Returns boolean

      True if translucent primitives exist, false otherwise

    • Checks if this mesh setup is completed and ready for rendering.

      Returns boolean

      True if setup is done, false otherwise

    • Updates the VAO (Vertex Array Object) for all primitives in this mesh.

      Returns void

    • Internal

      Updates the variation VBO (Vertex Buffer Object) for instancing.

      Returns boolean

      True if updated, false if not changed (not dirty)