# new Spot()
- Source:
Extends
Members
# (static) falloffFactor :number
- Source:
Type:
- number
# (static) penumbraAngle :number
- Source:
Type:
- number
# (static) range :number
- Source:
Type:
- number
# (static) shadowBias :number
- Source:
Type:
- number
# (static) shadowSlopeScale :number
- Source:
Type:
- number
# (static) umbraAngle :number
- Source:
Type:
- number
# __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:
If light cast shadow
Type:
- boolean
# color :Array.<number>
- Source:
- Inherited From:
Light RGB color
Type:
- Array.<number>
# getBoundingBox
- Source:
- Inherited From:
Get bounding box of node
# group :number
- Source:
- Inherited From:
Light group, shader with same lightGroup
will be affected
Only useful in forward rendering
Type:
- number
# intensity :number
- Source:
- Inherited From:
Light intensity
Type:
- number
# invisible :boolean
- Source:
- Inherited From:
If node and its chilren invisible
Type:
- boolean
# localTransform :clay.Matrix4
- Source:
- Inherited From:
Affine transform matrix relative to its parent node. Composited with position, rotation and scale.
Type:
# 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:
# 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:
# shadowResolution :number
- Source:
- Inherited From:
Shadow map size
Type:
- number
# (nullable) target :clay.Vector3
- Source:
- Inherited From:
Type:
# type :string
- Source:
- Inherited From:
Light type
Type:
- string
# 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> |
# 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> |
# 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.light.Spot}
- Source:
- Overrides:
Returns:
- Type
- clay.light.Spot
# 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:
Return true if it is a renderable scene node, like Mesh and ParticleSystem
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.