#import <CC3PointParticles.h>
Instance Methods | |
(void) | - doNotBufferVertexPointSizes |
(GLfloat) | - particleSizeAt: |
(id< CC3PointParticleProtocol >) | - pointParticleAt: |
(void) | - populateForMaxParticles: |
(void) | - populateForMaxParticles:containing: |
(void) | - populateForMaxParticles:ofType: |
(void) | - populateForMaxParticles:ofType:containing: |
(void) | - retainVertexPointSizes |
(void) | - setParticleSize:at: |
(void) | - updateParticleSizesGLBuffer |
Properties | |
CC3PointParticleMesh *particleMesh | __deprecated |
CC3VertexContent particleContentTypes | __deprecated |
GLuint maxParticles | __deprecated |
CC3AttenuationCoefficients particleSizeAttenuationCoefficients | __deprecated |
GLfloat | normalizedParticleSize |
GLfloat | normalizedParticleSizeMaximum |
GLfloat | normalizedParticleSizeMinimum |
GLfloat | particleSize |
CC3AttenuationCoefficients | particleSizeAttenuation |
GLfloat | particleSizeMaximum |
GLfloat | particleSizeMinimum |
BOOL | shouldNormalizeParticleSizesToDevice |
BOOL | shouldSmoothPoints |
GLfloat | unityScaleDistance |
Additional Inherited Members | |
Class Methods inherited from CC3LocalContentNode | |
(ccColor4F) | + localContentWireframeBoxColor |
(void) | + setLocalContentWireframeBoxColor: |
CC3PointParticleEmitter emits particles that conform to the CC3PointParticleProtocol protocol.
Each particle has its own location, and may optionally be configued with its own color and individual size, and each particle may be configured with a vertex normal so that it can interact with light sources. This particle content is defined by the vertexContentTypes property of this emitter.
Each point particle emitted displays the same texture, which is determined by the texture property of this emitter node. Be aware that OpenGL point particles use the entire texture, which you should generally ensure has dimensions that are power-of-two. Non-POT textures will be padded by iOS when loaded, for compatibility with the graphics hardware. Although the padding is generally transparent, it may throw off the expected location of your particle.
In general, point particles will contain transparent content. As such, you will likely want to set the blendFunc property to one of the following:
For CC3PointParticleEmitter, the initial value of the shouldDisableDepthMask property is YES, so that the particles do not enage in Z-fighting with each other. You can experiment with changing this to NO if your emitter is better suited to it.
You can also experiment with the shouldDisableDepthTest and depthFunction properties to see if change them helps you get the look you are trying to achieve.
You can control characteristics about the sizes of the particles, and how that size should change with distance from the camera, using the particleSize, particleSizeMinimum, particleSizeMaximum, particleSizeAttenuation, and unityScaleDistance properties.
All memory used by the particles and the underlying vertex mesh is managed by the emitter node, and is deallocated automatically when the emitter is released.
- (void) doNotBufferVertexPointSizes |
Convenience method to cause the vertex point size data to be skipped when createGLBuffers is invoked.
The vertex data is not buffered to a GL VBO, is retained in application memory, and is submitted to the GL engine on each frame render.
Only the vertex point sizes will not be buffered to a GL VBO. Any other vertex content, such as locations, or texture coordinates, will be buffered to a GL VBO when createGLBuffers is invoked.
This method causes the vertex data to be retained in application memory, so, if you have invoked this method, you do NOT also need to invoke the retainVertexPointSizes method.
Implements CC3Node.
- (GLfloat) particleSizeAt: | (GLuint) | vtxIndex |
Returns the particle size element at the specified index from the vertex data.
The index refers to vertices, not bytes. The implementation takes into consideration the vertexStride and elementOffset properties to access the correct element.
If the releaseRedundantContent method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.
You typically do not use this method directly. Instead, use the size property of the individual particle from within your custom CC3PointParticle subclass.
- (id<CC3PointParticleProtocol>) pointParticleAt: | (GLuint) | aParticleIndex |
Returns the particle at the specified index within the particles array, cast as a point particle.
- (void) populateForMaxParticles: | (GLuint) | __deprecated |
- (void) populateForMaxParticles: | (GLuint) | numParticles | |
containing: | (CC3VertexContent) | __deprecated | |
- (void) populateForMaxParticles: | (GLuint) | maxParticles | |
ofType: | (id) | __deprecated | |
- (void) populateForMaxParticles: | (GLuint) | numParticles | |
ofType: | (id) | aParticleClass | |
containing: | (CC3VertexContent) | __deprecated | |
- (void) retainVertexPointSizes |
Convenience method to cause the vertex point size data to be retained in application memory when releaseRedundantContent is invoked, even if it has been buffered to a GL VBO.
Only the vertex point sizes will be retained. Any other vertex data, such as locations, or texture coordinates, that has been buffered to GL VBO's, will be released from application memory when releaseRedundantContent is invoked.
This method is invoked automatically when the vertexContentTypes property is set. Usually, the application should never have need to invoke this method directly.
Implements CC3Node.
- (void) setParticleSize: | (GLfloat) | aSize | |
at: | (GLuint) | vtxIndex | |
Sets the particle size element at the specified index in the vertex data to the specified value.
The index refers to vertices, not bytes. The implementation takes into consideration the vertexStride and elementOffset properties to access the correct element.
When all vertex changes have been made, be sure to invoke the updateParticleSizesGLBuffer method to ensure that the GL VBO that holds the vertex data is updated.
If the releaseRedundantContent method has been invoked and the underlying vertex data has been released, this method will raise an assertion exception.
You typically do not use this method directly. Instead, use the size property of the individual particle from within your custom CC3PointParticle subclass.
- (void) updateParticleSizesGLBuffer |
Updates the GL engine buffer with the particle size data in this mesh.
For particle emitters, this method is invoked automatically when particles have been updated from within your CC3PointParticle subclass. Usually, the application should never have need to invoke this method directly.
|
readnonatomicretain |
|
readnonatomicassign |
|
readnonatomicassign |
|
readwritenonatomicassign |
|
readnonatomicassign |
Returns the value of the particleSize property.
If the shouldNormalizeParticleSizesToDevice property is set to YES, the returned value will be normalized. For further explanation, see the notes for the shouldNormalizeParticleSizesToDevice property.
|
readnonatomicassign |
Returns the value of the particleSizeMaximum property.
If the shouldNormalizeParticleSizesToDevice property is set to YES, the returned value will be normalized. For further explanation, see the notes for the shouldNormalizeParticleSizesToDevice property.
|
readnonatomicassign |
Returns the value of the particleSizeMinimum property.
If the shouldNormalizeParticleSizesToDevice property is set to YES, the returned value will be normalized. For further explanation, see the notes for the shouldNormalizeParticleSizesToDevice property.
|
readwritenonatomicassign |
If the kCC3VertexContentPointSize component was not specified in the vertexContentTypes property, all particles will be emitted at the same size, as specified by this property.
If the kCC3VertexContentPointSize component was specified, the size of each particle can be individually set during the initialization of that particle. The size of each particle defaults to this value, if not set to something else during its initialization.
The initial value is kCC3DefaultParticleSize.
|
readwritenonatomicassign |
The coefficients of the attenuation function that affects the size of a particle based on its distance from the camera.
The sizes of the particles are attenuated according to the formula 1/sqrt(a + (b * r) + (c * r * r)), where r is the radial distance from the particle to the camera, and a, b and c are the coefficients from this property.
As an alternate to setting this property, you can set the unityScaleDistance property to establish standard proportional distance attenuation.
The initial value of this property is kCC3AttenuationNone, indicating no attenuation with distance.
|
readwritenonatomicassign |
The maxiumum size for point particles.
Particle sizes will not be allowed to grow beyond this value when distance attenuation is engaged.
You can use this property to limit how large particles will become as they approach the camera.
The initial value of this property is kCC3ParticleSizeMaximumNone, indicating that particles will be allowed to grow until clamped by any platform limits.
|
readwritenonatomicassign |
The miniumum size for point particles.
Particle sizes will not be allowed to shrink below this value when distance attenuation is engaged.
You can use this property to limit how small particles will become as they recede from the camera.
The initial value of this property is kCC3ParticleSizeMinimumNone, indicating that particles will be allowed to shrink to one pixel if needed.
|
readwritenonatomicassign |
Indicates whether the particle sizes should be adjusted so that particles appear to be a consistent size across all device screen resolutions.
The 3D camera frustum is consistent across all devices, making the view of the 3D scene consistent across all devices. However, particle size is defined in terms of pixels, and particles will appear larger or smaller. relative to 3D artifacts, on different screen resolutions.
If this property is set to YES, the actual size of each particle, as submitted to the GL engine, will be adjusted so that it appears to be the same size across all devices, relative to the 3D nodes.
If this property is set to NO, the actual size of each particle will be drawn in the same absolute pixel size across all devices, which may make it appear to be smaller or larger, relative to the 3D artifacts around it, on different devices.
The initial value of this property is YES.
|
readwritenonatomicassign |
Indicates whether points should be smoothed (antialiased).
The initial value is NO.
|
readwritenonatomicassign |
The distance from the camera, in 3D space, at which the particle will be displayed at unity scale (its natural size).
The value of this property defines how the apparent size of the particle will change as it moves closer to, or farther from, the camera. If the particle is closer to the camera than this distance, the particle will appear proportionally larger than its natural size, and if the particle is farther away from the camera than this distance, the particle will appear proportionally smaller than its natural size.
The natural size of the particle is expressed in pixels and is set either by the particleSize property of this emitter, or by the size property of the individual particle if the vertexContentTypes property of this emitter includes the kCC3VertexContentPointSize value.
Setting the value of this property to zero indicates that the size of the particles should stay constant, at their natural size, regardless of how far the particle is from the camera.
Setting this property replaces the need to set the value of the particleSizeAttenuation property, which offers a wider range of distance attenuation options, but is more complicated to use.
The initial value of this property is zero, indicating that distance attenuation is not applied, and each particle will appear at its natural size regardless of how far it is from the camera.