Package gov.nasa.worldwind.layers
Class SkyGradientLayer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.layers.AbstractLayer
-
- gov.nasa.worldwind.layers.SkyGradientLayer
-
- All Implemented Interfaces:
AVList,Disposable,MessageListener,Layer,Restorable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class SkyGradientLayer extends AbstractLayer
Renders an atmosphere around the globe and a sky dome at low altitude.Note : based on a spherical globe.
Issue : Ellipsoidal globe doesnt match the spherical atmosphere everywhere.
-
-
Field Summary
Fields Modifier and Type Field Description protected float[]horizonColorprotected static intSLICESprotected static intSTACKSprotected doublethicknessprotected float[]zenithColor
-
Constructor Summary
Constructors Constructor Description SkyGradientLayer()Renders an atmosphere around the globe
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyDrawProjection(DrawContext dc, OGLStackHandler ogsh)protected voidapplyDrawTransform(DrawContext dc, OGLStackHandler ogsh)protected static Vec4CartesianToSpherical(double x, double y, double z)Converts position in cartesian coordinates (XYZ) to spherical (radius, lat, lon) coordinates.voiddoRender(DrawContext dc)protected voiddrawSkyDome(DrawContext dc, float radius, double startLat, double endLat, int slices, int stacks, float zenithOpacity, float gradientBias)Draws the sky domedoublegetAtmosphereThickness()Get the atmosphere thickness in meterjava.awt.ColorgetHorizonColor()Get the horizon colorjava.awt.ColorgetZenithColor()Get the zenith colorvoidsetAtmosphereThickness(double thickness)Set the atmosphere thickness in metervoidsetHorizonColor(java.awt.Color color)Set the horizon colorvoidsetZenithColor(java.awt.Color color)Set the zenith colorprotected static Vec4SphericalToCartesian(double latitude, double longitude, double radius)Converts position in spherical coordinates (lat/lon/altitude) to cartesian (XYZ) coordinates.java.lang.StringtoString()protected voidupdateSkyDome(DrawContext dc)-
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
createLayerConfigElements, dispose, doPick, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getOpacity, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setOpacity, setPickEnabled, setScreenCredit
-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
STACKS
protected static final int STACKS
- See Also:
- Constant Field Values
-
SLICES
protected static final int SLICES
- See Also:
- Constant Field Values
-
thickness
protected double thickness
-
horizonColor
protected float[] horizonColor
-
zenithColor
protected float[] zenithColor
-
-
Method Detail
-
getAtmosphereThickness
public double getAtmosphereThickness()
Get the atmosphere thickness in meter- Returns:
- the atmosphere thickness in meter
-
setAtmosphereThickness
public void setAtmosphereThickness(double thickness)
Set the atmosphere thickness in meter- Parameters:
thickness- the atmosphere thickness in meter
-
getHorizonColor
public java.awt.Color getHorizonColor()
Get the horizon color- Returns:
- the horizon color
-
setHorizonColor
public void setHorizonColor(java.awt.Color color)
Set the horizon color- Parameters:
color- the horizon color
-
getZenithColor
public java.awt.Color getZenithColor()
Get the zenith color- Returns:
- the zenith color
-
setZenithColor
public void setZenithColor(java.awt.Color color)
Set the zenith color- Parameters:
color- the zenith color
-
doRender
public void doRender(DrawContext dc)
- Specified by:
doRenderin classAbstractLayer
-
applyDrawTransform
protected void applyDrawTransform(DrawContext dc, OGLStackHandler ogsh)
-
applyDrawProjection
protected void applyDrawProjection(DrawContext dc, OGLStackHandler ogsh)
-
updateSkyDome
protected void updateSkyDome(DrawContext dc)
-
drawSkyDome
protected void drawSkyDome(DrawContext dc, float radius, double startLat, double endLat, int slices, int stacks, float zenithOpacity, float gradientBias)
Draws the sky dome- Parameters:
dc- the current DrawContextradius- the sky dome radiusstartLat- the horizon latitudeendLat- the zenith latitudeslices- the number of slices - vertical divisionsstacks- the nuber os stacks - horizontal divisionszenithOpacity- the sky opacity at zenithgradientBias- determines how fast the sky goes from the horizon color to the zenith color. A value of1with produce a balanced gradient, a value greater then1will have the zenith color dominate and a value less then1will have the opposite effect.
-
SphericalToCartesian
protected static Vec4 SphericalToCartesian(double latitude, double longitude, double radius)
Converts position in spherical coordinates (lat/lon/altitude) to cartesian (XYZ) coordinates.- Parameters:
latitude- Latitude in decimal degreeslongitude- Longitude in decimal degreesradius- Radius- Returns:
- the corresponding Point
-
CartesianToSpherical
protected static Vec4 CartesianToSpherical(double x, double y, double z)
Converts position in cartesian coordinates (XYZ) to spherical (radius, lat, lon) coordinates.- Parameters:
x- X coordinatey- Y coordinatez- Z coordinate- Returns:
- a
Vec4point for the spherical coordinates {radius, lat, lon}
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractLayer
-
-