public class VRAppState extends AbstractAppState
application have to share application settings,
the common way to use this app state is:application settings and set the VR related settings (see VRConstants).
application and to attach it to the created settings (with setSettings(AppSettings)).
application.
| Modifier and Type | Field and Description |
|---|---|
boolean |
DISABLE_VR
Is the application has not to start within VR mode (default is
false). |
initialized| Constructor and Description |
|---|
VRAppState(AppSettings settings,
VREnvironment environment)
Create a new VR app state with given settings.
|
VRAppState(VREnvironment environment)
Create a new default VR app state that relies on the given
VR environment. |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Called by
AppStateManager when transitioning this
AppState from terminating to detached. |
Application |
getApplication()
Get the
Application to which this app state is attached. |
Vector3f |
getFinalObserverPosition()
Get the observer final position within the scene.
|
Quaternion |
getFinalObserverRotation()
Get the observer final rotation within the scene.
|
ViewPort |
getLeftViewPort()
Get the VR headset left viewport.
|
java.lang.Object |
getObserver()
Get the scene observer.
|
ViewPort |
getRightViewPort()
Get the VR headset right viewport.
|
AppSettings |
getSettings()
Get the
settings attached to this app state. |
AppStateManager |
getStateManager()
Get the
state manager to which this app state is attached. |
VREnvironment |
getVREnvironment()
Return the
VR environment on which this app state relies. |
VRGuiManager |
getVRGUIManager()
Get the GUI manager attached to this app state.
|
VRAPI |
getVRHardware()
Get the VR underlying hardware.
|
VRInputAPI |
getVRinput()
Get the VR dedicated input.
|
VRMouseManager |
getVRMouseManager()
Get the VR mouse manager attached to this app state.
|
VRViewManager |
getVRViewManager()
Get the VR view manager.
|
void |
initialize(AppStateManager stateManager,
Application app)
Called by
AppStateManager when transitioning this AppState
from initializing to running.This will happen on the next iteration through the update loop after AppStateManager.attach(com.jme3.app.state.AppState) was called. |
boolean |
isInstanceRendering()
Check if the rendering is instanced (see Geometry instancing).
|
void |
moveScreenProcessingToVR()
Move filters from the main scene into the eye's.
|
void |
postRender()
Called after all rendering commands are flushed.
|
protected void |
processSettings(AppSettings settings)
Process the attached settings and apply changes to this app state.
|
void |
render(RenderManager rm)
Render the state.
|
void |
setBackgroundColors(ColorRGBA clr)
Set the background color for both left and right view ports.
|
void |
setFrustrumNearFar(float near,
float far)
Set the frustum values for the application.
|
void |
setMirrorWindowSize(int width,
int height)
Set the mirror window size in pixel.
|
void |
setObserver(Spatial observer)
Set the scene observer.
|
void |
setResolutionMultiplier(float val)
Set the resolution multiplier.
|
void |
setSettings(AppSettings settings)
Set the
settings attached to this app state. |
void |
simpleRender(RenderManager renderManager)
Rendering callback of the app state.
|
void |
simpleUpdate(float tpf)
Simple update of the app state, this method should contains any spatial updates.
|
void |
stateAttached(AppStateManager stateManager)
Called by
AppStateManager.attach(com.jme3.app.state.AppState)
when transitioning this
AppState from detached to initializing. |
void |
stateDetached(AppStateManager stateManager)
Called by
AppStateManager.detach(com.jme3.app.state.AppState)
when transitioning this
AppState from running to terminating. |
void |
update(float tpf)
Called to update the
AppState. |
getId, isEnabled, isInitialized, setEnabled, setIdpublic boolean DISABLE_VR
false).public VRAppState(VREnvironment environment)
VR environment.environment - the VR environment that this app state is using.public VRAppState(AppSettings settings, VREnvironment environment)
VR environment.settings - the settings to use.environment - the VR environment that this app state is using.public void simpleUpdate(float tpf)
update() method and should not be called manually.tpf - the application time.public void simpleRender(RenderManager renderManager)
update() method and should not be called manually.renderManager - the render manager.public void setFrustrumNearFar(float near,
float far)
near - the frustum near value.far - the frustum far value.public void setMirrorWindowSize(int width,
int height)
width - the width of the mirror window in pixel.height - the height of the mirror window in pixel.public void setResolutionMultiplier(float val)
val - the resolution multiplier.public void moveScreenProcessingToVR()
public Quaternion getFinalObserverRotation()
getFinalObserverPosition()public Vector3f getFinalObserverPosition()
getFinalObserverRotation()public ViewPort getLeftViewPort()
getRightViewPort()public ViewPort getRightViewPort()
getLeftViewPort()public void setBackgroundColors(ColorRGBA clr)
clr - the background color.public Application getApplication()
Application to which this app state is attached.Application to which this app state is attached.getStateManager()public AppStateManager getStateManager()
state manager to which this app state is attached.state manager to which this app state is attached.getApplication()public java.lang.Object getObserver()
setObserver(Spatial)public void setObserver(Spatial observer)
observer - the scene observer.public boolean isInstanceRendering()
true if the rendering is instanced and false otherwise.public VREnvironment getVREnvironment()
VR environment on which this app state relies.VR environment on which this app state relies.public VRAPI getVRHardware()
public VRInputAPI getVRinput()
public VRViewManager getVRViewManager()
public VRGuiManager getVRGUIManager()
public VRMouseManager getVRMouseManager()
public AppSettings getSettings()
settings attached to this app state.settings attached to this app state.setSettings(AppSettings)public void setSettings(AppSettings settings)
settings attached to this app state.settings - the settings attached to this app state.getSettings()public void update(float tpf)
AppStateAppState. This method will be called
every render pass if the AppState is both attached and enabled.update in interface AppStateupdate in class AbstractAppStatetpf - Time since the last call to update(), in seconds.public void render(RenderManager rm)
AppStateAppState is both attached and enabled.render in interface AppStaterender in class AbstractAppStaterm - RenderManagerpublic void postRender()
AppStateAppState is both attached and enabled.postRender in interface AppStatepostRender in class AbstractAppStatepublic void initialize(AppStateManager stateManager, Application app)
AppStateAppStateManager when transitioning this AppState
from initializing to running.AppStateManager.attach(com.jme3.app.state.AppState) was called.
AppStateManager will call this only from the update loop
inside the rendering thread. This means is it safe to modify the scene
graph from this method.
initialize in interface AppStateinitialize in class AbstractAppStatestateManager - The state managerapp - The applicationpublic void stateAttached(AppStateManager stateManager)
AppStateAppStateManager.attach(com.jme3.app.state.AppState)
when transitioning this
AppState from detached to initializing.
There is no assumption about the thread from which this function is
called, therefore it is unsafe to modify the scene graph
from this method. Please use
AppState.initialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)
instead.
stateAttached in interface AppStatestateAttached in class AbstractAppStatestateManager - State manager to which the state was attached to.public void cleanup()
AppStateAppStateManager when transitioning this
AppState from terminating to detached. This
method is called the following render pass after the AppState has
been detached and is always called once and only once for each time
initialize() is called. Either when the AppState
is detached or when the application terminates (if it terminates normally).cleanup in interface AppStatecleanup in class AbstractAppStatepublic void stateDetached(AppStateManager stateManager)
AppStateAppStateManager.detach(com.jme3.app.state.AppState)
when transitioning this
AppState from running to terminating.
There is no assumption about the thread from which this function is
called, therefore it is unsafe to modify the scene graph
from this method. Please use
AppState.cleanup()
instead.
stateDetached in interface AppStatestateDetached in class AbstractAppStatestateManager - The state manager from which the state was detached from.protected void processSettings(AppSettings settings)
settings - the app settings to process.