Class AtmosphereEffect
- All Implemented Interfaces:
AutoCloseable
The effect is enabled by default, but it is only applied to a 3D view. On a 2D view it has no visible effect.
The atmosphere is described by an immutable AtmosphereModel, of which there are two:
GradientAtmosphereModel(the default) draws a simple sky/horizon color gradient around the globe.ScatteringAtmosphereModeldraws a physically based Rayleigh/Mie scattering sky. It requires a geocentric 3D view and a light configured throughGraphicsEffects#getLight. Without both, it falls back to the gradient. Rendering it has a minor additional performance cost compared to the gradient model.
|
|
|
|
The atmosphere describes the planet's sky and, optionally, tints distant terrain so it fades into the sky with distance (an effect known as aerial perspective). That tinting is physically derived from the sun position and the air, so it is realistic but not directly adjustable. If you want to control haze yourself, and set its color and the distance at which things fade from view, use FogEffect instead. See the map effects article for guidance on choosing between the two.
Read the active model with getModel and narrow it to its concrete type, and change it by building a new model and passing it to setModel.
You cannot create an AtmosphereEffect. Instead, you can retrieve it from GraphicsEffects#getAtmosphere.
- Since:
- 2023.1
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidfinalize()getModel()Returns the atmosphere model.booleanReturns whether the atmosphere effect is enabled.voidsetEnabled(boolean enabled) Sets whether the atmosphere effect is enabled.voidsetModel(AtmosphereModel model) Sets the atmosphere model.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
isEnabled
public boolean isEnabled()Returns whether the atmosphere effect is enabled.- Returns:
- whether the atmosphere effect is enabled.
-
setEnabled
public void setEnabled(boolean enabled) Sets whether the atmosphere effect is enabled.The default is
true.- Parameters:
enabled- true to enable the atmosphere effect or false to disable it.
-
getModel
Returns the atmosphere model.- Returns:
- the atmosphere model.
- Since:
- 2026.1
-
setModel
Sets the atmosphere model.The default is a
GradientAtmosphereModelwith default parameters.- Parameters:
model- the atmosphere model.- Throws:
NullPointerException- when the model is anullvalue.- Since:
- 2026.1
-