VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
makVrv::DtOculusChannel Class Reference

Extension of OSG channel for Oculus Rift support. More...

Inheritance diagram for makVrv::DtOculusChannel:
Inheritance graph
[legend]

Public Member Functions

virtual void resetSensor ()
 Resets the HMD's sensor.
virtual void onPreTick ()
 Calls into the OVR SDK to begin a new frame & sets myFrameStarted.
virtual void onPostTick ()
 Calls into the OVR SDK to end the frame & resets myFrameStarted.
virtual void onShutdown ()
 Sets myOculusInitialized to false and zeros the myHMD pointer.
virtual std::vector< const
osg::Camera * > 
getShadowableCameras () const
 Add the RTT cameras to the list of shadowable cameras.
virtual DtQuat hmdOrientation ()
virtual DtVector hmdPosition ()
Controls the mirroring function to copy the Rift output to the VR-Vantage window.

Calls ovrSession_GetLastError to get any errors from the OVR SDK and outputs them as warnings

Setting this to false will disable mirroring and destroy myMirrorTexture. In most cases this should not be called directly and the state should instead be set via DtOculusSettingsManager::setMirroring so that the settings file is in sync.

virtual void setMirroring (int view)
virtual int mirroring ()
- Public Member Functions inherited from makVrv::DtOsgChannel
virtual ~DtOsgChannel ()
 DTOR.
void setSensorName (const std::string &sensorName)
 Set the name of the sensor to use.
virtual void setClearColor (float r, float g, float b, float a)
 Set the clear color for the channel.
virtual void setWindow (DtWindow *view)
 Set the window the channel is displayed on.
virtual const DtWindowwindow () const
 Get the window the channel is displayed on.
virtual void setViewport (int x, int y, int width, int height)
 Set the viewport.
virtual void clearFrameBufferIfChanged ()
 If something that would mess with the area of the frame buffer outside the current channel needs to be cleaned up then this fucntion will clear the framebuffer.
virtual void getViewport (int &x, int &y, int &width, int &height) const
 Get the viewport.
virtual void setCameraPosition (double x, double y, double z)
 Set the camera position.
virtual void setCameraOrientation (double psi, double theta, double phi)
 Set the camera orientation.
virtual void setCameraPositionAndOrientation (double x, double y, double z, double psi, double theta, double phi)
 Set camera position and orientation.
virtual void setCameraPositionAndOrientation (osg::Vec3d &pos, osg::Quat &orient)
virtual void getCameraPositionAndOrientation (osg::Vec3d &position, osg::Quat &rotation) const
 Get the camera position and orientation.
virtual void connectToObserver ()
 Set up based on current observer parameters, such as modelSet and is2D.
virtual void setProjectionMatrixAsPerspective (double fovy, double aspectRatio, double zNear, double zFar)
 Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details.
virtual void setProjectionMatrixAsFrustum (double left, double right, double bottom, double top, double zNear, double zFar)
 Set to a perspective projection.
virtual void setProjectionMatrix (const osg::Matrix &matrix)
 Set projection matrix with a matrix.
virtual osgViewer::View & view ()
 Window accessor.
virtual DtCameraNodesceneCamera ()
 Accessor for the 3D camera.
virtual const DtCameraNodesceneCamera () const
virtual DtCameraNoderttCamera () const
 Accessor for RTT camera.
virtual DtCameraNodeoverlayCamera ()
 Accessor for the 2D overlay camera.
virtual DtCameraNodenormalizedOverlayCamera ()
 Accessor for the normalized 2D overlay camera.
virtual void setRenderToTexture (bool enabled)
 Toggles whether this channel renders the scene to a texture.
virtual void setRenderToTextureFormat (int format, int sourceFormat, int sourceType)
 sets the render to texture format for the rttCamera, this was separated from the setRenderToTexture format function so that the SensorFX module could use HDR rendere to texture
virtual osg::ref_ptr
< osg::Texture2D > 
getRenderTexture ()
 Gets the texture the scene was rendered to, if setRenderToTexture was enabled.
