InstanceMesh

A special version of Mesh with instanced rendering supported. Use InstancedMesh if you have to render a large number of objects with the same geometry and material but with different world transformations. The usage of InstancedMesh will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application.

Core Class

A special version of Mesh with instanced rendering supported. Use InstancedMesh if you have to render a large number of objects with the same geometry and material but with different world transformations. The usage of InstancedMesh will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application.

Extends

Constructors

Constructor

new InstanceMesh(meshes): InstanceMesh

Parameters

meshes

Mesh<Material, BufferGeometry<TriangleList>>[]

Returns

InstanceMesh

Overrides

Mesh.constructor

Properties

DefaultUp

static DefaultUp: Vector3

Every objects in 3D space must have a default up direction.

Default Value

Vector3(0, 1, 0)

Inherited from

Mesh.DefaultUp


id

id: number

Unique number for each object3D instance.

Inherited from

Mesh.id


scene

scene: Nullable<Scene3D>

The scene which this object belong to.

Inherited from

Mesh.scene


updateDirtyId

updateDirtyId: number

The number is the frame id which this object is changed or participates change of scene graph. If this value equals to frame id - 1,

Default Value

-1 means no change happen

Inherited from

Mesh.updateDirtyId


name

name: string

The name of this object, it is empty if useless.

Inherited from

Mesh.name


isObject3D

isObject3D: boolean

Used to check type of this or extended instance. This value should not be changed by user.

Inherited from

Mesh.isObject3D


parent

parent: Nullable<Object3D>

Object’s parent node in the scene graph. An object can have at most one parent.

Inherited from

Mesh.parent


children

children: Object3D[]

Array with object’s children.

Remarks

See Group| Group for information on manually grouping objects.

Inherited from

Mesh.children


up

up: Vector3

This is used by the lookAt method, for example, to determine the orientation of the result. Default is DefaultUp.

Inherited from

Mesh.up


worldMatrixUpdateTimestamp

worldMatrixUpdateTimestamp: number

Record when this object’s world matrix last updated.

Inherited from

Mesh.worldMatrixUpdateTimestamp


transformChanged

transformChanged: boolean

Record whether the object’s any attribute| attribute is updated.

Inherited from

Mesh.transformChanged


visibleChanged

visibleChanged: boolean

Inherited from

Mesh.visibleChanged


matrixWorld

matrixWorld: Matrix4

The global transform of the object. If the Object3D has no parent, then it’s identical to the local transform matrix.

Inherited from

Mesh.matrixWorld


matrixWorldNeedsUpdate

matrixWorldNeedsUpdate: boolean

When this is set, it calculates the matrixWorld in that frame and resets this property to false.

Default Value

false

Inherited from

Mesh.matrixWorldNeedsUpdate


netVisibility

netVisibility: boolean

Record if the object is really visible in rendering process. If the Object3D has no parent, it would be set by visible;

Inherited from

Mesh.netVisibility


localMatrixNeedUpdate

localMatrixNeedUpdate: boolean

When this is set, it calculates the model matrix in that frame and resets this property to false.

Default Value

false

Inherited from

Mesh.localMatrixNeedUpdate


renderOrder

renderOrder: number

This value allows the default rendering order of scene graph objects to be overridden although opaque and transparent objects remain sorted independently. When this property is set for an instance of Group| Group, all descendants objects will be sorted and rendered together. Sorting is from lowest to highest renderOrder.

Default Value

0

Inherited from

Mesh.renderOrder


drawMode

drawMode: DrawMode

This is a decisive attribute for drawing method.

Default Value

Mesh.

Inherited from

Mesh.drawMode


overlayLayers

overlayLayers: number

Inherited from

Mesh.overlayLayers


castShadow

castShadow: boolean

Mark this drawable can cast shadow

Inherited from

Mesh.castShadow


castPlanarShadow

castPlanarShadow: boolean

Mark this drawable can cast shadow

Inherited from

Mesh.castPlanarShadow


isDrawable

isDrawable: boolean

