Class TLspFog
java.lang.Object
com.luciad.view.lightspeed.services.effects.ALspGraphicsEffect
com.luciad.view.lightspeed.services.effects.TLspFog
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetColor()
Returns the fog color.double
Returns the current fog density in the view.double
Returns the altitude above which fog is no longer applied.double
Returns the altitude below which visibility due to fog is at its lowest value.double
Returns the visibility distance when the camera is at or belowgetMinAltitude()
.void
Sets the fog color.void
setMaxAltitude
(double aMaxAltitude) Sets the altitude above which fog is no longer applied.void
setMinAltitude
(double aMinAltitude) Sets the altitude below which visibility due to fog is at its lowest value.void
setVisibilityAtMinAltitude
(double aVisibilityAtMinAltitude) Sets the visibility distance used when the camera is at or belowgetMinAltitude()
.Methods inherited from class com.luciad.view.lightspeed.services.effects.ALspGraphicsEffect
addPropertyChangeListener, equals, firePropertyChange, hashCode, isEnabled, removePropertyChangeListener, setEnabled
-
Constructor Details
-
TLspFog
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 ongetVisibilityAtMinAltitude()
and the altitude of the camera betweengetMinAltitude()
andgetMaxAltitude()
. The density fades to zero when the camera reaches the maximum altitude. Fog is implemented analogous to OpenGL's fixed-functionGL_EXP
fog mode. This means that for any point in the world, a fog percentage is computed as1.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
Returns the fog color.- Returns:
- the fog color
-
setColor
Sets the fog color.- Parameters:
aColor
- the new fog color
-
getVisibilityAtMinAltitude
public double getVisibilityAtMinAltitude()Returns the visibility distance when the camera is at or belowgetMinAltitude()
. 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 belowgetMinAltitude()
.- 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
-