virtual osg::ref_ptr
< osg::Texture2D > 
getOcculsionTexture ()
virtual osg::ref_ptr
< osg::Texture2D > 
getDepthTexture () const
 Returns the depth texture for this channel.
virtual void setEnablePostProcessors (bool enable)
virtual bool getEnablePostProcessors ()
virtual bool useOldChannelOffsetCalcuation () const
virtual void setUseOldChannelOffsetCalcuation (bool enable)
virtual bool forceHdrLuminanceOverride ()
 should the HDR post processor force the luminance scalar to 1.0 for this channel used for when the sky is turned off (XR mode)
virtual void setForceHdrLuminanceOverride (bool force)
virtual void clearStateGraph (void)
 osg maintains an internal cache of StateSets in a StateGraph
virtual void setEnableHdrPassthrough (bool flag)
 getter/setter for the whether the HDR post processor
virtual bool enableHdrPassthrough ()
virtual void screenCapture ()
 Takes Screen capture of the current channel.
virtual void setOcclusionTextureEnabled (bool enabled)
 enable or disable the creation of an occlusion texture, used for some screen space effects
virtual void initOcclusionTexture ()
 init occlusion texture, used for some screen space effects
int shadowQuality () const
*virtual void setProjectionResizePolicy (DtChannelConfiguration::ProjectionResizePolicy policy)
 Set the policy used to determine if and how the projection matrix should be adjusted on window resizes.
void projectionUnitsToFrustum (DtChannelConfiguration::ProjectionUnits units, double &left, double zNear, double &right, double &top, double &bottom)
virtual void connectChannelToScene ()
 Set the channel's scene graph root.
virtual bool processMouseEvent (const DtMouseEvent &ev)
 attempt to handle a mouse event with the channel's overlay
virtual bool processKeyboardEvent (const DtKeyEvent &ev)
 attempt to handle a keyboard event with the channel's overlay
void getWorldToWindowMatrix (osg::Matrix &worldToWindowMatrix) const
 Get the channel's dynamic overlay if any.
virtual void moveMouseToScreenLocation (float screenX, float screenY)
 Move the mouse pointer to the specified location in screen coordinates.
virtual void projectToScreen (double dbX, double dbY, double dbZ, double &screenX, double &screenY, double &screenZ)
 Project a point from world coordinates to screen coordinates.
virtual void projectToWorld (double screenX, double screenY, double &dbX, double &dbY, double &dbZ)
 project the local world coordinates given screen coordinates
virtual const std::string & name ()
 Returns the channel's name as defined in its configuration.
virtual void addPostProcessEffect (const std::string &postProcessorEffect)
 Add post processor effect names to be enabled during the DtOsgChannel update function The order of the effects is set in the DtPostProcessorFactory.
virtual void removePostProcessEffect (const std::string &postProcessorEffect)
 Remove post processor effect names to be enabled during the DtOsgChannel update function The order of the effects is set in the DtPostProcessorFactory.
virtual void set3DCullVisitorParams (DtOsgCullVisitorParameters *params)
virtual void set2DCullVisitorParams (DtOsgCullVisitorParameters *params)
- Public Member Functions inherited from makVrv::DtChannel
virtual ~DtChannel ()
 DTOR.
DtObserverObjectfindObserver () const
 Attempt to get the observer for the channel.
unsigned int currentModelSet () const
 Get the current model set.
const DtChannelConfigurationconfiguration () const
 Get the configuration.
virtual void setObserverName (const std::string &observerName)
 set the name of the observer to use, and attempt to connect
*virtual
DtChannelConfiguration::ProjectionResizePolicy 
projectionResizePolicy () const
 Get the policy used to determine if and how the projection matrix should be adjusted on window resizes.
std::string & observerName ()
 Retrieve the observer name for this channel.

Protected Member Functions

 DtOculusChannel (DtDe &de, DtOsgWindow *window, DtChannelConfiguration &config)
 Zeros out the memory for myEyeRenderPose, myEyeRenderDesc, myEyeFov and myEyeTexture.
virtual ~DtOculusChannel ()
 DTOR.
