Class ExponentialFog


  • public class ExponentialFog
    extends Fog
    The ExponentialFog leaf node extends the Fog leaf node by adding a fog density that is used as the exponent of the fog equation. The density is defined in the local coordinate system of the node, but the actual fog equation will ideally take place in eye coordinates.

    The fog blending factor, f, is computed as follows:

      f = e-(density * z)

      where

        z is the distance from the viewpoint.
        density is the density of the fog.

    In addition to specifying the fog density, ExponentialFog lets you specify the fog color, which is represented by R, G, and B color values, where a color of (0,0,0) represents black.
    • Field Detail

      • ALLOW_DENSITY_READ

        public static final int ALLOW_DENSITY_READ
        Specifies that this ExponentialFog node allows read access to its density information.
        See Also:
        Constant Field Values
      • ALLOW_DENSITY_WRITE

        public static final int ALLOW_DENSITY_WRITE
        Specifies that this ExponentialFog node allows write access to its density information.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ExponentialFog

        public ExponentialFog()
        Constructs an ExponentialFog node with default parameters. The default values are as follows:
          density : 1.0
      • ExponentialFog

        public ExponentialFog​(javax.vecmath.Color3f color)
        Constructs an ExponentialFog node with the specified fog color.
        Parameters:
        color - the fog color
      • ExponentialFog

        public ExponentialFog​(javax.vecmath.Color3f color,
                              float density)
        Constructs an ExponentialFog node with the specified fog color and density.
        Parameters:
        color - the fog color
        density - the density of the fog
      • ExponentialFog

        public ExponentialFog​(float r,
                              float g,
                              float b)
        Constructs an ExponentialFog node with the specified fog color.
        Parameters:
        r - the red component of the fog color
        g - the green component of the fog color
        b - the blue component of the fog color
      • ExponentialFog

        public ExponentialFog​(float r,
                              float g,
                              float b,
                              float density)
        Constructs an ExponentialFog node with the specified fog color and density.
        Parameters:
        r - the red component of the fog color
        g - the green component of the fog color
        b - the blue component of the fog color
        density - the density of the fog
    • Method Detail

      • setDensity

        public void setDensity​(float density)
        Sets fog density.
        Parameters:
        density - the new density of this fog
        Throws:
        CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
      • getDensity

        public float getDensity()
        Gets fog density.
        Returns:
        the density of this fog
        Throws:
        CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph