public class EnvironmentCamera extends BaseAppState
LightProbeFactory
,
LightProbe
Modifier and Type | Class and Description |
---|---|
protected class |
EnvironmentCamera.SnapshotJob
An inner class to keep track on a snapshot job.
|
Modifier and Type | Field and Description |
---|---|
protected static Vector3f[] |
axisX |
protected static Vector3f[] |
axisY |
protected static Vector3f[] |
axisZ |
protected ColorRGBA |
backGroundColor |
protected java.nio.ByteBuffer[] |
buffers |
TextureCubeMap |
debugEnv |
protected FrameBuffer[] |
framebuffers |
protected Image.Format |
imageFormat |
protected Image[] |
images |
protected Vector3f |
position |
protected int |
size
The size of environment cameras.
|
protected ViewPort[] |
viewports |
Constructor and Description |
---|
EnvironmentCamera()
Creates an EnvironmentCamera with a size of 256
|
EnvironmentCamera(int size)
Creates an EnvironmentCamera with the given size.
|
EnvironmentCamera(int size,
Vector3f position)
Creates an EnvironmentCamera with the given size, and the given position
|
EnvironmentCamera(int size,
Vector3f position,
Image.Format imageFormat)
Creates an EnvironmentCamera with the given size, and the given position
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanup(Application app)
Called after the app state is detached or during
application shutdown if the state is still attached.
|
protected Camera |
createOffCamera(int mapSize,
Vector3f worldPos,
Vector3f axisX,
Vector3f axisY,
Vector3f axisZ)
Creates an off camera
|
protected FrameBuffer |
createOffScreenFrameBuffer(int mapSize,
ViewPort offView)
create an offscreen frame buffer.
|
protected ViewPort |
createOffViewPort(java.lang.String name,
Camera offCamera)
creates an offsceen VP
|
Image.Format |
getImageFormat()
returns the images format used for the generated maps.
|
Vector3f |
getPosition() |
int |
getSize()
Gets the size of environment cameras.
|
protected void |
initialize(Application app)
Called during initialization once the app state is
attached and before onEnable() is called.
|
protected void |
onDisable()
Called when the state was previously enabled but is
now disabled either because setEnabled(false) was called
or the state is being cleaned up.
|
protected void |
onEnable()
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 void |
rebuild()
Rebuild all environment cameras.
|
void |
render(RenderManager renderManager)
Render the state.
|
void |
setPosition(Vector3f position)
Sets the camera position in world space.
|
void |
setSize(int size)
Sets the size of environment cameras and rebuild this state if it was initialized.
|
void |
snapshot(Spatial scene,
JobProgressListener<TextureCubeMap> done)
Takes a snapshot of the surrounding scene.
|
cleanup, getApplication, getId, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, setEnabled, setId, stateAttached, stateDetached, update
protected static Vector3f[] axisX
protected static Vector3f[] axisY
protected static Vector3f[] axisZ
protected Image.Format imageFormat
public TextureCubeMap debugEnv
protected Image[] images
protected ViewPort[] viewports
protected FrameBuffer[] framebuffers
protected java.nio.ByteBuffer[] buffers
protected Vector3f position
protected ColorRGBA backGroundColor
protected int size
public EnvironmentCamera()
public EnvironmentCamera(int size)
size
- the size of the resulting texture.public EnvironmentCamera(int size, Vector3f position)
size
- the size of the resulting texture.position
- the position of the camera.public EnvironmentCamera(int size, Vector3f position, Image.Format imageFormat)
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.public void snapshot(Spatial scene, JobProgressListener<TextureCubeMap> done)
scene
- the scene to snapshot.done
- a callback to call when the snapshot is done.public void render(RenderManager renderManager)
AppState
AppState
is both attached and enabled.render
in interface AppState
render
in class BaseAppState
renderManager
- RenderManagerpublic int getSize()
public void setSize(int size)
size
- the size of environment cameras.protected void rebuild()
public Vector3f getPosition()
public void setPosition(Vector3f position)
position
- the position in world spaceprotected void initialize(Application app)
BaseAppState
initialize
in class BaseAppState
app
- the applicationprotected void cleanup(Application app)
BaseAppState
cleanup
in class BaseAppState
app
- the applicationpublic Image.Format getImageFormat()
protected void onEnable()
BaseAppState
onEnable
in class BaseAppState
protected void onDisable()
BaseAppState
onDisable
in class BaseAppState
protected Camera createOffCamera(int mapSize, Vector3f worldPos, Vector3f axisX, Vector3f axisY, Vector3f axisZ)
mapSize
- the sizeworldPos
- the positionaxisX
- the x axisaxisY
- the y axisaxisZ
- tha z axisprotected ViewPort createOffViewPort(java.lang.String name, Camera offCamera)
name
- offCamera
- protected FrameBuffer createOffScreenFrameBuffer(int mapSize, ViewPort offView)
mapSize
- offView
-