Package com.jme3.environment
Class LightProbeFactory
java.lang.Object
com.jme3.environment.LightProbeFactory
Creates LightProbes within a scene, given an EnvironmentCamera.
Since this process can take a long time, you can provide a JobProgressListener that
will be notified of the ongoing generation process when calling the makeProbe method.
The process is as follows:
1. Create an EnvironmentCamera
2. give it a position in the scene
3. call
makeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial)
4. add the created LightProbe to a node with the Spatial.addLight(com.jme3.light.Light)
method.
Optionally for step 3 call
makeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial, com.jme3.environment.generation.JobProgressListener)
with a JobProgressListener
to be notified of the progress of the generation process.
The generation will be split in several threads for faster generation.
This class is entirely thread safe and can be called from any thread.
Note that in case you are using a JobProgressListener
, all its
methods will be called inside an app.enqueue callable.
This means that it's completely safe to modify the scenegraph within the
Listener method, but also means that the event will be delayed until next update loop.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Node
getDebugGui
(AssetManager manager, LightProbe probe) For debugging purposes only.static LightProbe
makeProbe
(EnvironmentCamera envCam, Spatial scene) Creates a LightProbe with the giver EnvironmentCamera in the given scene.static LightProbe
makeProbe
(EnvironmentCamera envCam, Spatial scene, JobProgressListener<LightProbe> listener) static LightProbe
makeProbe
(EnvironmentCamera envCam, Spatial scene, EnvMapUtils.GenerationType genType, JobProgressListener<LightProbe> listener) Creates a LightProbe with the giver EnvironmentCamera in the given scene.static LightProbe
updateProbe
(LightProbe probe, EnvironmentCamera envCam, Spatial scene, JobProgressListener<LightProbe> listener) static LightProbe
updateProbe
(LightProbe probe, EnvironmentCamera envCam, Spatial scene, EnvMapUtils.GenerationType genType, JobProgressListener<LightProbe> listener) Updates a LightProbe with the given EnvironmentCamera in the given scene.
-
Method Details
-
makeProbe
Creates a LightProbe with the giver EnvironmentCamera in the given scene. Note that this is an asynchronous process that will run on multiple threads. The process is thread safe. The created lightProbe will only be marked as ready when the rendering process is done. If you want to monitor the process usemakeProbe(com.jme3.environment.EnvironmentCamera, com.jme3.scene.Spatial, com.jme3.environment.generation.JobProgressListener)
- Parameters:
envCam
- the EnvironmentCamerascene
- the Scene- Returns:
- the created LightProbe
- See Also:
-
makeProbe
public static LightProbe makeProbe(EnvironmentCamera envCam, Spatial scene, EnvMapUtils.GenerationType genType, JobProgressListener<LightProbe> listener) Creates a LightProbe with the giver EnvironmentCamera in the given scene. Note that this is an asynchronous process that will run on multiple threads. The process is thread safe. The created lightProbe will only be marked as ready when the rendering process is done. The JobProgressListener will be notified of the progress of the generation. Note that you can also use aJobProgressAdapter
.- Parameters:
envCam
- the EnvironmentCamerascene
- the ScenegenType
- Fast or HighQuality. Fast may be ok for many types of environment, but you may need high quality when an environment map has very high lighting values.listener
- the listener of the generation progress.- Returns:
- the created LightProbe
- See Also:
-
makeProbe
public static LightProbe makeProbe(EnvironmentCamera envCam, Spatial scene, JobProgressListener<LightProbe> listener) -
updateProbe
public static LightProbe updateProbe(LightProbe probe, EnvironmentCamera envCam, Spatial scene, EnvMapUtils.GenerationType genType, JobProgressListener<LightProbe> listener) Updates a LightProbe with the given EnvironmentCamera in the given scene.Note that this is an asynchronous process that will run on multiple threads. The process is thread safe. The created lightProbe will only be marked as ready when the rendering process is done.
The JobProgressListener will be notified of the progress of the generation. Note that you can also use a
JobProgressAdapter
.- Parameters:
probe
- the Light probe to updateenvCam
- the EnvironmentCamerascene
- the ScenegenType
- Fast or HighQuality. Fast may be ok for many types of environment, but you may need high quality when an environment map has very high lighting values.listener
- the listener of the generation progress.- Returns:
- the created LightProbe
- See Also:
-
updateProbe
public static LightProbe updateProbe(LightProbe probe, EnvironmentCamera envCam, Spatial scene, JobProgressListener<LightProbe> listener) -
getDebugGui
For debugging purposes only. Will return a Node meant to be added to a GUI presenting the 2 cube maps in a cross pattern with all the mip maps.- Parameters:
manager
- the asset managerprobe
- the LightProbe to be debugged (not null)- Returns:
- a debug node
-