Inherits from CC3MeshNode : CC3LocalContentNode : CC3Node : CC3Identifiable : NSObject
Declared in CC3UtilityMeshNodes.h

Overview

CC3Fog is a mesh node that can render fog in the 3D scene.

Typically, instances of this class are not generally used within the node assembly of a scene. Instead, a single instance of this class is used in the fog property of the CC3Scene.

Fog color is controlled by the diffuseColor property.

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.

Under OpenGL ES 1.1, fog is implemented as a direct feature of the GL engine, and this class establishes the GL state for that fog.

Under OpenGL versions that support GLSL, fog is rendered as a post-processing effect, typically by rendering the scene to a surface that has both color and depth textures. Add the color and depth textures from the scene-rendering surface to this node, and a shader program that can render the node in clip-space, and provide fog effects. A good choice is the combination of the CC3ClipSpaceTexturable.vsh vertex shader and the CC3Fog.fsh fragment shader.

Properties

__deprecated

@deprecated Use diffuseColor property instead.

@property (nonatomic, assign) ccColor4F floatColor __deprecated

Declared In

CC3UtilityMeshNodes.h

attenuationMode

Indicates how the fog attenuates visibility with distance.

@property (nonatomic, assign) GLenum attenuationMode

Discussion

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.

Declared In

CC3UtilityMeshNodes.h

density

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.

@property (nonatomic, assign) GLfloat density

Discussion

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.

Declared In

CC3UtilityMeshNodes.h

endDistance

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.

@property (nonatomic, assign) GLfloat endDistance

Discussion

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.

Declared In

CC3UtilityMeshNodes.h

performanceHint

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.

@property (nonatomic, assign) GLenum performanceHint

Discussion

The initial value of this property is GL_DONT_CARE.

Declared In

CC3UtilityMeshNodes.h

startDistance

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.

@property (nonatomic, assign) GLfloat startDistance

Discussion

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.

Declared In

CC3UtilityMeshNodes.h

Class Methods

fog

Allocates and initializes an autoreleased instance.

+ (id)fog

Declared In

CC3UtilityMeshNodes.h

Instance Methods

update:

@deprecated Use CCActions to control the fog characteristics.

- (void)update:(CCTime)dt

Declared In

CC3UtilityMeshNodes.h