Public Member Functions | Static Public Member Functions | Properties

CC3ParticleBase Class Reference

CC3ParticleBase is a convenience class that forms a base implementation of the CC3ParticleProtocol protocol. More...

#import <CC3Particles.h>

Inheritance diagram for CC3ParticleBase:
Inheritance graph
[legend]
Collaboration diagram for CC3ParticleBase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(id) - init
(void) - populateFrom:
(void) - remove

Static Public Member Functions

(id) + particle

Properties

ccColor3B color
ccColor4B color4B
ccColor4F color4F
CC3Vector globalLocation
BOOL hasColor
CC3Vector location
GLubyte opacity

Detailed Description

CC3ParticleBase is a convenience class that forms a base implementation of the CC3ParticleProtocol protocol.


Member Function Documentation

- (id) init

Initializes this instance.

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.

+ (id) particle

Allocates and initializes an autoreleased instance.

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.

- (void) populateFrom: (CC3ParticleBase *)  another

Template method that populates this instance from the specified other instance.

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.

- (void) remove

Removes this particle from the emitter.

The differs from setting the isAlive property to NO, in that the removal is processed immediately, using the removeParticle: method of the emitter.


Property Documentation

- (ccColor3B) color [read, write, assign]

Implementation of the CCRGBAProtocol color property.

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.

- (ccColor4B) color4B [read, write, assign]

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.

- (ccColor4F) color4F [read, write, assign]

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.

- (CC3Vector) globalLocation [read, assign]

The location of the particle in 3D space, relative to the global origin.

This is calculated by using the transformMatrix of the emitter to transform the location of this particle.

- (BOOL) hasColor [read, assign]

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.

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.

- (CC3Vector) location [read, write, assign]

The location of this particle in the local coordinate system of the emitter.

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.

Implemented in CC3MeshParticle.

- (GLubyte) opacity [read, write, assign]

Implementation of the CCRGBAProtocol opacity property.

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.


The documentation for this class was generated from the following file: