public class SkyGradientLayer extends AbstractLayer
Note : based on a spherical globe.
Issue : Ellipsoidal globe doesnt match the spherical atmosphere everywhere.
Modifier and Type | Field and Description |
---|---|
protected float[] |
horizonColor |
protected static int |
SLICES |
protected static int |
STACKS |
protected double |
thickness |
protected float[] |
zenithColor |
Constructor and Description |
---|
SkyGradientLayer()
Renders an atmosphere around the globe
|
Modifier and Type | Method and Description |
---|---|
protected void |
applyDrawProjection(DrawContext dc,
OGLStackHandler ogsh) |
protected void |
applyDrawTransform(DrawContext dc,
OGLStackHandler ogsh) |
protected static Vec4 |
CartesianToSpherical(double x,
double y,
double z)
Converts position in cartesian coordinates (XYZ) to spherical (radius, lat, lon) coordinates.
|
void |
doRender(DrawContext dc) |
protected void |
drawSkyDome(DrawContext dc,
float radius,
double startLat,
double endLat,
int slices,
int stacks,
float zenithOpacity,
float gradientBias)
Draws the sky dome
|
double |
getAtmosphereThickness()
Get the atmosphere thickness in meter
|
java.awt.Color |
getHorizonColor()
Get the horizon color
|
java.awt.Color |
getZenithColor()
Get the zenith color
|
void |
setAtmosphereThickness(double thickness)
Set the atmosphere thickness in meter
|
void |
setHorizonColor(java.awt.Color color)
Set the horizon color
|
void |
setZenithColor(java.awt.Color color)
Set the zenith color
|
protected static Vec4 |
SphericalToCartesian(double latitude,
double longitude,
double radius)
Converts position in spherical coordinates (lat/lon/altitude) to cartesian (XYZ) coordinates.
|
java.lang.String |
toString() |
protected void |
updateSkyDome(DrawContext dc) |
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
onMessage, propertyChange
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
protected float[] horizonColor
protected static final int SLICES
protected static final int STACKS
protected double thickness
protected float[] zenithColor
public SkyGradientLayer()
protected void applyDrawProjection(DrawContext dc, OGLStackHandler ogsh)
protected void applyDrawTransform(DrawContext dc, OGLStackHandler ogsh)
protected static Vec4 CartesianToSpherical(double x, double y, double z)
x
- X coordinatey
- Y coordinatez
- Z coordinateVec4
point for the spherical coordinates {radius, lat, lon}public void doRender(DrawContext dc)
doRender
in class AbstractLayer
protected void drawSkyDome(DrawContext dc, float radius, double startLat, double endLat, int slices, int stacks, float zenithOpacity, float gradientBias)
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 of
1
with produce a balanced gradient, a value greater then 1
will
have the zenith color dominate and a value less then 1
will have the opposite
effect.public double getAtmosphereThickness()
public java.awt.Color getHorizonColor()
public java.awt.Color getZenithColor()
public void setAtmosphereThickness(double thickness)
thickness
- the atmosphere thickness in meterpublic void setHorizonColor(java.awt.Color color)
color
- the horizon colorpublic void setZenithColor(java.awt.Color color)
color
- the zenith colorprotected static Vec4 SphericalToCartesian(double latitude, double longitude, double radius)
latitude
- Latitude in decimal degreeslongitude
- Longitude in decimal degreesradius
- Radiuspublic java.lang.String toString()
toString
in class AbstractLayer
protected void updateSkyDome(DrawContext dc)