Used to check type of this or extended instance. This value should not be changed by user.

Inherited from

Mesh.isDrawable


materialChanged

materialChanged: boolean

Mark the material reference changed.

Default Value

true

Inherited from

Mesh.materialChanged


geometryChanged

geometryChanged: boolean

Mark the geometry reference changed.

Default Value

true

Inherited from

Mesh.geometryChanged


frontFaceCW

frontFaceCW: boolean

Specify the winding orientation of mesh as counter-clock-wise, only meaningful on mesh.

Default Value

false.

Inherited from

Mesh.frontFaceCW


modelViewMatrix

modelViewMatrix: Matrix4

Store the Model-View matrix for this object. It is not suggested to change the matrix because it will be update automatically when camera move.

Inherited from

Mesh.modelViewMatrix


normalMatrix

normalMatrix: Matrix3

This matrix is used to calculate the normal in eye-space.

Inherited from

Mesh.normalMatrix


worldBoundingDirty

worldBoundingDirty: boolean

Mark bounding need to be recalculated.

Default Value

true

Inherited from

Mesh.worldBoundingDirty


worldBoundingBox

worldBoundingBox: Box3

Calculate the bounding as box.

Inherited from

Mesh.worldBoundingBox


worldBoundingSphere

worldBoundingSphere: Sphere

Calculate the bounding as sphere.

Inherited from

Mesh.worldBoundingSphere


z

z: number

The distance from object to camera in the direction of camera. Use this value to simply estimate the depth in 3D scene.

Inherited from

Mesh.z


onBeforeRender

onBeforeRender: Nullable<RenderHook>

This method allow user manually process data before the engine drawing object.

Remarks

See RenderHook| RenderHook for more details.

Inherited from

Mesh.onBeforeRender


viewIndependentScale

viewIndependentScale: number

This is used to scale a drawable object by specified number when enableViewIndependentScale| enableViewIndependentScale is true.

Inherited from

Mesh.viewIndependentScale


categoryId

categoryId: string

Reserved attribute

Inherited from

Mesh.categoryId


sourceType

sourceType: string

Record the object rendered as instance or other type.

Inherited from

Mesh.sourceType


shouldUseGeometryGroupsWhenOnlyHasOneMaterial

shouldUseGeometryGroupsWhenOnlyHasOneMaterial: boolean

Inherited from

Mesh.shouldUseGeometryGroupsWhenOnlyHasOneMaterial


instanceMatrixBuffer

instanceMatrixBuffer: Float32Array


isMesh

isMesh: boolean

Check the type whether it belongs to Mesh. This value should not be changed by user.

Inherited from

Mesh.isMesh


useOriginMaterialInTransparentMode

useOriginMaterialInTransparentMode: boolean

Mark this mesh use origin material in transparent mode

Inherited from

Mesh.useOriginMaterialInTransparentMode


type

type: string

The type of this Object3D.

Inherited from

Mesh.type


edges

edges: Nullable<LineSegments<Material>>

Bind edges to a mesh. Since the material is same, so all the groups will be combined together here.

Inherited from

Mesh.edges


_syncedEdgeThreshold

_syncedEdgeThreshold: number

Inherited from

Mesh._syncedEdgeThreshold


userData

readonly userData: Record<keyof any, any>

Inherited from

Mesh.userData


_uuid

_uuid: any

Inherited from

Mesh._uuid


uuid

uuid: string

Inherited from

Mesh.uuid


_listeners

_listeners: Map<Symbol, Listener<never>[]>

Inherited from

Mesh._listeners

Accessors

layers

Get Signature

get layers(): Layers

Returns

Layers

Set Signature

set layers(v): void

Parameters
v

Layers

Returns

void

Inherited from

Mesh.layers


interactionLayers

Get Signature

get interactionLayers(): Layers | undefined

Returns

Layers | undefined

Set Signature

set interactionLayers(v): void

Parameters
v

Layers | undefined

Returns

void

Inherited from

Mesh.interactionLayers


groupLayer

Get Signature

get groupLayer(): Layers | undefined

Returns

Layers | undefined

Set Signature

set groupLayer(v): void

Parameters
v

Layers | undefined

Returns

void

Inherited from

Mesh.groupLayer


position

Get Signature

get position(): Vector3

Returns

Vector3

Set Signature

set position(_position): void

A vector representing the object’s local position.

Parameters
_position

Vector3

Returns

void

Inherited from

Mesh.position


rotation

Get Signature

get rotation(): Euler

Returns

Euler

Set Signature

set rotation(rotation): void

Object’s local rotation, in radians.

Parameters
rotation

Euler

Returns

void

Inherited from

Mesh.rotation


quaternion

Get Signature

get quaternion(): Quaternion

Returns

Quaternion

Set Signature

set quaternion(_quaternion): void

Object’s local rotation as a Quaternion.

Remarks

See Quaternion for more details.

Parameters
_quaternion

Quaternion

Returns

void

Inherited from

Mesh.quaternion


scale

Get Signature

get scale(): Vector3

Returns

Vector3

Set Signature

set scale(_scale): void

The object’s local scale.

Default Value

Vector3( 1, 1, 1 )

Parameters
_scale

Vector3

Returns

void

Inherited from

Mesh.scale


matrix

Get Signature

get matrix(): Matrix4

The local transform matrix.

Returns

Matrix4

Set Signature

set matrix(value): void

Parameters
value

Matrix4

Returns

void

Inherited from

Mesh.matrix


visible

Get Signature

get visible(): boolean

Object gets rendered if true.

Default Value

true

Returns

boolean

Set Signature

set visible(value): void

Parameters
value

boolean

Returns

void

Inherited from

Mesh.visible


outlineMode

Get Signature

get outlineMode(): OutlineMode

Mark this drawable should be rendered in outline style if you set outlinePipelineMode & outlineShadingMode, get this value maybe error

Returns

OutlineMode

Set Signature

set outlineMode(v): void

Parameters
v

OutlineMode

Returns

void

Inherited from

Mesh.outlineMode


outlineShadingMode

Get Signature

get outlineShadingMode(): OutlineShadingMode

Returns

OutlineShadingMode

Set Signature

set outlineShadingMode(value): void

Parameters
value

OutlineShadingMode

Returns

void

Inherited from

Mesh.outlineShadingMode


outlineRenderMode

Get Signature

get outlineRenderMode(): OutlineRenderMode

Returns

OutlineRenderMode

Set Signature

set outlineRenderMode(value): void

OutlineRenderMode.Overlay is deprecated. use renderMode replaced

Parameters
value

OutlineRenderMode

Returns

void

Inherited from

Mesh.outlineRenderMode


renderMode

Get Signature

get renderMode(): DrawableRenderMode

Returns

DrawableRenderMode

Set Signature

set renderMode(value): void

Parameters
value

DrawableRenderMode

Returns

void

Inherited from

Mesh.renderMode


isAlwaysDynamic

Get Signature

get isAlwaysDynamic(): boolean

Returns

boolean

Set Signature

set isAlwaysDynamic(v): void

Parameters
v

boolean

Returns

void

Inherited from

Mesh.isAlwaysDynamic


enableViewIndependentScale

Get Signature

get enableViewIndependentScale(): boolean

Let this object can be scale independently.

Returns

boolean

Set Signature

set enableViewIndependentScale(v): void

Parameters
v

boolean

Returns

void

Inherited from

Mesh.enableViewIndependentScale


geometry

Get Signature

get geometry(): G

This attribute stores Geometry| Geometry or BufferGeometry| BufferGeometry (or derived classes), defining the object’s shape.

Default Value

BoxBufferGeometry| BoxBufferGeometry

Returns

G

Set Signature

set geometry(newGeo): void

Parameters
newGeo

G

Returns

void

Inherited from

Mesh.geometry


renderGeometry

Get Signature

get renderGeometry(): BufferGeometryBase

Get the geometry which is really rendered by gpu.

Returns

BufferGeometryBase

