API/core/MeshRenderer/

MeshRenderer

MeshRenderer Component.

Hierarchy: Renderer

constructor 

new MeshRenderer(entity: Entity)

internal

Parameters

  • entity

instanceId ReadOnly

instanceId: number = ++EngineObject._instanceIdCounter

Engine unique id.

isCulled 

isCulled: boolean = false

Whether it is clipped by the frustum, needs to be turned on camera.enableFrustumCulling.

shaderData ReadOnly

shaderData: ShaderData = ...

ShaderData related to renderer.

bounds 

get bounds(): BoundingBox

The bounding volume of the renderer.

destroyed 

get destroyed(): boolean

Indicates whether the component is destroyed.

enabled 

get enabled(): boolean

Indicates whether the component is enabled.

set enabled(boolean): void

engine 

get engine(): Engine

The engine which the component's entity belongs to.

entity 

get entity(): Entity

The entitiy which the component belongs to.

materialCount 

get materialCount(): number

Material count.

set materialCount(number): void

mesh 

get mesh(): Mesh

Mesh assigned to the renderer.

set mesh(Mesh): void

scene 

get scene(): Scene

The scene which the component's entity belongs to.

destroy 

destroy(): void

Destory this instance.

getInstanceMaterial 

getInstanceMaterial(): Material

Get the first instance material.

Returns

The first instance material
getInstanceMaterial(index: number): Material

Get the first instance material by index.

remarksCalling this function for the first time after the material is set will create an instance material to ensure that it is unique to the renderer.

Parameters

  • index

    Material index

Returns

Instance material

getInstanceMaterials 

getInstanceMaterials():

Get all instance materials.

remarksCalling this function for the first time after the material is set will create an instance material to ensure that it is unique to the renderer.

Returns

All instance materials

getMaterial 

getMaterial(): Material

Get the first material.

Returns

The first material
getMaterial(index: number): Material

Get the first material by index.

Parameters

  • index

    Material index

Returns

Material

getMaterials 

getMaterials():

Get all materials.

Returns

All materials

setMaterial 

setMaterial(material: Material): void

Set the first material.

Parameters

  • material

    The first material

setMaterial(index: number, material: Material): void

Set material by index.

Parameters

  • index

    Material index

  • material

    The material

setMaterials 

setMaterials(materials: Material[]): void

Set all materials.

Parameters

  • materials

    All materials

update 

update(deltaTime: number): void

Parameters

  • deltaTime