Public Member Functions | Static Public Member Functions | Properties

CC3Fog Class Reference

CC3Fog controls fog in the 3D scene. More...

#import <CC3Fog.h>

List of all members.

Public Member Functions

(void) - draw
(CCAction *) - getActionByTag:
(NSInteger) - numberOfRunningActions
(void) - pauseAllActions
(void) - populateFrom:
(void) - resumeAllActions
(CCAction *) - runAction:
(CCAction *) - runAction:withTag:
(void) - stopAction:
(void) - stopActionByTag:
(void) - stopAllActions
(void) - unbind
(void) - update:

Static Public Member Functions

(id) + fog
(void) + unbind

Properties

GLenum attenuationMode
GLfloat density
GLfloat endDistance
ccColor4F floatColor
BOOL isRunning: 1
GLenum performanceHint
GLfloat startDistance
BOOL visible: 1

Detailed Description

CC3Fog controls fog in the 3D scene.

Fog color is controlled by the floatColor property, or via support for the CCRGBAProtocol protocol. However, be aware that alpha channels and opacity info are ignored by the OpenGL implementation of fog effects. See the notes of the color property for more info.

The style of attenuation imposed by the fog is set by the attenuationMode property. See the notes of that property for information about how fog attenuates visibility.

Using the performanceHint property, you can direct the GL engine to trade off between faster or nicer rendering quality.


Member Function Documentation

- (void) draw

If the visible property is set to YES, draws the fog to the GL engine.

+ (id) fog

Allocates and initializes an autoreleased instance.

- (CCAction*) getActionByTag: (NSInteger)  tag

Returns the action with the specified tag running on this fog.

- (NSInteger) numberOfRunningActions

Returns the numbers of actions that are running plus the ones that are scheduled to run (actions in actionsToAdd and actions arrays).

Composable actions are counted as 1 action. Example: If you are running 1 Sequence of 7 actions, it will return 1. If you are running 7 Sequences of 2 actions, it will return 7.

- (void) pauseAllActions

Pauses all actions running on this fog.

- (void) populateFrom: (CC3Fog *)  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) resumeAllActions

Resumes all actions running on this fog.

- (CCAction*) runAction: (CCAction *)  action

Starts the specified action, and returns that action.

This fog becomes the action's target.

- (CCAction*) runAction: (CCAction *)  action
withTag: (NSInteger)  tag 

Stops any existing action on this fog that had previously been assigned the specified tag, assigns the tag to the specified new action, starts that new action, returns it.

This fog becomes the action's target.

When using this method, you can use the CC3ActionTag enumeration as a convenience for consistently assigning tags by action type.

- (void) stopAction: (CCAction *)  action

Stops and removes the specified action on this fog.

- (void) stopActionByTag: (NSInteger)  tag

Stops and removes the action with the specified tag from this fog.

- (void) stopAllActions

Stops and removes all actions on this fog.

- (void) unbind

Disables the rendering of fog in the GL engine.

+ (void) unbind

Disables the rendering of fog in the GL engine.

- (void) update: (ccTime)  dt

This method is invoked periodically when the fog is to be updated.

Typcially this method is invoked automatically from the CC3Scene instance via a scheduled update, but may also be invoked by some other periodic operation, or even directly by the application.

This method is invoked asynchronously to the frame rendering animation loop, to keep the processing of model updates separate from OpenGL ES drawing.

The dt argument gives the interval, in seconds, since the previous update. This value can be used to create realistic real-time motion that is independent of specific frame or update rates.

If this instance is not running, as indicated by the isRunning property, this method does nothing.

As implemented, this method does nothing. Subclasses may override.

This method is invoked automatically at each scheduled update. Usually, the application never needs to invoke this method directly.


Property Documentation

- (GLenum) attenuationMode [read, write, assign]

Indicates how the fog attenuates visibility with distance.

The value of this property must be one of the following sybolic constants: GL_LINEAR, GL_EXP or GL_EXP2.

When the value of this property is GL_LINEAR, the relative visibility of an object in the fog will be determined by the linear function ((e - z) / (e - s)), where s is the value of the start property, e is the value of the end property, and z is the distance of the object from the camera

When the value of this property is GL_EXP, the relative visibility of an object in the fog will be determined by the exponential function e^(-(d - z)), where d is the value of the density property and z is the distance of the object from the camera.

When the value of this property is GL_EXP2, the relative visibility of an object in the fog will be determined by the exponential function e^(-(d - z)^2), where d is the value of the density property and z is the distance of the object from the camera.

The initial value of this property is GL_EXP2.

- (GLfloat) density [read, write, assign]

The density value used in the exponential functions.

This property is only used when the attenuationMode property is set to GL_EXP or GL_EXP2.

See the description of the attenuationMode for a discussion of how the exponential functions determine visibility.

The initial value of this property is 1.0.

- (GLfloat) endDistance [read, write, assign]

The distance from the camera, at which linear attenuation ends.

Objects between this distance and the far clipping plane of the camera will be completely obscured.

This property is only used when the attenuationMode property is set to GL_LINEAR.

See the description of the attenuationMode for a discussion of how the linear function determine visibility.

The initial value of this property is 1.0.

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

The color of the fog.

CC3Fog also supports the CCRGBAProtocol protocol, allowing the color of the fog to be manipulated by the CCTint interval action.

Although this color value, and the CCRGBAProtocol protocol support setting opacity, fog in OpenGL ES does not make use of opacity information, so any changes to the alpha channel of this property, or to the opacity property will be ignored.

The initial value of this property is kCCC4FBlack.

- (BOOL) isRunning [read, write, assign]

Indicates whether the dynamic behaviour of this fog is enabled.

Setting this property affects both internal activities driven by the update process, and any CCActions controlling this fog. Setting this property to NO will effectively pause all update and CCAction behaviour on the fog. Setting this property to YES will effectively resume the update and CCAction behaviour.

- (GLenum) performanceHint [read, write, assign]

Indicates how the GL engine should trade off between rendering quality and speed.

The value of this property should be one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE.

The initial value of this property is GL_DONT_CARE.

- (GLfloat) startDistance [read, write, assign]

The distance from the camera, at which linear attenuation starts.

Objects between this distance and the near clipping plane of the camera will be completly visible.

This property is only used when the attenuationMode property is set to GL_LINEAR.

See the description of the attenuationMode for a discussion of how the linear function determine visibility.

The initial value of this property is 0.0.

- (BOOL) visible [read, write, assign]

Controls whether the fog should be drawn into the scene.

The initial value of this property is YES.


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