Inherited from

Mesh.renderGeometry


renderMaterial

Get Signature

get renderMaterial(): Material[]

Get the material which is really rendered by gpu.

Returns

Material[]

Inherited from

Mesh.renderMaterial


__material

Set Signature

set __material(v): void

Parameters
v

M[]

Returns

void

Inherited from

Mesh.__material


instanceKey

Get Signature

get instanceKey(): Nullable<string>

Returns

Nullable<string>

Set Signature

set instanceKey(value): void

This key is used to identify the different instances with same data.

Remarks

See InstanceMesh| InstanceMesh for more details

Parameters
value

Nullable<string>

Returns

void

Inherited from

Mesh.instanceKey


mergeKey

Get Signature

get mergeKey(): Nullable<string>

Returns

Nullable<string>

Set Signature

set mergeKey(value): void

This key is used to merge different meshes which have same key into one WebGL Draw Call.

Parameters
value

Nullable<string>

Returns

void

Inherited from

Mesh.mergeKey


businessTag

Get Signature

get businessTag(): string

Returns

string

Set Signature

set businessTag(v): void

Parameters
v

string

Returns

void

Inherited from

Mesh.businessTag

Methods

freeGPU()

freeGPU(): void

Returns

void

Inherited from

Mesh.freeGPU


syncData()

syncData(): void

Returns

void

Inherited from

Mesh.syncData


updateVisibility()

updateVisibility(): boolean

Scene will check the object’s visibility in each render and make change netVisibility based on its and parent’s visible.

Returns

boolean

Inherited from

Mesh.updateVisibility


setMatrixUpdated()

setMatrixUpdated(): void

If the local matrix is changed, use this method to manually refresh data in scene graph.

Returns

void

Tips

It’s better to use notifySceneChange() as an alternative.

Inherited from

Mesh.setMatrixUpdated


notifySceneChange()

notifySceneChange(): void

Use this method to manually refresh data in scene graph and draw again. The engine may not notify every change of the scene. If any effect is not changed with the parameters, use this may solve.

Returns

void

Inherited from

Mesh.notifySceneChange


setMatrixDirty()

setMatrixDirty(): void

If the local matrix or world matrix is changed, use this method to make engine refresh data in scene graph automatically. This method will set matrixWorldNeedsUpdate and localMatrixNeedUpdate to true.

Returns

void

Inherited from

Mesh.setMatrixDirty


updateWorldRenderData()

updateWorldRenderData(updateID): boolean

Change matrixWorldNeedsUpdate and worldMatrixUpdateTimestamp state. This method will refresh data of world matrix by updateMatrixWorld

Parameters

updateID

number

This number is used to identify the render.

Returns

boolean

Inherited from

Mesh.updateWorldRenderData


isFlipped()

isFlipped(): boolean

If there are zero or two negative numbers in xyz, return false, otherwise return true.

Returns

boolean

Inherited from

Mesh.isFlipped


localToWorld()

localToWorld(vector): Vector3

Converts the vector from local space to world space.

Parameters

vector

Vector3

A vector represents a position in local (object) coordinate.

Returns

Vector3

Inherited from

Mesh.localToWorld


worldToLocal()

worldToLocal(vector): Vector3

Updates the vector from world space to local space.

Parameters

vector

Vector3

A vector in world coordinate.

Returns

Vector3

Inherited from

Mesh.worldToLocal


applyMatrix()

applyMatrix(matrix): void

Applies the matrix transform to the object and updates the object’s position, rotation and scale.

Parameters

matrix

Matrix4

A matrix represents the information of transform.

Returns

void

Inherited from

Mesh.applyMatrix


applyQuaternion()

applyQuaternion(q): this

Applies the rotation represented by the quaternion to the object.

Parameters

q

Quaternion

A Quaternion represents the information of rotation.

Returns

this

Inherited from

Mesh.applyQuaternion


setRotationFromAxisAngle()

setRotationFromAxisAngle(axis, angle): void

Calls setFromAxisAngle( axis, angle ) on the Quaternion.

