Mesh

clay. Mesh

# new Mesh()

Source:

Extends

Members

# __uid__ :number

Source:
Inherited From:
Type:
  • number

# autoUpdateLocalTransform :boolean

Source:
Inherited From:

If the local transform is update from SRT(scale, rotation, translation, which is position here) each frame

Type:
  • boolean

# castShadow :boolean

Source:
Inherited From:
Type:
  • boolean

# cullFace :number

Source:
Inherited From:
See:

Specify which side of polygon will be culled. Possible values:

Type:
  • number

# culling :boolean

Source:
Inherited From:

If enable culling

Type:
  • boolean

# frontFace :number

Source:
Inherited From:
See:

Specify which side is front face. Possible values:

Type:
  • number

# frustumCulling :boolean

Source:
Inherited From:

If enable software frustum culling

Type:
  • boolean

# geometry :clay.Geometry

Source:
Inherited From:
Type:

# getBoundingBox

Source:
Inherited From:

Get bounding box of node

# ignoreGBuffer :boolean

Source:
Inherited From:
Type:
  • boolean

# ignorePicking :boolean

Source:
Inherited From:
Type:
  • boolean

# ignorePreZ :boolean

Source:
Inherited From:
Type:
  • boolean

# invisible :boolean

Source:
Inherited From:

If node and its chilren invisible

Type:
  • boolean

# joints :Array.<number>

Source:

Joints indices Meshes can share the one skeleton instance and each mesh can use one part of joints. Joints indices indicate the index of joint in the skeleton instance

Type:
  • Array.<number>

# lightGroup

Source:
Inherited From:

Group of received light.

# localTransform :clay.Matrix4

Source:
Inherited From:

Affine transform matrix relative to its parent node. Composited with position, rotation and scale.

Type:

# material :clay.Material

Source:
Inherited From:
Type:

# mode :number

Source:
Inherited From:
Type:
  • number

# name :string

Source:
Inherited From:

Scene node name

Type:
  • string

# position :clay.Vector3

Source:
Inherited From:

Position relative to its parent node. aka translation.

Type:

# receiveShadow :boolean

Source:
Inherited From:
Type:
  • boolean

# renderOrder :Number

Source:
Inherited From:

Render order, Nodes with smaller value renders before nodes with larger values.

Type:
  • Number

# rotation :clay.Quaternion

Source:
Inherited From:

Rotation relative to its parent node. Represented by a quaternion

Type:

# scale :clay.Vector3

Source:
Inherited From:

Scale relative to its parent node

Type:

# skeleton :clay.Skeleton

Source:

Used when it is a skinned mesh

Type:

# (nullable) target :clay.Vector3

Source:
Inherited From:
Type:

# worldTransform :clay.Matrix4

Source:
Inherited From:

Affine transform matrix relative to its root scene.

Type:

Methods

# add(node)

Source:
Inherited From:

Add a child node

Parameters:
Name Type Description
node clay.Node

# after(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of once('after' + name)

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# afterRender()

Source:
Inherited From:

Before render hook

# before(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of once('before' + name)

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# beforeRender()

Source:
Inherited From:

Before render hook

# childAt(idx) → {clay.Node}

Source:
Inherited From:

Get child scene node at given index.

Parameters:
Name Type Description
idx number
Returns:
Type
clay.Node

# children() → {Array.<clay.Node>}

Source:
Inherited From:

Get a new created array of all children nodes

Returns:
Type
Array.<clay.Node>

# clone() → {clay.Renderable}

Source:
Inherited From:

Clone a new renderable

Returns:
Type
clay.Renderable

# decomposeLocalTransform()

Source:
Inherited From:

Decompose the local transform to SRT

# decomposeWorldTransform()

Source:
Inherited From:

Decompose the world transform to SRT

# eachChild(callback, contextopt)

Source:
Inherited From:

Traverse all children nodes.

WARN DON'T do add, remove operation in the callback during iteration.

