public class StereoOptionSceneController extends BasicSceneController implements StereoSceneController
This scene controller draws in stereo, either red-blue anaglyph or device supported if the display device provides
stereo directly. It can also draw without applying stereo. To select stereo, prior to calling this class' constructor
set the Java VM property gov.nasa.worldwind.stereo.mode
to "device" for device supported stereo (if
provided by the device) or "redblue" for red-blue anaglyph stereo. If the property is not set or is any other value,
this class does not draw in stereo.
The WorldWindow
instance must support stereo in order to use device-supported stereo. A stereo
WorldWindow
is selected by specifying the Java VM property described above prior to creating it. See
WorldWindowGLCanvas
for further details.
Note: The logic and much of the code here was contributed by Xander Enzmann of Mitre Corporation.
Modifier and Type | Field and Description |
---|---|
protected com.jogamp.opengl.GLCapabilitiesImmutable |
capabilities
Indicates the GL drawable capabilities.
|
protected static double |
DEFAULT_FOCUS_ANGLE
The default focus angle.
|
protected Angle |
focusAngle
The angle between eyes.
|
protected boolean |
hardwareStereo
Indicates whether hardware device stereo is available.
|
protected boolean |
inStereo
Indicates whether stereo is being applied, either because a stereo device is being used or a stereo mode is in
effect.
|
protected java.lang.String |
stereoMode
The current stereo mode.
|
protected boolean |
swapEyes
Indicates whether left and right eye positions are swapped.
|
clutterFilter, dc, deepPick, deferOrderedRendering, frame, framesPerSecond, frameTime, glRuntimeCaps, gpuResourceCache, lastObjectsInPickRect, lastPickedObjects, model, perFrameStatistics, perFrameStatisticsKeys, pickableObjects, pickPoint, pickPoints, pickRect, pickTime, renderingExceptions, screenCreditController, SURFACE_OBJECT_TILE_COUNT_NAME, surfaceObjectTileBuilder, textRendererCache, timebase, verticalExaggeration, view
Constructor and Description |
---|
StereoOptionSceneController()
Constructs an instance and initializes its stereo mode to
|
Modifier and Type | Method and Description |
---|---|
protected void |
doDrawStereoNone(DrawContext dc)
Implement no stereo ("Mono") while using a stereo device.
|
protected void |
doDrawStereoRedBlue(DrawContext dc)
Implement stereo using the red-blue anaglyph technique.
|
protected void |
doDrawToStereoDevice(DrawContext dc)
Implement stereo using the stereo-enabled graphics device.
|
protected void |
draw(DrawContext dc) |
Angle |
getFocusAngle()
Returns this controller's focus angle, the angle difference between the left and right eye direction.
|
java.lang.String |
getStereoMode()
Indicates the current stereo mode of this controller.
|
boolean |
isHardwareStereo()
Indicates whether stereo is being implemented directly by the display device rather than software.
|
boolean |
isInStereo()
Indicates whether stereo is being applied, either directly by the display device or simulated via software.
|
boolean |
isSwapEyes()
Indicates whether to switch the left/right stereo images.
|
void |
setFocusAngle(Angle a)
Specifies the angle difference between the left and right eye direction.
|
void |
setStereoMode(java.lang.String mode)
Specifies the technique used to provide a stereo effect.
|
void |
setSwapEyes(boolean swapEyes)
Specifies whether to draw the right eye image in the left eye's position and the left eye's image in the right
eye's position.
|
createTerrain2DContinuous, do2DContiguousRepaint, doNormalRepaint, doRepaint, draw2DContiguous, makeCurrent, pick2DContiguous, preRender2DContiguous
applyView, buildCompositeSurfaceObjects, checkGLErrors, clearFrame, createPickFrustum, createTerrain, dispose, doDeepPick, doNonTerrainPick, doResolveTopPick, doResolveTopPick, drawCompositeSurfaceObjects, drawOrderedSurfaceRenderables, finalizeFrame, getClutterFilter, getDrawContext, getFramesPerSecond, getFrameTime, getGLRuntimeCapabilities, getGpuResourceCache, getModel, getObjectsInPickRectangle, getPerFrameStatistics, getPickedObjectList, getPickPoint, getPickRectangle, getRenderingExceptions, getScreenCreditController, getTerrain, getTextRendererCache, getVerticalExaggeration, getView, getViewportCenter, initializeDrawContext, initializeFrame, isDeepPickEnabled, isDeferOrderedRendering, mergePickedObjectLists, pick, pickLayers, pickOrderedSurfaceRenderables, pickTerrain, preRender, preRenderOrderedSurfaceRenderables, reinitialize, repaint, resolveTopPick, setClutterFilter, setDeepPickEnabled, setDeferOrderedRendering, setGLRuntimeCapabilities, setGpuResourceCache, setModel, setPerFrameStatisticsKeys, setPickedObjectList, setPickPoint, setPickRectangle, setScreenCreditController, setVerticalExaggeration, setView
onMessage, propertyChange
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClutterFilter, getDrawContext, getFramesPerSecond, getFrameTime, getGLRuntimeCapabilities, getGpuResourceCache, getModel, getObjectsInPickRectangle, getPerFrameStatistics, getPickedObjectList, getPickPoint, getPickRectangle, getRenderingExceptions, getScreenCreditController, getTerrain, getVerticalExaggeration, getView, isDeepPickEnabled, reinitialize, repaint, setClutterFilter, setDeepPickEnabled, setGLRuntimeCapabilities, setGpuResourceCache, setModel, setPerFrameStatisticsKeys, setPickPoint, setPickRectangle, setScreenCreditController, setVerticalExaggeration, setView
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
dispose
protected com.jogamp.opengl.GLCapabilitiesImmutable capabilities
protected static final double DEFAULT_FOCUS_ANGLE
gov.nasa.worldwind.StereoFocusAngle
property. The default if not specified in the configuration is
1.6 degrees.protected Angle focusAngle
protected boolean hardwareStereo
protected boolean inStereo
protected java.lang.String stereoMode
AVKey.STEREO_MODE_NONE
instead.protected boolean swapEyes
public StereoOptionSceneController()
protected void doDrawStereoNone(DrawContext dc)
Note that this method draws the image twice, once to each of the left and right eye buffers, even when stereo is not in effect. This is to prevent the stereo device from drawing blurred scenes.
dc
- the current draw context.protected void doDrawStereoRedBlue(DrawContext dc)
dc
- the current draw context.protected void doDrawToStereoDevice(DrawContext dc)
dc
- the current draw context.protected void draw(DrawContext dc)
draw
in class AbstractSceneController
public Angle getFocusAngle()
StereoSceneController
getFocusAngle
in interface StereoSceneController
public java.lang.String getStereoMode()
StereoSceneController
getStereoMode
in interface StereoSceneController
StereoSceneController.setStereoMode(String)
, this instance's mode was set to AVKey.STEREO_MODE_NONE
.public boolean isHardwareStereo()
StereoSceneController
isHardwareStereo
in interface StereoSceneController
public boolean isInStereo()
If the display device is providing stereo -- isHardwareStereo()
is true
-- this method
returns true even if the stereo mode is AVKey.STEREO_MODE_NONE
. In this case, individual stereo images
are drawn for left and right eyes in order to prevent a blurred scene.
isInStereo
in interface StereoSceneController
public boolean isSwapEyes()
StereoSceneController
isSwapEyes
in interface StereoSceneController
public void setFocusAngle(Angle a)
setFocusAngle
in interface StereoSceneController
a
- the left-right eye direction difference. If null, the angle is set to 0.public void setStereoMode(java.lang.String mode)
StereoSceneController
AVKey.STEREO_MODE_DEVICE
to request device supported stereo, AVKey.STEREO_MODE_RED_BLUE
to request red-blue anaglyph stereo implemented in
software, or AVKey.STEREO_MODE_NONE
(the default) to request no stereo effect.
If STEREO_MODE_DEVICE
is requested but the display device does not support stereo, stereo is not
applied.
See the implementing class to determine how it detects the initial stereo mode.
setStereoMode
in interface StereoSceneController
mode
- the technique used to provide the stereo effect. If null, the mode is set to AVKey.STEREO_MODE_NONE
.public void setSwapEyes(boolean swapEyes)
StereoSceneController
setSwapEyes
in interface StereoSceneController
swapEyes
- true to switch the left/right stereo images, otherwise false.