Parameters

axis

Vector3

A normalized vector in object space.

angle

number

Angle in radians.

Returns

void

Inherited from

Mesh.setRotationFromAxisAngle


setRotationFromEuler()

setRotationFromEuler(euler): void

Calls Quaternion.setRotationFromEuler| setRotationFromEuler(euler, true) on the Quaternion.

Parameters

euler

Euler

Euler angle specifying rotation amount.

Returns

void

Inherited from

Mesh.setRotationFromEuler


setRotationFromMatrix()

setRotationFromMatrix(m): void

Calls setFromRotationMatrix(m) on the Quaternion.

Parameters

m

Matrix4

Euler angle specifying rotation amount.

Returns

void

Inherited from

Mesh.setRotationFromMatrix


setRotationFromQuaternion()

setRotationFromQuaternion(q): void

Copy the given quaternion to object’s quaternion.

Parameters

q

Quaternion

Euler angle specifying rotation amount.

Returns

void

Inherited from

Mesh.setRotationFromQuaternion


rotateOnAxis()

rotateOnAxis(axis, angle): this

Rotate an object along an axis in object space. The axis is assumed to be normalized.

Parameters

axis

Vector3

A normalized vector in object space.

angle

number

Angle in radians.

Returns

this

Inherited from

Mesh.rotateOnAxis


rotateOnWorldAxis()

rotateOnWorldAxis(axis, angle): this

Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent.

Parameters

axis

Vector3

A normalized vector in object space.

angle

number

Angle in radians.

Returns

this

Inherited from

Mesh.rotateOnWorldAxis


rotateX()

rotateX(angle): this

Rotates the object around x axis in local space.

Parameters

angle

number

The angle to rotate in radians.

Returns

this

Inherited from

Mesh.rotateX


rotateY()

rotateY(angle): this

Rotates the object around x axis in local space.

Parameters

angle

number

The angle to rotate in radians.

Returns

this

Inherited from

Mesh.rotateY


rotateZ()

rotateZ(angle): this

Rotates the object around x axis in local space.

Parameters

angle

number

The angle to rotate in radians.

Returns

this

Inherited from

Mesh.rotateZ


translateOnAxis()

translateOnAxis(axis, distance): this

Translate an object by distance along an axis in object space. The axis is assumed to be normalized.

Parameters

axis

Vector3

A normalized vector in object space.

distance

number

The distance to translate.

Returns

this

Inherited from

Mesh.translateOnAxis


translateX()

translateX(distance): this

Translates object along x axis in object space by distance units.

Parameters

distance

number

The distance to translate.

Returns

this

Inherited from

Mesh.translateX


translateY()

translateY(distance): this

Translates object along y axis in object space by distance units.

Parameters

distance

number

The distance to translate.

Returns

this

Inherited from

Mesh.translateY


translateZ()

translateZ(distance): this

Translates object along z axis in object space by distance units.

Parameters

distance

number

The distance to translate.

Returns

this

Inherited from

Mesh.translateZ


lookAt()

lookAt(_x): void

Rotates the object to face to a point in world space. This method does not support objects having non-uniformly-scaled parent(s)

Parameters

_x

Vector3

A vector representing position of target in world space.

Returns

void

Inherited from

Mesh.lookAt


lookAtLocalPoint()

lookAtLocalPoint(_x): void

Rotates the object to face a point in local space.

Parameters

_x

Vector3

A vector representing position of target in local space.

Returns

void

Inherited from

Mesh.lookAtLocalPoint


add()

add(o): this

Adds object as child of this object. An arbitrary number of objects may be added. Any current parent on an object passed in here will be removed, since an object can have at most one parent. The scene graph change will be immediately notify by engine after adding nodes.

Parameters

o

Object3D | Object3D[]

Parameter can be one object or objects array, all of them is added to this object.

Returns

this

Inherited from

Mesh.add


remove()

remove(object): this

Remove the specified object form children.

Parameters

object

Object3D

The object which needs to be removed.

Returns

this

Inherited from

