API/core/Mesh/

Mesh

Mesh.

Hierarchy: RefObject

constructor 

new Mesh(engine: Engine, name: string)

Create emsh.

Parameters

  • engine

    Engine

  • optionalname

    Mesh name

bounds ReadOnly

bounds: BoundingBox = ...

The bounding volume of the mesh.

instanceId ReadOnly

instanceId: number = ++EngineObject._instanceIdCounter

Engine unique id.

isGCIgnored 

isGCIgnored: boolean = false

Whether to ignore the garbage collection check, if it is true, it will not be affected by ResourceManager.gc().

name 

name: string

Name.

destroyed 

get destroyed(): boolean

Whether it has been destroyed.

engine 

get engine(): Engine

Get the engine which the object belongs.

refCount 

get refCount(): number

Counted by valid references.

subMesh 

get subMesh(): SubMesh

First sub-mesh. Rendered using the first material.

subMeshes 

get subMeshes(): readonly <SubMesh[]>

A collection of sub-mesh, each sub-mesh can be rendered with an independent material.

addSubMesh 

addSubMesh(subMesh: SubMesh): SubMesh

Add sub-mesh, each sub-mesh can correspond to an independent material.

Parameters

  • subMesh

    Start drawing offset, if the index buffer is set, it means the offset in the index buffer, if not set, it means the offset in the vertex buffer

Returns

Sub-mesh
addSubMesh(start: number, count: number, topology: MeshTopology): SubMesh

Add sub-mesh, each sub-mesh can correspond to an independent material.

Parameters

  • start

    Start drawing offset, if the index buffer is set, it means the offset in the index buffer, if not set, it means the offset in the vertex buffer

  • count

    Drawing count, if the index buffer is set, it means the count in the index buffer, if not set, it means the count in the vertex buffer

  • optionaltopology

    Drawing topology, default is MeshTopology.Triangles

Returns

Sub-mesh

clearSubMesh 

clearSubMesh(): void

Clear all sub-mesh.

destroy 

destroy(force: boolean): boolean

Destroy self.

Parameters

  • force

    Whether to force the destruction, if it is fasle, refCount = 0 can be released successfully.

Returns

Whether the release was successful.

registerUpdateFlag 

registerUpdateFlag(): UpdateFlag

Register update flag, update flag will be true if the vertex element changes.

Returns

Update flag

removeSubMesh 

removeSubMesh(subMesh: SubMesh): void

Remove sub-mesh.

Parameters

  • subMesh

    Sub-mesh needs to be removed