CCParticleBatchNode Class Reference
Inherits from | CCNode : NSObject |
Conforms to | CCTextureProtocol |
Declared in | CCParticleBatchNode.h |
Overview
CCParticleBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as “batch draw”).
A CCParticleBatchNode can reference one and only one texture (one image file, one texture atlas). Only the CCParticleSystems that are contained in that texture can be added to the CCSpriteBatchNode. All CCParticleSystems added to a CCSpriteBatchNode are drawn in one OpenGL ES draw call. If the CCParticleSystems are not added to a CCParticleBatchNode then an OpenGL ES draw call will be needed for each one, which is less efficient.
Limitations: – At the moment only CCParticleSystemQuad 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
Tasks
-
textureAtlas
the texture atlas used for drawing the quads
property -
blendFunc
the blend function used for drawing the quads
property -
+ batchNodeWithTexture:
initializes the particle system with CCTexture2D, a default capacity of 500
-
+ batchNodeWithFile:
initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a default capacity of 500 particles
-
+ batchNodeWithTexture:capacity:
initializes the particle system with CCTexture2D, a capacity of particles, which particle system to use
-
+ batchNodeWithFile:capacity:
initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles
-
– initWithTexture:capacity:
initializes the particle system with CCTexture2D, a capacity of particles
-
– initWithFile:capacity:
initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles
-
– addChild:z:tag:
Add a child into the CCParticleBatchNode
-
– insertChild:inAtlasAtIndex:
Inserts a child into the CCParticleBatchNode
-
– removeChild:cleanup:
remove child from the CCParticleBatchNode
-
– disableParticle:
disables a particle by inserting a 0’d quad into the texture atlas
Properties
Class Methods
batchNodeWithFile:
initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a default capacity of 500 particles
+ (id)batchNodeWithFile:(NSString *)imageFile
Declared In
CCParticleBatchNode.h
batchNodeWithFile:capacity:
initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles
+ (id)batchNodeWithFile:(NSString *)fileImage capacity:(NSUInteger)capacity
Declared In
CCParticleBatchNode.h
Instance Methods
addChild:z:tag:
Add a child into the CCParticleBatchNode
- (void)addChild:(CCParticleSystem *)child z:(NSInteger)z tag:(NSInteger)aTag
Declared In
CCParticleBatchNode.h
disableParticle:
disables a particle by inserting a 0’d quad into the texture atlas
- (void)disableParticle:(NSUInteger)particleIndex
Declared In
CCParticleBatchNode.h
initWithFile:capacity:
initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles
- (id)initWithFile:(NSString *)fileImage capacity:(NSUInteger)capacity
Declared In
CCParticleBatchNode.h
initWithTexture:capacity:
initializes the particle system with CCTexture2D, a capacity of particles
- (id)initWithTexture:(CCTexture2D *)tex capacity:(NSUInteger)capacity
Declared In
CCParticleBatchNode.h