API/core/BufferMesh/

BufferMesh

BufferMesh.

Hierarchy: Mesh

constructor 

new BufferMesh(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.

indexBufferBinding 

get indexBufferBinding(): IndexBufferBinding

Index buffer binding.

instanceCount 

get instanceCount(): number

Instanced count, disable instanced drawing when set zero.

set instanceCount(number): void

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.

vertexBufferBindings 

get vertexBufferBindings(): readonly <VertexBufferBinding[]>

Vertex buffer binding collection.

vertexElements 

get vertexElements(): readonly <VertexElement[]>

Vertex element collection.

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

setIndexBufferBinding 

setIndexBufferBinding(buffer: Buffer, format: IndexFormat): void

Set index buffer binding.

Parameters

  • buffer

    Index buffer

  • format

    Index buffer format

setIndexBufferBinding(bufferBinding: IndexBufferBinding): void

Set index buffer binding.

remarksWhen bufferBinding is null, it will clear IndexBufferBinding

Parameters

  • bufferBinding

    Index buffer binding

setVertexBufferBinding 

setVertexBufferBinding(vertexBufferBindings: VertexBufferBinding, index: number): void

Set vertex buffer binding.

Parameters

  • vertexBufferBindings

    Vertex buffer binding

  • optionalindex

    Vertex buffer index, the default value is 0

setVertexBufferBinding(vertexBuffer: Buffer, stride: number, index: number): void

Set vertex buffer binding.

Parameters

  • vertexBuffer

    Vertex buffer

  • stride

    Vertex buffer data stride

  • optionalindex

    Vertex buffer index, the default value is 0

setVertexBufferBindings 

setVertexBufferBindings(vertexBufferBindings: VertexBufferBinding[], firstIndex: number): void

Set vertex buffer binding.

Parameters

  • vertexBufferBindings

    Vertex buffer binding

  • firstIndex

    First vertex buffer index, the default value is 0

setVertexElements 

setVertexElements(elements: VertexElement[]): void

Set vertex elements.

Parameters

  • elements

    Vertex element collection