virtual void update ()
 Sets up the cull visitor & updates the RTT cameras.
virtual void updateProjection ()
 Overridden to prevent the projection matrix on my2DCamera from being reset based on the window's viewport size.
virtual void projectFor3D ()
 Projects frustum matrix for 3D viewing based on the field of view returned from the HMD.
virtual void setupCullVisitor (const osg::observer_ptr< osg::Camera > &camera)
 Attaches a DtOsgCullVistorCallback to the RTT cameras.
osg::Camera * createRTTCamera (int eye)
 Sets up an RTT camera.
virtual float getPixelsPerDisplayPixel ()
 Specifies the ratio of the number of render target pixels to display pixels at the center of distortion.
void blitMirrorTexture (osg::GraphicsContext *gc)
 If isMirroring(), the contents of myMirrorTexture will be copied to the VR-Vantage window.
void updateEyes (double znear=0.015, double zfar=10000)
Initialization functions
virtual bool initialize ()
 Installs myOculusDrawable and registers DtOculusChannel::onShutdown.
virtual void initializeOculusDevice (osg::RenderInfo &renderInfo)
 Configures the HMD created in the plugin, including the rendering & tracking configuration.
virtual void initializeOculusChannel ()
 Sets up the RTT textures & cameras.
- Protected Member Functions inherited from makVrv::DtOsgChannel
 DtOsgChannel (DtDe &de, DtOsgWindow *window, DtChannelConfiguration &config)
 Called by Creator object.
virtual void makeObserverToCameraMatrix (osg::Vec3d &orient, osg::Matrixd &offsetObserverToCamera, osg::Matrixd &observerToCamera)
virtual void makeObserverToCameraMatrix (osg::Quat &qObserverToWorld, osg::Matrixd &offsetObserverToCamera, osg::Matrixd &observerToCamera)
virtual void calculateNearFar (double &zNear, double &zFar)
 Calculates near/far depending on visual mode.
virtual bool useAttachedForNearClip (double alt)
 When using dynamic clipping plane calculations, determine if channel's view is attached to an entity and that entity should be taken into consideration.
virtual double calculateNearClip (double alt, double zFar)
 Calculate the dynamic near clipping plane.
virtual double calculateFarClip (double alt)
 Calculate the dynamic far clipping plane.
virtual void projectFor2D ()
 Projects ortho matrix for 2D viewing.
virtual void stopUsingModelSet (int modelSet)
 Stop rendering the specified model set on this channel.
virtual void startUsingModelSet (int modelSet)
 Start rendering the specified model set on this channel.
virtual void stopUsingSensor (DtSensor *sensor)
 Stop applying a sensor to this channel.
virtual void startUsingSensor (DtSensor *sensor)
 Apply a sensor to this channel.
virtual void slot_sensorRemoved (DtSensor *sensor)
 Called when a sensor is removed or deleted by the sensor manager.
virtual void slot_visualizerRootAdded (int modelSet, int visualType)
 called by signal when a new visualizer root is added
virtual void slot_observerModelSetChanged (DtObserverObject *observer, int modelSet)
 Called by signal when an observer's model set changes.
virtual void slot_observerSettingChanged (DtObserverObject *observer, int setting, bool value)
 Called by signal when an observer's visual setting changes.
virtual void slot_observerSettingRemoved (DtObserverObject *observer, int setting)
 Called by signal when an observer's visual setting is removed.
virtual void slot_windowConfigurationModified (const std::string &deName, const std::string &oldWindowName, const DtWindowConfiguration &config)
 slot to be called when the window configuration changes.
virtual void slot_onCoordinateSystemChanged ()
 receive signals from the shared state about coordinate system changes
void stopUsingModelSetWork (int modelSet)
 Stop rendering the specified model set on this channel.
void startUsingModelSetWork (int modelSet)
 Start rendering the specified model set on this channel.
void initializeRenderTextureColor ()
 Create and initialize render texture color buffer.
void initializeRenderTextureDepth ()
 Create and initialize render texture depth buffer.