Mesh.remove


removeFromParent()

removeFromParent(): void

Returns

void

Inherited from

Mesh.removeFromParent


removeAllChildren()

removeAllChildren(): Object3D[]

Remove all children of this object.

Returns

Object3D[]

Inherited from

Mesh.removeAllChildren


removeObjects()

removeObjects(objects): this

Remove all children in specified objects from this objects. Migrate from tools common

Parameters

objects

Object3D[]

An array of objects which need to be removed.

Returns

this

Inherited from

Mesh.removeObjects


getObjectById()

getObjectById(id): Object3D

Searches through an object and its children, starting with the object itself, and returns the first with a matching id. Note that ids are assigned in chronological order: 1, 2, 3, …, incrementing by one for each new object.

Parameters

id

number

Unique number of the object instance.

Returns

Object3D

Inherited from

Mesh.getObjectById


getObjectByName()

getObjectByName(name): Object3D

Searches through an object and its children, starting with the object itself, and returns the first with a matching name. Note that for most objects the name is an empty string by default. You will have to set it manually to make use of this method.

Parameters

name

string

String to match to the children’s Object3D.name property.

Returns

Object3D

Inherited from

Mesh.getObjectByName


getObjectByProperty()

getObjectByProperty(name, value): Object3D

Searches through an object and its children, starting with the object itself, and returns the first with a property that matches the value given.

Parameters

name

string

The property name to search for.

value

any

Value of the given property.

Returns

Object3D

Inherited from

Mesh.getObjectByProperty


getWorldPosition()

getWorldPosition(target): Vector3

Return a vector representing the position of the object in world space.

Parameters

target

Vector3

the result will be copied into this Vector3.

Returns

Vector3

Inherited from

Mesh.getWorldPosition


getWorldQuaternion()

getWorldQuaternion(target): Quaternion

Return a quaternion representing the rotation of the object in world space.

Parameters

target

Quaternion

the result will be copied into this Quaternion.

Returns

Quaternion

Inherited from

Mesh.getWorldQuaternion


getWorldScale()

getWorldScale(target): Vector3

Return a vector of the scaling factors applied to the object for each axis in world space.

Parameters

target

Vector3

the result will be copied into this Vector3.

Returns

Vector3

Inherited from

Mesh.getWorldScale


getWorldDirection()

getWorldDirection(target): Vector3

Return a vector representing the direction of object’s positive z-axis in world space.

Parameters

target

Vector3

the result will be copied into this Vector3.

Returns

Vector3

Inherited from

Mesh.getWorldDirection


traverse()

traverse(callback): void

Execute the callback on this object and all descendants.

Parameters

callback

(object) => any

A function with as first argument an object3D object.

Returns

void

Inherited from

Mesh.traverse


traverseWithChildrenSkip()

traverseWithChildrenSkip(callback): void

Execute the callback when return is false, stop traverse the object’s descendants.

Parameters

callback

(object) => boolean

A function with as first argument an object3D object, return boolean.

Returns

void

Inherited from

Mesh.traverseWithChildrenSkip


traverseVisible()

traverseVisible(callback): void

Execute the callback on this object and all descendants which is visible.

Parameters

callback

(object) => any

A function with as first argument an object3D object.

Returns

void

Inherited from

Mesh.traverseVisible


traverseAncestors()

traverseAncestors(callback): void

Execute the callback on this object and all ancestors.

Parameters

callback

(object) => any

A function with as first argument an object3D object.

Returns

void

Inherited from

Mesh.traverseAncestors


updateMatrixWorld()

updateMatrixWorld(force?): void

Update the object’s and its descendants’ matrix of global transform with. If the parameter or matrixWorldNeedsUpdate is true, matrix will not skip updates.

Parameters

force?

boolean

Whether or not force to updates the matrix.

Returns

void

Inherited from

Mesh.updateMatrixWorld


updateWorldMatrix()

updateWorldMatrix(updateParents, updateChildren, force?): void

Update the object’s and its descendants’ matrix of global transform with. will update parent or children according to the parameters

Parameters

updateParents

boolean

update parents.

updateChildren

boolean

update children.

force?

boolean

Whether or not force to updates the matrix.

Returns

void

Inherited from

Mesh.updateWorldMatrix


getLocalBounds()

getLocalBounds(localBox?): Box3

Get the whole bounding box of current object cover all children’s.

Parameters

localBox?

Box3

If this is not undefined, result will be stored to it.

Returns

Box3

Inherited from

Mesh.getLocalBounds


getUUID()

getUUID(): string

Get UUID of this object instance. This value is automatically assigned, so this shouldn’t be edited.

Returns

string

Inherited from

Mesh.getUUID


getMaterials()

getMaterials(): readonly Material[]

Returns

readonly Material[]

Inherited from

Mesh.getMaterials


getMaterialCount()

getMaterialCount(): number

Returns

number

Inherited from

Mesh.getMaterialCount


setMaterial()

setMaterial(material, index): this

Add a new material into this object. If use this method, please make sure that the material| material has set to Array.

Parameters

material

Material

a new material which is set.

index

number

the target position in the Array.

Returns

this

Inherited from

Mesh.setMaterial


setMaterials()

setMaterials(materials): this

Parameters

materials

Material | Material[]

Returns

this

Inherited from

Mesh.setMaterials


setOnlyMaterial()

setOnlyMaterial(material): this

Parameters

material

Material

Returns

this

Inherited from

Mesh.setOnlyMaterial


expectOnlyMaterial()

expectOnlyMaterial(): Material

Expect this drawable only has one material, and return it.

Returns

Material

Inherited from

Mesh.expectOnlyMaterial


checkIfOnlyMaterial()

checkIfOnlyMaterial(innerChecker?): boolean

Parameters

innerChecker?

(m) => boolean

Returns

boolean

Inherited from

Mesh.checkIfOnlyMaterial


forEachMaterial()

forEachMaterial(v): void

Do something for every material| material whatever it is an instance or array.

Parameters

v

(m) => any

Returns

void

Inherited from

Mesh.forEachMaterial


updateBoundings()

updateBoundings(): void

update the data of bounding box and bounding sphere, set dirty mark to false.

Returns

void

Inherited from

Mesh.updateBoundings


_updateMatrixByViewIndependentScale()

_updateMatrixByViewIndependentScale(camera, viewHeight): void

Parameters

camera

Camera3D

viewHeight

number

Returns

void

Inherited from

Mesh._updateMatrixByViewIndependentScale


updateMatrix()

updateMatrix(): void

Update the matrix local transform. Override

Returns

void

Inherited from

Mesh.updateMatrix


_clearViewIndependentOverrideScale()

_clearViewIndependentOverrideScale(): void

Returns

void

Inherited from

Mesh._clearViewIndependentOverrideScale


clearChangeMark()

clearChangeMark(): void

Set all changing mark, such as geometryChanged| geometryChanged, materialChanged| materialChanged and extended mark.

Returns

void

Inherited from

Mesh.clearChangeMark


raycast()

raycast(raycaster, intersects): void

This method need override in derived classes to give a special calculation for picking feature.

Parameters

raycaster

Raycaster

intersects

Intersection[]

Returns

void

Remarks

See Raycaster for more detail.

Inherited from

Mesh.raycast


resetRenderEntity()

resetRenderEntity(): void

Clean render data for optimization.

Returns

void

Inherited from

Mesh.resetRenderEntity


refreshSceneReference()

refreshSceneReference(): void

Reset entity reference.

Returns

void

Remarks

See Scene3D._refManager| refManager for more details.

Inherited from

Mesh.refreshSceneReference


setMaterialChanged()

setMaterialChanged(): void

If user changes material| material for drawable, use this method to refresh corresponding states.

Returns

void

Inherited from

Mesh.setMaterialChanged


useGeometryGroupsWhenOnlyHasOneMaterial()

useGeometryGroupsWhenOnlyHasOneMaterial(): this

Returns

this

