java.lang.Object
com.luciad.view.lightspeed.services.effects.ALspGraphicsEffect
com.luciad.view.lightspeed.services.effects.TLspFog

public class TLspFog extends ALspGraphicsEffect
Graphics effect which enables fog in a 3D view. Fog provides a basic approximation of the scattering of light in the atmosphere, and can greatly increase the user's perception of depth and scale in a 3D view.

Fog is defined by a color and a visibility distance. This class decreases the amount of fog automatically as the camera gets further away from the Earth (i.e. as it "exits the atmosphere"). Fog is implemented analogous to OpenGL's fixed function fog using the GL_EXP mode. The getDensity() method computes a fog density value based on the altitude of the camera and the visibility distance.

Since:
2013.0
  • Constructor Details

    • TLspFog

      public TLspFog(ILspView aView)
      Creates a new fog effect for the given view.
      Parameters:
      aView - the view in which the fog will be used
  • Method Details

    • getDensity

      public double getDensity()
      Returns the current fog density in the view. The density is derived from the camera position in the view. If the view is 2D, this method always returns zero. In 3D views, the density is computed based on getVisibilityAtMinAltitude() and the altitude of the camera between getMinAltitude() and getMaxAltitude(). The density fades to zero when the camera reaches the maximum altitude.

      Fog is implemented analogous to OpenGL's fixed-function GL_EXP fog mode. This means that for any point in the world, a fog percentage is computed as 1.0 - exp(-d*z), where d is the fog density and z is the distance of the point to the eye.

      Returns:
      the current fog density in the view.
    • getColor

      public Color getColor()
      Returns the fog color.
      Returns:
      the fog color
    • setColor

      public void setColor(Color aColor)
      Sets the fog color.
      Parameters:
      aColor - the new fog color
    • getVisibilityAtMinAltitude

      public double getVisibilityAtMinAltitude()
      Returns the visibility distance when the camera is at or below getMinAltitude(). The distance is measured in world units. The default value is 100 km.
      Returns:
      the minimum visibility distance due to fog
    • setVisibilityAtMinAltitude

      public void setVisibilityAtMinAltitude(double aVisibilityAtMinAltitude)
      Sets the visibility distance used when the camera is at or below getMinAltitude().
      Parameters:
      aVisibilityAtMinAltitude - the minimum visibility distance due to fog
    • getMinAltitude

      public double getMinAltitude()
      Returns the altitude below which visibility due to fog is at its lowest value.
      Returns:
      the altitude below which visibility due to fog is at its lowest value
    • setMinAltitude

      public void setMinAltitude(double aMinAltitude)
      Sets the altitude below which visibility due to fog is at its lowest value.
      Parameters:
      aMinAltitude - the altitude at which minimum visibility is reached
    • getMaxAltitude

      public double getMaxAltitude()
      Returns the altitude above which fog is no longer applied.
      Returns:
      the altitude above which fog is no longer applied
    • setMaxAltitude

      public void setMaxAltitude(double aMaxAltitude)
      Sets the altitude above which fog is no longer applied.
      Parameters:
      aMaxAltitude - the altitude above which fog is no longer applied