void enableLighting (osg::ref_ptr< osg::Camera > camera, bool enable)
virtual void initializeNormalized2DCamera ()
virtual void initialize2DCamera (int w, int h)
virtual void initializeSceneCamera ()
virtual void initializeRenderTexture ()
virtual void initializeRTTCamera ()
void clearRttCamera ()
virtual void recreateRTTCamera ()
void setShadowState (bool enable)
virtual void addOverlayDrawablesToCameras ()
 Add drawables to render overlays to their respective cameras.
virtual void initializeSignalConnections ()
 Connect channel's slots to signals from other objects.
- Protected Member Functions inherited from makVrv::DtChannel
 DtChannel (DtDe &de, DtChannelConfiguration &)
 The constructor for an abstract class is not public.
void observerAdded (const std::string &observerName)
void observerRemoved (const std::string &observerName)

Protected Attributes

ovrSession mySession
ovrHmdDesc myHmdDesc
ovrPosef myEyeRenderPose [2]
ovrEyeRenderDesc myEyeRenderDesc [2]
ovrFovPort myEyeFov [2]
ovrLayerEyeFov myLayer
osg::ref_ptr< OculusTextureBuffermyTextureBuffer [2]
osg::ref_ptr< OculusMirrorTexturemyMirrorTexture
bool myFrameStarted
int myMirroringView
bool myMonoscopic
osg::ref_ptr< osg::Camera > myRTTCameras [2]
osg::ref_ptr< osg::Texture2D > myLeftDepthTexture
osg::ref_ptr< osg::Texture2D > myRightDepthTexture
osg::Quat myHmdOrientation
osg::Vec3d myHmdPosition
osg::Matrixf myLeftEyeProjectionMatrix
osg::Matrixf myRightEyeProjectionMatrix
osg::Matrixf myLeftEyeViewMatrix
osg::Matrixf myRightEyeViewMatrix
osg::ref_ptr< DtOculusDrawablemyOculusDrawable
osg::ref_ptr< osg::Group > myOculusDrawableGroup
bool myOculusInitialized
osg::ref_ptr< osg::Billboard > myHUDBillboard
osg::ref_ptr
< osg::MatrixTransform > 
myHUDMatrixTransform
osg::ref_ptr
< osg::GraphicsContext::SwapCallback > 
mySwapCallback
DtSignalConnectionManager myConnections
- Protected Attributes inherited from makVrv::DtOsgChannel
osg::ref_ptr< osgViewer::View > myView
DtOsgWindowmyOsgWindow
DtOsgObserverObjectmyOsgObserverObject
int myRenderTextureFormat
int myRenderTextureSourceFormat
int myRenderTextureSourceType
bool myRenderTextureFormatDirty
DtSensormySensor
osg::ref_ptr< osg::Group > myRoot
osg::ref_ptr< DtCameraNodemySceneCamera
osg::ref_ptr< DtCameraNodemy2DCamera
osg::ref_ptr< DtCameraNodemyNormalized2DCamera
osg::ref_ptr< osg::Texture2D > myRenderTexture
 The textures the 3D scene renders into when post processing is on.
osg::ref_ptr< osg::Texture2D > myDepthTexture
osg::ref_ptr< osg::Texture2D > myOcclusionTexture
osg::ref_ptr< DtCameraNodemyRTTCamera
 Slave camera configured to render to myRenderTexture.
bool myIsUsingTrackballManipulator
bool myCoordinateSystemChanged
bool myRenderToTextureFlag
bool myShadowState
PostProcessorEffectList myPostProcessorEffects
osg::Node::NodeMask myOldSceneCameraNodeMask
DtLightmyFlashlight
bool myEnablePostProcessors
bool myUseOldChannelOffsetCalcuation
osg::ref_ptr
< osg::DatabaseRequestHandlerCallback > 
myDatabasePagerCallback
bool myEnableHdrPassthrough
bool myForceHdrLuminanceOverride
bool myFrameBufferNeedsClear
- Protected Attributes inherited from makVrv::DtChannel
DtDemyDe
DtChannelConfigurationmyChannelConfiguration
DtSignalConnectionManager myConnections
int myModelSet
DtObserverObjectmyObserver
std::string myObserverName
DtChannelConfiguration::ProjectionResizePolicy myProjectionResizePolicy