Inherited from

Mesh.useGeometryGroupsWhenOnlyHasOneMaterial


destroyAllResourcesOwned()

destroyAllResourcesOwned(): void

Returns

void

Inherited from

Mesh.destroyAllResourcesOwned


freeAllGpuResourceOwned()

freeAllGpuResourceOwned(): void

Returns

void

Inherited from

Mesh.freeAllGpuResourceOwned


className()

className(): string

The name of instance’s class.

Returns

string

Overrides

Mesh.className


updateRenderInfo()

updateRenderInfo(camera, viewHeight): void

Update the data which needs be changed according to the camera’s state and attributes of Drawable.updateRenderInfo| Drawable before drawing this object.

Parameters

camera

Camera3D

the camera which is used in current frame.

viewHeight

number

the height of canvas.

Returns

void

Overrides

Mesh.updateRenderInfo


updateSource()

updateSource(meshes): void

Parameters

meshes

Mesh<Material, BufferGeometry<TriangleList>>[]

Returns

void


updateRenderEntity()

updateRenderEntity(): void

Update the rendering date from this instance.

Returns

void

Overrides

Mesh.updateRenderEntity


updateInstance()

updateInstance(): void

Clear the rendering data of engine.

Returns

void


raycastJsImpl()

raycastJsImpl(raycaster, intersects): void

Get intersections between a casted Ray| ray and this Mesh. The method intersectObject() will call this method, but the results are not ordered.

Parameters

raycaster

Raycaster

the instance of Raycaster is used to get the data for calculation.

intersects

Intersection[]

the result will be stored here.

Returns

void

Overrides

Mesh.raycastJsImpl


destroy()

destroy(): void

Returns

void

Overrides

Mesh.destroy


clone()

clone(recursive?): InstanceMesh

Return a clone of this object.

Parameters

recursive?

boolean

Returns

InstanceMesh

Overrides

Mesh.clone


setGeometryChanged()

setGeometryChanged(): void

If user change the data of geometry, use this method to refresh the data.

Returns

void

Inherited from

Mesh.setGeometryChanged


onReferencedGeometryContentChange()

onReferencedGeometryContentChange(): void

If user change the data of geometry, use this method to refresh referring data.

Returns

void

Remarks

See Drawable.onReferencedGeometryContentChange| onReferencedGeometryContentChange() for more details.

Inherited from

Mesh.onReferencedGeometryContentChange


copy()

copy(source, recursive?): this

Copy the data to this object from source. This method need override in derived classes to copy extended data.

Parameters

source

Mesh<Material, InstancedBufferGeometry>

the data source.

recursive?

boolean

Returns

this

Inherited from

Mesh.copy


markBusinessTag()

markBusinessTag(v): this

Parameters

v

string

Returns

this

Inherited from

Mesh.markBusinessTag


isDestroyed()

isDestroyed(): boolean

Returns

boolean

Inherited from

Mesh.isDestroyed


validate()

validate(): void

Returns

void

Inherited from

Mesh.validate


on()

on<T>(_type, _listener): void

Adds a listener to an event type.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

Mesh.on


once()

once<T>(_type, _listener): void

Only active the listener one times and then off it| it.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

Mesh.once


has()

has<T>(_type, _listener): boolean

Checks if listener is added to an event type.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

boolean

Inherited from

Mesh.has


off()

off<T>(_type, _listener): void

Removes a listener from listening list.

Type Parameters

T

T

Parameters

_type

EventType<T>

_listener

Listener<T>

Returns

void

Inherited from

Mesh.off


emit()

Call Signature

emit(type): void

Active the event and call the registered listener.

Parameters
type

EventType<never>

Returns

void

Inherited from

Mesh.emit

Call Signature

emit<T>(type, payload): void

Type Parameters
T

T

Parameters
type

EventType<T>

payload

T

Returns

void

Inherited from

Mesh.emit


clearAllListeners()

clearAllListeners(): void

Removes all listeners from listening list.

Returns

void

Inherited from

Mesh.clearAllListeners