Class LightEffect

java.lang.Object
com.luciad.maps.effects.LightEffect
All Implemented Interfaces:
AutoCloseable

public final class LightEffect extends Object implements AutoCloseable
Controls the light that is used to shade a map in 3D.

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 Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • 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

      @NotNull public LightModel getModel()
      Returns the light model.
      Returns:
      the light model.
    • setModel

      public void setModel(@NotNull LightModel model) throws NullPointerException
      Sets the light model.

      The default is a HeadlightModel with default parameters.

      Parameters:
      model - the light model.
      Throws:
      NullPointerException - when the model is a null value.