Class Index | File Index

Classes


Class cc.ParticleBatchNode


Extends cc.ParticleSystem.

Defined in: CCParticleBatchNode.js.

Class Summary
Constructor Attributes Constructor Name and Description
 

cc.ParticleBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call
(often known as "batch draw").

Method Summary
Method Attributes Method Name and Description
 
addChild(child, zOrder, tag)
Add a child into the cc.ParticleBatchNode
<static>  
cc.ParticleBatchNode.create(fileImage, capacity)
initializes the particle system with the name of a file on disk (for a list of supported formats look at the cc.Texture2D class), a capacity of particles
<static>  
cc.ParticleBatchNode.createWithTexture(texture, capacity)
initializes the particle system with cc.Texture2D, a capacity of particles, which particle system to use
 
disableParticle(particleIndex)
disables a particle by inserting a 0'd quad into the texture atlas
 
returns the blending function used for the texture
 
returns the used texture
 
init(fileImage, capacity)
initializes the particle system with the name of a file on disk (for a list of supported formats look at the cc.Texture2D class), a capacity of particles
 
initWithTexture(texture, capacity)
initializes the particle system with cc.Texture2D, a capacity of particles
 
insertChild(pSystem, index)
Inserts a child into the cc.ParticleBatchNode
 
removeAllChildren(doCleanup)
 
removeChild(child, cleanup)
 
removeChildAtIndex(index, doCleanup)
 
reorderChild(child, zOrder)
Reorder will be done in this function, no "lazy" reorder to particles
 
setBlendFunc(src, dst)
set the blending function used for the texture
 
setTexture(texture)
sets a new texture.
 
XXX_draw(ctx)
 
XXX_visit(ctx)
Methods borrowed from class cc.ParticleSystem:
addParticle, ctor, destroyParticleSystem, getAngle, getAngleVar, getAtlasIndex, getBatchNode, getBoundingBoxToWorld, getDrawMode, getDuration, getEmissionRate, getEmitterMode, getEndColor, getEndColorVar, getEndRadius, getEndRadiusVar, getEndSize, getEndSizeVar, getEndSpin, getEndSpinVar, getGravity, getLife, getLifeVar, getOpacityModifyRGB, getParticleCount, getPositionType, getPosVar, getRadialAccel, getRadialAccelVar, getRotatePerSecond, getRotatePerSecondVar, getShapeType, getSourcePosition, getSpeed, getSpeedVar, getStartColor, getStartColorVar, getStartRadius, getStartRadiusVar, getStartSize, getStartSizeVar, getStartSpin, getStartSpinVar, getTangentialAccel, getTangentialAccelVar, getTotalParticles, initParticle, initWithDictionary, initWithFile, initWithTotalParticles, isActive, isAutoRemoveOnFinish, isBlendAdditive, isFull, postStep, resetSystem, setAngle, setAngleVar, setAtlasIndex, setAutoRemoveOnFinish, setBatchNode, setBlendAdditive, setDrawMode, setDuration, setEmissionRate, setEmitterMode, setEndColor, setEndColorVar, setEndRadius, setEndRadiusVar, setEndSize, setEndSizeVar, setEndSpin, setEndSpinVar, setGravity, setLife, setLifeVar, setOpacityModifyRGB, setParticleCount, setPositionType, setPosVar, setRadialAccel, setRadialAccelVar, setRotatePerSecond, setRotatePerSecondVar, setRotation, setScale, setScaleX, setScaleY, setShapeType, setSourcePosition, setSpeed, setSpeedVar, setStartColor, setStartColorVar, setStartRadius, setStartRadiusVar, setStartSize, setStartSizeVar, setStartSpin, setStartSpinVar, setTangentialAccel, setTangentialAccelVar, setTotalParticles, stopSystem, update, updateQuadWithParticle, updateWithNoTime
Methods borrowed from class cc.Node:
cleanup, convertToNodeSpace, convertToNodeSpaceAR, convertTouchToNodeSpace, convertTouchToNodeSpaceAR, convertToWorldSpace, convertToWorldSpaceAR, description, draw, getActionByTag, getActionManager, getAnchorPoint, getAnchorPointInPoints, getBoundingBox, getCamera, getChildByTag, getChildren, getChildrenCount, getContentSize, getGLServerState, getGrid, getOrderOfArrival, getParent, getPosition, getPositionX, getPositionY, getRotation, getScale, getScaleX, getScaleY, getScheduler, getShaderProgram, getSkewX, getSkewY, getTag, getUserData, getUserObject, getVertexZ, getZOrder, ignoreAnchorPointForPosition, isIgnoreAnchorPointForPosition, isRunning, isVisible, nodeToParentTransform, nodeToWorldTransform, numberOfRunningActions, onEnter, onEnterTransitionDidFinish, onExit, onExitTransitionDidStart, parentToNodeTransform, pauseSchedulerAndActions, release, removeAllChildrenWithCleanup, removeChildByTag, removeFromParent, removeFromParentAndCleanup, resumeSchedulerAndActions, retain, runAction, schedule, scheduleOnce, scheduleUpdate, scheduleUpdateWithPriority, setActionManager, setAnchorPoint, setContentSize, setGLServerState, setGrid, setNodeDirty, setOrderOfArrival, setParent, setPosition, setPositionX, setPositionY, setScheduler, setShaderProgram, setSkewX, setSkewY, setTag, setUserData, setUserObject, setVertexZ, setVisible, setZOrder, sortAllChildren, stopAction, stopActionByTag, stopAllActions, transform, transformAncestors, unschedule, unscheduleAllCallbacks, unscheduleUpdate, updateTransform, visit, worldToNodeTransform
Class Detail
cc.ParticleBatchNode()

