ParticleRenderable

clay.particle. ParticleRenderable

# new ParticleRenderable()

Source:
Example
var particleRenderable = new clay.particle.ParticleRenderable({
        spriteAnimationTileX: 4,
        spriteAnimationTileY: 4,
        spriteAnimationRepeat: 1
    });
    scene.add(particleRenderable);
    // Enable uv animation in the shader
    particleRenderable.material.define('both', 'UV_ANIMATION');
    var Emitter = clay.particle.Emitter;
    var Vector3 = clay.Vector3;
    var emitter = new Emitter({
        max: 2000,
        amount: 100,
        life: Emitter.random1D(10, 20),
        position: Emitter.vector(new Vector3()),
        velocity: Emitter.random3D(new Vector3(-10, 0, -10), new Vector3(10, 0, 10));
    });
    particleRenderable.addEmitter(emitter);
    var gravityField = new clay.particle.ForceField();
    gravityField.force.y = -10;
    particleRenderable.addField(gravityField);
    ...
    animation.on('frame', function(frameTime) {
        particleRenderable.updateParticles(frameTime);
        renderer.render(scene, camera);
    });

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:
Overrides:
Type:
  • boolean

# cullFace :number

Source:
Inherited From:
See:

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

Type:
  • number

# culling :boolean

Source:
Overrides:

If enable culling

Type:
  • boolean

# duration :number

Source:

Duration of particle system in milliseconds

Type:
  • number

# frontFace :number

Source:
Inherited From:
See:

Specify which side is front face. Possible values:

Type:
  • number

# frustumCulling :boolean

Source:
Overrides:

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:
Overrides:
Type:
  • boolean

# ignorePreZ :boolean

Source:
Inherited From:
Type:
  • boolean

# invisible :boolean

Source:
Inherited From:

If node and its chilren invisible

Type:
  • boolean

# 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:

# loop :boolean

Source:
Type:
  • boolean

# material :clay.Material

Source:
Inherited From:
Type:

# mode :number

Source:
Overrides:
Type:
  • number

# name :string

Source:
Inherited From:

Scene node name

Type:
  • string

# oneshot :boolean

Source:
Type:
  • boolean

# position :clay.Vector3

Source:
Inherited From:

Position relative to its parent node. aka translation.

Type:

# receiveShadow :boolean

Source:
Overrides:
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:

# spriteAnimationRepeat :number

Source:
Type:
  • number

# spriteAnimationTileX :number

Source:
Type:
  • number

# spriteAnimationTileY :number

Source:
Type:
  • number

# (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

# addEmitter(emitter)

Source:

Add emitter

Parameters:
Name Type Description
emitter clay.particle.Emitter

# addField(field)

Source:

Add field

Parameters:
Name Type Description
field clay.particle.Field

# 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.particle.ParticleRenderable}

Source:
Overrides:
Returns:
Type
clay.particle.ParticleRenderable

# decomposeLocalTransform()

Source:
Inherited From:

Decompose the local transform to SRT

# decomposeWorldTransform()

Source:
Inherited From:

Decompose the world transform to SRT

# dispose(renderer)

Source:
Parameters:
Name Type Description
renderer clay.Renderer

# 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

# isFinished() → {boolean}

Source:
Returns:
Type
boolean

# 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

# removeEmitter(emitter)

Source:

Remove emitter

Parameters:
Name Type Description
emitter clay.particle.Emitter

# removeField(field)

Source:

Remove field

Parameters:
Name Type Description
field clay.particle.Field

# reset()

Source:

Reset the particle system.

# 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

# updateParticles(deltaTime)

Source:
Parameters:
Name Type Description
deltaTime number

# updateWorldTransform()

Source:
Inherited From:

Update world transform before whole scene is updated.