Package jme3utilities

Class MyLight

java.lang.Object
jme3utilities.MyLight

public final class MyLight extends Object
Utility methods for lights.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    clearLocalLights(com.jme3.scene.Spatial spatial)
    Remove all local lights from the specified Spatial.
    static <T extends com.jme3.light.Light>
    int
    countLights(com.jme3.scene.Spatial subtree, Class<T> lightType)
    Count all lights of the specified type in the specified subtree of a scene graph.
    static String
    describeType(com.jme3.light.Light light)
    Describe the type of a light.
    static int
    findIndex(com.jme3.light.Light light, com.jme3.scene.Spatial owner)
    Find the index of the specified light in the specified spatial.
    static com.jme3.light.Light
    findLight(String lightName, com.jme3.scene.Spatial subtree)
    Find the first instance of a light with the specified name in the specified subtree.
    static com.jme3.scene.Spatial
    findOwner(com.jme3.light.Light light, com.jme3.scene.Spatial subtree)
    Find the spatial that owns the specified light in the specified subtree of the scene graph.
    static <T extends com.jme3.light.Light>
    List<T>
    listLights(com.jme3.scene.Spatial subtree, Class<T> lightType, List<T> storeResult)
    Enumerate all lights of the specified type in the specified subtree of a scene graph.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • clearLocalLights

      public static void clearLocalLights(com.jme3.scene.Spatial spatial)
      Remove all local lights from the specified Spatial.
      Parameters:
      spatial - (not null, modified)
    • countLights

      public static <T extends com.jme3.light.Light> int countLights(com.jme3.scene.Spatial subtree, Class<T> lightType)
      Count all lights of the specified type in the specified subtree of a scene graph. Note: recursive!
      Type Parameters:
      T - subclass of Light
      Parameters:
      subtree - subtree to traverse (may be null, unaffected)
      lightType - the subclass of Light to search for
      Returns:
      number of lights controls found (≥0)
    • describeType

      public static String describeType(com.jme3.light.Light light)
      Describe the type of a light.
      Parameters:
      light - instance to describe (not null, unaffected)
      Returns:
      description (not null)
    • findIndex

      public static int findIndex(com.jme3.light.Light light, com.jme3.scene.Spatial owner)
      Find the index of the specified light in the specified spatial.
      Parameters:
      light - light to find (not null, unaffected)
      owner - where the light was added (not null, unaffected)
      Returns:
      index (≥0) or -1 if not found
    • findLight

      public static com.jme3.light.Light findLight(String lightName, com.jme3.scene.Spatial subtree)
      Find the first instance of a light with the specified name in the specified subtree. Note: recursive!
      Parameters:
      lightName - light name to find (not null, unaffected)
      subtree - subtree to traverse (may be null, unaffected)
      Returns:
      a pre-existing instance, or null if none found
    • findOwner

      public static com.jme3.scene.Spatial findOwner(com.jme3.light.Light light, com.jme3.scene.Spatial subtree)
      Find the spatial that owns the specified light in the specified subtree of the scene graph. Note: recursive!
      Parameters:
      light - which light to search for (not null, unaffected)
      subtree - which subtree to search (not null, unaffected)
      Returns:
      the pre-existing spatial, or null if none found
    • listLights

      public static <T extends com.jme3.light.Light> List<T> listLights(com.jme3.scene.Spatial subtree, Class<T> lightType, List<T> storeResult)
      Enumerate all lights of the specified type in the specified subtree of a scene graph. Note: recursive!
      Type Parameters:
      T - subclass of Light
      Parameters:
      subtree - (not null, aliases created)
      lightType - the subclass of Light to search for
      storeResult - storage for results (added to if not null)
      Returns:
      an expanded list (either storeResult or a new instance)