cc.ParticleBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call
(often known as "batch draw").
A cc.ParticleBatchNode can reference one and only one texture (one image file, one texture atlas).
Only the cc.ParticleSystems that are contained in that texture can be added to the cc.SpriteBatchNode.
All cc.ParticleSystems added to a cc.SpriteBatchNode are drawn in one OpenGL ES draw call.
If the cc.ParticleSystems are not added to a cc.ParticleBatchNode then an OpenGL ES draw call will be needed for each one, which is less efficient.
Limitations:
- At the moment only cc.ParticleSystemQuad is supported
- All systems need to be drawn with the same parameters, blend function, aliasing, texture
Most efficient usage
- Initialize the ParticleBatchNode with the texture and enough capacity for all the particle systems
- Initialize all particle systems and add them as child to the batch node

Method Detail
addChild(child, zOrder, tag)
Add a child into the cc.ParticleBatchNode
Parameters:
{cc.Node} child
{Number} zOrder
{Number} tag

<static> {cc.ParticleBatchNode} cc.ParticleBatchNode.create(fileImage, capacity)
initializes the particle system with the name of a file on disk (for a list of supported formats look at the cc.Texture2D class), a capacity of particles
Parameters:
{String} fileImage
capacity
Returns:
{cc.ParticleBatchNode}

<static> {cc.ParticleBatchNode} cc.ParticleBatchNode.createWithTexture(texture, capacity)
initializes the particle system with cc.Texture2D, a capacity of particles, which particle system to use
Parameters:
{cc.Texture2D|HTMLImageElement|HTMLCanvasElement} texture
{Number} capacity
Returns:
{cc.ParticleBatchNode}

disableParticle(particleIndex)
disables a particle by inserting a 0'd quad into the texture atlas
Parameters:
{Number} particleIndex

{cc.BlendFunc} getBlendFunc()
returns the blending function used for the texture
Returns:
{cc.BlendFunc}

{cc.Texture2D|HTMLImageElement|HTMLCanvasElement} getTexture()
returns the used texture
Returns:
{cc.Texture2D|HTMLImageElement|HTMLCanvasElement}

{Boolean} init(fileImage, capacity)
initializes the particle system with the name of a file on disk (for a list of supported formats look at the cc.Texture2D class), a capacity of particles
Parameters:
{String} fileImage
{Number} capacity
Returns:
{Boolean}

{Boolean} initWithTexture(texture, capacity)
initializes the particle system with cc.Texture2D, a capacity of particles
Parameters:
{cc.Texture2D|HTMLImageElement|HTMLCanvasElement} texture
{Number} capacity
Returns:
{Boolean}

insertChild(pSystem, index)
Inserts a child into the cc.ParticleBatchNode
Parameters:
{cc.ParticleSystem} pSystem
{Number} index

removeAllChildren(doCleanup)
Parameters:
{Boolean} doCleanup

removeChild(child, cleanup)
Parameters:
{cc.Node} child
{Boolean} cleanup

removeChildAtIndex(index, doCleanup)
Parameters:
{Number} index
{Boolean} doCleanup

reorderChild(child, zOrder)
Reorder will be done in this function, no "lazy" reorder to particles
Parameters:
{cc.Node} child
{Number} zOrder

setBlendFunc(src, dst)
set the blending function used for the texture
Parameters:
{Number} src
{Number} dst

setTexture(texture)
sets a new texture. it will be retained
Parameters:
{cc.Texture2D|HTMLImageElement|HTMLCanvasElement} texture

XXX_draw(ctx)
Parameters:
{CanvasContext} ctx

XXX_visit(ctx)
Parameters:
ctx

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 09 2013 07:51:52 GMT-0800 (PST)