CC3ParticleBase Class Reference
Inherits from | NSObject |
Conforms to | CC3ParticleProtocol CCRGBAProtocol NSCopying |
Declared in | CC3Particles.h |
Overview
CC3ParticleBase is a convenience class that forms a base implementation of the CC3ParticleProtocol protocol.
Tasks
-
location
property -
globalLocation
property -
color4F
property -
color4B
property -
hasColor
property -
– remove
-
color
property -
opacity
property -
– init
-
+ particle
-
– populateFrom:
Properties
color
The color of this particle.
@property (nonatomic, assign) CCColorRef color
Discussion
If this particle has individual color content, (which can be checked with the hasColor property), this property indicates the color in which this particle will appear.
If this particle has individual color content, you can set this property at any time to define the color of the entire particle.
Particles are configured for individual color content by including the kCC3VertexContentColor component flag when setting the vertexContentTypes property of the emitter.
Setting this property will set the color of all vertices in the particle to the assigned color.
Reading this property returns the color value of the first vertex in the particle. If this particle does not support individual color content, this property will always return the value of the diffuseColor property of the emitter. In this condition, it is safe to set this property, but changes will have no effect.
Declared In
CC3Particles.h
color4B
If this particle has individual color content, (which can be checked with the hasColor property), this property indicates the color in which this particle will appear.
@property (nonatomic, assign) ccColor4B color4B
Discussion
If this particle has individual color content, you can set this property at any time to define the color of the entire particle.
Particles are configured for individual color content by including the kCC3VertexContentColor component flag when setting the vertexContentTypes property of the emitter.
Setting this property will set the color of all vertices in the particle to the assigned color.
Reading this property returns the color value of the first vertex in the particle. If this particle does not support individual color content, this property will always return the value of the diffuseColor property of the emitter. In this condition, it is safe to set this property, but changes will have no effect.
Declared In
CC3Particles.h
color4F
If this particle has individual color content, (which can be checked with the hasColor property), this property indicates the color in which this particle will appear.
@property (nonatomic, assign) ccColor4F color4F
Discussion
If this particle has individual color content, you can set this property at any time to define the color of the entire particle.
Particles are configured for individual color content by including the kCC3VertexContentColor component flag when setting the vertexContentTypes property of the emitter.
Setting this property will set the color of all vertices in the particle to the assigned color.
Reading this property returns the color value of the first vertex in the particle. If this particle does not support individual color content, this property will always return the value of the diffuseColor property of the emitter. In this condition, it is safe to set this property, but changes will have no effect.
Declared In
CC3Particles.h
globalLocation
The location of the particle in 3D space, relative to the global origin.
@property (nonatomic, readonly) CC3Vector globalLocation
Discussion
This is calculated by using the globalTransformMatrix of the emitter to transform the location of this particle.
Declared In
CC3Particles.h
hasColor
Indicates whether this particle has individual color content. This is determine by the configuration of the emitter. Within an emitter, either all particles have this content, or none do.
@property (nonatomic, readonly) BOOL hasColor
Discussion
When this property returns YES, each particle can be set to a different color. When this property returns NO, all particles will have the color specified by the diffuseColor property of the emitter.
Particles are configured for individual color content by including the kCC3VertexContentColor component flag when setting the vertexContentTypes property of the emitter.
Declared In
CC3Particles.h
location
The location of this particle in the local coordinate system of the emitter.
@property (nonatomic, assign) CC3Vector location
Discussion
You can set this property in the initializeParticle and updateBeforeTransform: methods to move the particle around.
The initial value of this property, set prior to the invocation of the initializeParticle method, is kCC3VectorZero.
Declared In
CC3Particles.h
opacity
The opacity of this particle.
@property (nonatomic, assign) CCOpacity opacity
Discussion
If this particle has individual color content, (which can be checked with the hasColor property), this property indicates the opacity in which this particle will appear.
If this particle has individual color content, you can set this property at any time to define the opacity of the entire particle.
Particles are configured for individual color content by including the kCC3VertexContentColor component flag when setting the vertexContentTypes property of the emitter.
Setting this property will set the opacity of all vertices in the particle to the assigned value.
Reading this property returns the color value of the first vertex in the particle. If this particle does not support individual color content, this property will always return the value of the opacity of the diffuseColor property of the emitter. In this condition, it is safe to set this property, but changes will have no effect.
Declared In
CC3Particles.h
Class Methods
particle
Allocates and initializes an autoreleased instance.
+ (id)particle
Discussion
When initializing a particle, be aware that, in the interests of performance and memory conservation, expired particles can and will be cached and reused, and particle emission may not always involve instantiating a new instance of your particle class.
With this in mind, you should not depend on the init method being invoked during particle emission. All code that establishes the initial emitted state of a particle should be included in the initializeParticle method, or should be set in the initializeParticle: method of the particle emitter or particle navigator.
Declared In
CC3Particles.h
Instance Methods
init
Initializes this instance.
- (id)init
Discussion
When initializing a particle, be aware that, in the interests of performance and memory conservation, expired particles can and will be cached and reused, and particle emission may not always involve instantiating a new instance of your particle class.
With this in mind, you should not depend on the init method being invoked during particle emission. All code that establishes the initial emitted state of a particle should be included in the initializeParticle method, or should be set in the initializeParticle: method of the particle emitter or particle navigator.
Declared In
CC3Particles.h
populateFrom:
Template method that populates this instance from the specified other instance.
- (void)populateFrom:(CC3ParticleBase *)another
Discussion
This method is invoked automatically during object copying via the copy or copyWithZone: method. In most situations, the application should use the copy method, and should never need to invoke this method directly.
Subclasses that add additional instance state (instance variables) should extend copying by overriding this method to copy that additional state. Superclass that override this method should be sure to invoke the superclass implementation to ensure that superclass state is copied as well.
Declared In
CC3Particles.h