Package jme3utilities
Class MyLight
java.lang.Object
jme3utilities.MyLight
Utility methods for lights.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclearLocalLights(com.jme3.scene.Spatial spatial) Remove all local lights from the specified Spatial.static <T extends com.jme3.light.Light>
intcountLights(com.jme3.scene.Spatial subtree, Class<T> lightType) Count all lights of the specified type in the specified subtree of a scene graph.static StringdescribeType(com.jme3.light.Light light) Describe the type of a light.static intfindIndex(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.LightFind the first instance of a light with the specified name in the specified subtree.static com.jme3.scene.SpatialfindOwner(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.
-
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
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
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 forstoreResult- storage for results (added to if not null)- Returns:
- an expanded list (either storeResult or a new instance)
-