Friends

class DtOculusChannelCreator
class DtOculusDrawable
class DtOculusSwapCallback

Additional Inherited Members

- Public Types inherited from makVrv::DtOsgChannel
typedef std::list< std::string > PostProcessorEffectList
- Public Attributes inherited from makVrv::DtOsgChannel
boost::signal< void(int, int,
int, int)> 
signal_viewportChanged
 Emitted when the channel's viewport changes dimensions.
- Protected Types inherited from makVrv::DtOsgChannel
typedef std::map< int,
DtChannelSpecificGroup * > 
VisualTypeMap

Detailed Description

Extension of OSG channel for Oculus Rift support.

Constructor & Destructor Documentation

makVrv::DtOculusChannel::DtOculusChannel ( DtDe de,
DtOsgWindow window,
DtChannelConfiguration config 
)
protected

Zeros out the memory for myEyeRenderPose, myEyeRenderDesc, myEyeFov and myEyeTexture.

The OVR SDK doesn't do this and if it's left uninitialized the Rift may fail to connect properly.

virtual makVrv::DtOculusChannel::~DtOculusChannel ( )
protectedvirtual

DTOR.

Member Function Documentation

virtual bool makVrv::DtOculusChannel::initialize ( )
protectedvirtual

Installs myOculusDrawable and registers DtOculusChannel::onShutdown.

Reimplemented from makVrv::DtOsgChannel.

virtual void makVrv::DtOculusChannel::initializeOculusDevice ( osg::RenderInfo &  renderInfo)
protectedvirtual

Configures the HMD created in the plugin, including the rendering & tracking configuration.

Calls initializeOculusChannel(). Registers onPreTick & onPostTick. Sets myOculusInitialized to true.

Referenced by makVrv::DtOculusDrawable::drawImplementation().

virtual void makVrv::DtOculusChannel::initializeOculusChannel ( )
protectedvirtual

Sets up the RTT textures & cameras.

virtual void makVrv::DtOculusChannel::update ( )
protectedvirtual

Sets up the cull visitor & updates the RTT cameras.

Reimplemented from makVrv::DtOsgChannel.

virtual void makVrv::DtOculusChannel::updateProjection ( )
protectedvirtual

Overridden to prevent the projection matrix on my2DCamera from being reset based on the window's viewport size.

Reimplemented from makVrv::DtOsgChannel.

virtual void makVrv::DtOculusChannel::projectFor3D ( )
protectedvirtual

Projects frustum matrix for 3D viewing based on the field of view returned from the HMD.

Reimplemented from makVrv::DtOsgChannel.

virtual void makVrv::DtOculusChannel::setupCullVisitor ( const osg::observer_ptr< osg::Camera > &  camera)
protectedvirtual

Attaches a DtOsgCullVistorCallback to the RTT cameras.

osg::Camera* makVrv::DtOculusChannel::createRTTCamera ( int  eye)
protected

Sets up an RTT camera.

virtual float makVrv::DtOculusChannel::getPixelsPerDisplayPixel ( )
protectedvirtual

Specifies the ratio of the number of render target pixels to display pixels at the center of distortion.

1.0 is the default value. Lower values can improve performance, higher values give improved quality. Currently this is setup to be based on the OCULUS_PIXELS_PER_DISPLAY_PIXEL environment variable; if it's not it defaults to 1.0.

void makVrv::DtOculusChannel::blitMirrorTexture ( osg::GraphicsContext *  gc)
protected

If isMirroring(), the contents of myMirrorTexture will be copied to the VR-Vantage window.

This should only be called from DtOculusSwapCallback::swapBuffersImplementation.

virtual void makVrv::DtOculusChannel::resetSensor ( )
virtual

Resets the HMD's sensor.

virtual void makVrv::DtOculusChannel::onPreTick ( )
virtual

Calls into the OVR SDK to begin a new frame & sets myFrameStarted.