Parameters:
Name Type Attributes Description
callback function
context Node <optional>

# error(action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of on('error')

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# getChildByName(name) → {clay.Node}

Source:
Inherited From:

Get first child with the given name

Parameters:
Name Type Description
name string
Returns:
Type
clay.Node

# getDescendantByName(name) → {clay.Node}

Source:
Inherited From:

Get first descendant have the given name

Parameters:
Name Type Description
name string
Returns:
Type
clay.Node

# getParent() → {clay.Scene}

Source:
Inherited From:

Get parent node

Returns:
Type
clay.Scene

# getPath(rootNodeopt) → {string}

Source:
Inherited From:

Get query path, relative to rootNode(default is scene)

Parameters:
Name Type Attributes Description
rootNode clay.Node <optional>
Returns:
Type
string

# getScene() → {clay.Scene}

Source:
Inherited From:

Get the scene mounted

Returns:
Type
clay.Scene

# getWorldPosition(outopt) → {clay.Vector3}

Source:
Inherited From:

Get world position, extracted from world transform

Parameters:
Name Type Attributes Description
out clay.Vector3 <optional>
Returns:
Type
clay.Vector3

# has(name, action) → {boolean}

Source:
Inherited From:
Mixes In:

If registered the event handler

Parameters:
Name Type Description
name string
action function
Returns:
Type
boolean

# isAncestor(node)

Source:
Inherited From:

Return true if it is ancestor of the given scene node

Parameters:
Name Type Description
node clay.Node

# isRenderable() → {boolean}

Source:
Inherited From:
Returns:
Type
boolean

# isSkinnedMesh() → {boolean}

Source:
Inherited From:

If Node is a skinned mesh

Returns:
Type
boolean

# lookAt(target, upopt)

Source:
Inherited From:
See:
Parameters:
Name Type Attributes Description
target clay.Vector3
up clay.Vector3 <optional>

# off(action, contextopt)

Source:
Inherited From:
Mixes In:

Remove event listener

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# on(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Register event handler

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# once(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Register event, event will only be triggered once and then removed

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# queryNode(path) → {clay.Node}

Source:
Inherited From:

Query descendant node by path

Example
node.queryNode('root/parent/child');
Parameters:
Name Type Description
path string
Returns:
Type
clay.Node

# remove(node)

Source:
Inherited From:

Remove the given child scene node

Parameters:
Name Type Description
node clay.Node

# removeAll()

Source:
Inherited From:

Remove all children

# rotateAround(point, axis, angle)

Source:
Inherited From:
See:

Rotate the node around a axis by angle degrees, axis passes through point

Parameters:
Name Type Description
point clay.Vector3

Center point

axis clay.Vector3

Center axis

angle number

Rotation angle

# setLocalTransform(matrix)

Source:
Inherited From:

Set the local transform and decompose to SRT

Parameters:
Name Type Description
matrix clay.Matrix4

# setName(name)

Source:
Inherited From:

Set the name of the scene node

Parameters:
Name Type Description
name string

# setWorldTransform(matrix)

Source:
Inherited From:

Set the world transform and decompose to SRT

Parameters:
Name Type Description
matrix clay.Matrix4

# success(action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of on('success')

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# traverse(callback, contextopt)

Source:
Inherited From:

Depth first traverse all its descendant scene nodes.

WARN Don't do add, remove operation in the callback during traverse.

Parameters:
Name Type Attributes Description
callback function
context Node <optional>

# trigger(name)

Source:
Inherited From:
Mixes In:

Trigger event

Parameters:
Name Type Description
name string

# update(forceUpdateWorld)

Source:
Inherited From:

Update local transform and world transform recursively

Parameters:
Name Type Description
forceUpdateWorld boolean

# updateLocalTransform()

Source:
Inherited From:

Update local transform from SRT Notice that local transform will not be updated if _dirty mark of position, rotation, scale is all false

# updateWorldTransform()

Source:
Inherited From:

Update world transform before whole scene is updated.