Class LightEffect
- All Implemented Interfaces:
AutoCloseable
You cannot create a LightEffect. Instead, retrieve it from GraphicsEffects#getLight.
A map has exactly one light, described by an immutable LightModel: a HeadlightModel, DirectionalLightModel or SunlightModel. Read the active light with getModel and change it by building a new light and passing it to setModel.
By default a map uses a HeadlightModel, meaning 3D assets are shaded even when the application configures no light explicitly. Disable lighting with setEnabled; the configured light is kept and restored when the effect is enabled again.
- Since:
- 2026.1
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidfinalize()getModel()Returns the light model.booleanReturns whether lighting is enabled.voidsetEnabled(boolean enabled) Sets whether lighting is enabled.voidsetModel(LightModel model) Sets the light model.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
isEnabled
public boolean isEnabled()Returns whether lighting is enabled.- Returns:
- whether lighting is enabled.
-
setEnabled
public void setEnabled(boolean enabled) Sets whether lighting is enabled.Disabling it turns off lighting on the map while keeping the configured light, which is restored when lighting is enabled again. The default is
true.- Parameters:
enabled- true to enable lighting or false to disable it.
-
getModel
Returns the light model.- Returns:
- the light model.
-
setModel
Sets the light model.The default is a
HeadlightModelwith default parameters.- Parameters:
model- the light model.- Throws:
NullPointerException- when the model is anullvalue.
-