Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Types | Public Member Functions | Static Public Member Functions
Fog Class Reference

Specifies how atmospheric fog effects are applied to geometry. More...

Inheritance diagram for Fog:
PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject

List of all members.

Public Types

enum  Mode { MLinear = 0, MExponential = 1, MExponentialSquared = 2 }

Public Member Functions

 Fog (string name)
VBase4 const getColor ()
 Returns the color of the fog.
float getExpDensity ()
 Returns the density of the fog for exponential calculations.
Point3 const getLinearOnsetPoint ()
 Returns the point in space at which the fog begins.
Point3 const getLinearOpaquePoint ()
 Returns the point in space at which the fog completely obscures geometry.
Mode getMode ()
 setColor (VBase4 const color)
 Sets the color of the fog.
 setColor (float r, float g, float b)
 Sets the color of the fog.
 setExpDensity (float exp_density)
 Sets the density of the fog for exponential calculations.
 setLinearFallback (float angle, float onset, float opaque)
 Fog effects are traditionally defined in camera-relative space, but the Panda Fog node has a special mode in which it can define a linear fog effect in an arbitrary coordinate space.
 setLinearOnsetPoint (Point3 const linear_onset_point)
 Specifies the point in space at which the fog begins.
 setLinearOnsetPoint (float x, float y, float z)
 Specifies the point in space at which the fog begins.
 setLinearOpaquePoint (Point3 const linear_opaque_point)
 Specifies the point in space at which the fog completely obscures geometry.
 setLinearOpaquePoint (float x, float y, float z)
 Specifies the point in space at which the fog completely obscures geometry.
 setLinearRange (float onset, float opaque)
 Specifies the effects of the fog in linear distance units.
 setMode (Mode mode)
 Specifies the computation that is used to determine the fog effect.

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

Specifies how atmospheric fog effects are applied to geometry.

The Fog object is now a PandaNode, which means it can be used similarly to a Light to define effects relative to a particular coordinate system within the scene graph.

In exponential mode, the fog effects are always camera-relative, and it does not matter where the Fog node is parented. However, in linear mode, the onset and opaque distances are defined as offsets along the local forward axis (e.g. the Y axis). This allows the fog effect to be localized to a particular region in space, rather than always camera-relative. If the fog object is not parented to any node, it is used to generate traditonal camera-relative fog, as if it were parented to the camera.


Member Enumeration Documentation

enum Mode
Enumerator:
MLinear 
MExponential 
MExponentialSquared 

Constructor & Destructor Documentation

Fog ( string  name)

Member Function Documentation

static TypeHandle getClassType ( ) [static]

Reimplemented from PandaNode.

VBase4 const getColor ( )

Returns the color of the fog.

float getExpDensity ( )

Returns the density of the fog for exponential calculations.

This is only used if the mode is not M_linear.

Returns the point in space at which the fog begins.

This is only used if the mode is M_linear.

Returns the point in space at which the fog completely obscures geometry.

This is only used if the mode is M_linear.

setColor ( VBase4 const  color)

Sets the color of the fog.

The alpha component is not used.

setColor ( float  r,
float  g,
float  b 
)

Sets the color of the fog.

setExpDensity ( float  exp_density)

Sets the density of the fog for exponential calculations.

This is only used if the mode is not M_linear.

If the mode is currently set to M_linear, this function implicitly sets it to M_exponential.

setLinearFallback ( float  angle,
float  onset,
float  opaque 
)

Fog effects are traditionally defined in camera-relative space, but the Panda Fog node has a special mode in which it can define a linear fog effect in an arbitrary coordinate space.

This is done by specifying 3-d onset and opaque points, and parenting the Fog object somewhere within the scene graph. In this mode, the fog will be rendered as if it extended along the vector from the onset point to the opaque point, in 3-d space.

However, the underlying fog effect supported by hardware is generally only one-dimensional, and must be rendered based on linear distance from the camera plane. Thus, this in-the-world effect is most effective when the fog vector from onset point to opaque point is most nearly parallel to the camera's eye vector.

As the angle between the fog vector and the eye vector increases, the accuracy of the effect diminishes, up to a complete breakdown of the effect at a 90 degree angle.

This function exists to define the workaround to this problem. The linear fallback parameters given here specify how the fog should be rendered when the parameters are exceeded in this way.

The angle parameter is the minimum angle, in degrees, of the fog vector to the eye vector, at which the fallback effect should be employed. The onset and opaque parameters specify the camera-relative onset and opaque distances to pass to the rendering hardware when employing the fallback effect. This supercedes the 3-d onset point and opaque points.

setLinearOnsetPoint ( Point3 const  linear_onset_point)

Specifies the point in space at which the fog begins.

This is only used if the mode is M_linear.

setLinearOnsetPoint ( float  x,
float  y,
float  z 
)

Specifies the point in space at which the fog begins.

This is only used if the mode is M_linear.

setLinearOpaquePoint ( Point3 const  linear_opaque_point)

Specifies the point in space at which the fog completely obscures geometry.

This is only used if the mode is M_linear.

setLinearOpaquePoint ( float  x,
float  y,
float  z 
)

Specifies the point in space at which the fog completely obscures geometry.

This is only used if the mode is M_linear.

setLinearRange ( float  onset,
float  opaque 
)

Specifies the effects of the fog in linear distance units.

This is only used if the mode is M_linear.

This specifies a fog that begins at distance onset units from the origin, and becomes totally opaque at distance opaque units from the origin, along the forward axis (usually Y).

This function also implicitly sets the mode the M_linear, if it is not already set.

setMode ( Mode  mode)

Specifies the computation that is used to determine the fog effect.

If this is M_linear, then the fog will range from linearly from the onset point to the opaque point (or for the distances specified in set_linear_range), and the fog object should be parented into the scene graph, or to the camera.

If this is anything else, the onset point and opaque point are not used, and the fog effect is based on the value specified to set_exp_density(), and it doesn't matter to which node the fog object is parented, or if it is parented anywhere at all.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties