Package com.jme3.environment
Class EnvironmentCamera
java.lang.Object
com.jme3.app.state.BaseAppState
com.jme3.environment.EnvironmentCamera
- All Implemented Interfaces:
- AppState
A 360 camera that can capture a cube map of a scene, and then generate the
 Prefiltered Environment cube Map and the Irradiance cube Map needed for PBR
 indirect lighting
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classAn inner class to keep track on a snapshot job.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static Vector3f[]protected static Vector3f[]protected static Vector3f[]protected ColorRGBAprotected ByteBuffer[]protected FrameBuffer[]protected Image.Formatprotected Image[]protected Vector3fprotected intThe size of environment cameras.protected ViewPort[]
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an EnvironmentCamera with a size of 256EnvironmentCamera(int size) Creates an EnvironmentCamera with the given size.EnvironmentCamera(int size, Vector3f position) Creates an EnvironmentCamera with the given size, and the given positionEnvironmentCamera(int size, Vector3f position, Image.Format imageFormat) Creates an EnvironmentCamera with the given size, and the given position
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcleanup(Application app) Called after the app state is detached or during application shutdown if the state is still attached.protected CameracreateOffCamera(int mapSize, Vector3f worldPos, Vector3f axisX, Vector3f axisY, Vector3f axisZ) Creates an off cameraprotected FrameBuffercreateOffScreenFrameBuffer(int mapSize, ViewPort offView) create an offscreen frame buffer.protected ViewPortcreateOffViewPort(String name, Camera offCamera) creates an off-screen VPreturns the images format used for the generated maps.intgetSize()Gets the size of environment cameras.ViewPort[]Returns an array of the 6 ViewPorts used to capture the snapshot.protected voidinitialize(Application app) Called during initialization once the app state is attached and before onEnable() is called.booleanisBusy()Test whether this EnvironmentCamera is busy.protected voidCalled when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.protected voidonEnable()Called when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.protected voidrebuild()Rebuild all environment cameras.voidrender(RenderManager renderManager) Render the state.voidsetBackGroundColor(ColorRGBA bgColor) Alter the background color of an initialized EnvironmentCamera.voidsetPosition(Vector3f position) Sets the camera position in world space.voidsetSize(int size) Sets the size of environment cameras and rebuild this state if it was initialized.voidsnapshot(Spatial scene, JobProgressListener<TextureCubeMap> done) Takes a snapshot of the surrounding scene.Methods inherited from class com.jme3.app.state.BaseAppStatecleanup, getApplication, getId, getState, getState, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, setEnabled, setId, stateAttached, stateDetached, update
- 
Field Details- 
axisX
- 
axisY
- 
axisZ
- 
imageFormat
- 
debugEnv
- 
images
- 
viewports
- 
framebuffers
- 
buffers
- 
position
- 
backGroundColor
- 
sizeprotected int sizeThe size of environment cameras.
 
- 
- 
Constructor Details- 
EnvironmentCamerapublic EnvironmentCamera()Creates an EnvironmentCamera with a size of 256
- 
EnvironmentCamerapublic EnvironmentCamera(int size) Creates an EnvironmentCamera with the given size.- Parameters:
- size- the size of the resulting texture.
 
- 
EnvironmentCameraCreates an EnvironmentCamera with the given size, and the given position- Parameters:
- size- the size of the resulting texture.
- position- the position of the camera.
 
- 
EnvironmentCameraCreates an EnvironmentCamera with the given size, and the given position- Parameters:
- size- the size of the resulting texture, and the given ImageFormat.
- position- the position of the camera.
- imageFormat- the ImageFormat to use for the resulting texture.
 
 
- 
- 
Method Details- 
snapshotTakes a snapshot of the surrounding scene.- Parameters:
- scene- the scene to snapshot.
- done- a callback to call when the snapshot is done.
 
- 
renderDescription copied from interface:AppStateRender the state. This method will be called every render pass if theAppStateis both attached and enabled.- Specified by:
- renderin interface- AppState
- Overrides:
- renderin class- BaseAppState
- Parameters:
- renderManager- RenderManager
 
- 
setBackGroundColorAlter the background color of an initialized EnvironmentCamera.- Parameters:
- bgColor- the desired color (not null, unaffected, default is the background color of the application's default viewport)
 
- 
getSizepublic int getSize()Gets the size of environment cameras.- Returns:
- the size of environment cameras.
 
- 
setSizepublic void setSize(int size) Sets the size of environment cameras and rebuild this state if it was initialized.- Parameters:
- size- the size of environment cameras.
 
- 
rebuildprotected void rebuild()Rebuild all environment cameras.
- 
getPosition
- 
setPositionSets the camera position in world space.- Parameters:
- position- the position in world space
 
- 
getViewPortsReturns an array of the 6 ViewPorts used to capture the snapshot. Note that this will be null until after initialize() is called.- Returns:
- array of ViewPorts
 
- 
isBusypublic boolean isBusy()Test whether this EnvironmentCamera is busy. Avoid reconfiguring while busy!- Returns:
- true if busy, otherwise false
 
- 
initializeDescription copied from class:BaseAppStateCalled during initialization once the app state is attached and before onEnable() is called.- Specified by:
- initializein class- BaseAppState
- Parameters:
- app- the application
 
- 
cleanupDescription copied from class:BaseAppStateCalled after the app state is detached or during application shutdown if the state is still attached. onDisable() is called before this cleanup() method if the state is enabled at the time of cleanup.- Specified by:
- cleanupin class- BaseAppState
- Parameters:
- app- the application
 
- 
getImageFormatreturns the images format used for the generated maps.- Returns:
- the enum value
 
- 
onEnableprotected void onEnable()Description copied from class:BaseAppStateCalled when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.- Specified by:
- onEnablein class- BaseAppState
 
- 
onDisableprotected void onDisable()Description copied from class:BaseAppStateCalled when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.- Specified by:
- onDisablein class- BaseAppState
 
- 
createOffCameraprotected Camera createOffCamera(int mapSize, Vector3f worldPos, Vector3f axisX, Vector3f axisY, Vector3f axisZ) Creates an off camera- Parameters:
- mapSize- the size
- worldPos- the position
- axisX- the x axis
- axisY- the y axis
- axisZ- tha z axis
- Returns:
- a new instance
 
- 
createOffViewPortcreates an off-screen VP- Parameters:
- name- the desired name for the offscreen viewport
- offCamera- the Camera to be used (alias created)
- Returns:
- a new instance
 
- 
createOffScreenFrameBuffercreate an offscreen frame buffer.- Parameters:
- mapSize- the desired size (pixels per side)
- offView- the off-screen viewport to be used (alias created)
- Returns:
- a new instance
 
 
-