Applies the current position & orientation of the HMD to the observer.

virtual void makVrv::DtOculusChannel::onPostTick ( )
virtual

Calls into the OVR SDK to end the frame & resets myFrameStarted.

Restores the previous observer state to allow it to be modified externally (i.e. from the keyboard, mouse and other observer controls).

virtual void makVrv::DtOculusChannel::onShutdown ( )
virtual

Sets myOculusInitialized to false and zeros the myHMD pointer.

The HMD itself is destroyed by the plugin.

virtual void makVrv::DtOculusChannel::setMirroring ( int  view)
virtual
virtual int makVrv::DtOculusChannel::mirroring ( )
virtual
virtual std::vector<const osg::Camera*> makVrv::DtOculusChannel::getShadowableCameras ( ) const
virtual

Add the RTT cameras to the list of shadowable cameras.

Reimplemented from makVrv::DtOsgChannel.

virtual DtQuat makVrv::DtOculusChannel::hmdOrientation ( )
inlinevirtual
virtual DtVector makVrv::DtOculusChannel::hmdPosition ( )
inlinevirtual
void makVrv::DtOculusChannel::updateEyes ( double  znear = 0.015,
double  zfar = 10000 
)
protected

Friends And Related Function Documentation

friend class DtOculusChannelCreator
friend
friend class DtOculusDrawable
friend
friend class DtOculusSwapCallback
friend

Member Data Documentation

ovrSession makVrv::DtOculusChannel::mySession
protected
ovrHmdDesc makVrv::DtOculusChannel::myHmdDesc
protected
ovrPosef makVrv::DtOculusChannel::myEyeRenderPose[2]
protected
ovrEyeRenderDesc makVrv::DtOculusChannel::myEyeRenderDesc[2]
protected
ovrFovPort makVrv::DtOculusChannel::myEyeFov[2]
protected
ovrLayerEyeFov makVrv::DtOculusChannel::myLayer
protected
osg::ref_ptr<OculusTextureBuffer> makVrv::DtOculusChannel::myTextureBuffer[2]
protected
osg::ref_ptr<OculusMirrorTexture> makVrv::DtOculusChannel::myMirrorTexture
protected
bool makVrv::DtOculusChannel::myFrameStarted
protected
int makVrv::DtOculusChannel::myMirroringView
protected
bool makVrv::DtOculusChannel::myMonoscopic
protected
osg::ref_ptr<osg::Camera> makVrv::DtOculusChannel::myRTTCameras[2]
protected
osg::ref_ptr<osg::Texture2D> makVrv::DtOculusChannel::myLeftDepthTexture
protected
osg::ref_ptr<osg::Texture2D> makVrv::DtOculusChannel::myRightDepthTexture
protected
osg::Quat makVrv::DtOculusChannel::myHmdOrientation
protected
osg::Vec3d makVrv::DtOculusChannel::myHmdPosition
protected
osg::Matrixf makVrv::DtOculusChannel::myLeftEyeProjectionMatrix
protected
osg::Matrixf makVrv::DtOculusChannel::myRightEyeProjectionMatrix
protected
osg::Matrixf makVrv::DtOculusChannel::myLeftEyeViewMatrix
protected
osg::Matrixf makVrv::DtOculusChannel::myRightEyeViewMatrix
protected
osg::ref_ptr<DtOculusDrawable> makVrv::DtOculusChannel::myOculusDrawable
protected
osg::ref_ptr<osg::Group> makVrv::DtOculusChannel::myOculusDrawableGroup
protected
bool makVrv::DtOculusChannel::myOculusInitialized
protected
osg::ref_ptr<osg::Billboard> makVrv::DtOculusChannel::myHUDBillboard
protected
osg::ref_ptr<osg::MatrixTransform> makVrv::DtOculusChannel::myHUDMatrixTransform
protected
osg::ref_ptr<osg::GraphicsContext::SwapCallback> makVrv::DtOculusChannel::mySwapCallback
protected
DtSignalConnectionManager makVrv::DtOculusChannel::myConnections
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)