VR-Forces Developer's Guide
 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.

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

Public Member Functions

virtual void resetSensor ()
 
virtual void onPreTick ()
 
virtual void onPostTick ()
 
virtual void onShutdown ()
 
virtual std::vector< const
osg::Camera * > 
getShadowableCameras () const
 
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 ()
 
virtual void setSensorName (const std::string &sensorName)
 
virtual void setClearColor (float r, float g, float b, float a)
 
virtual void setWindow (DtWindow *view)
 
virtual const DtWindowwindow () const
 
virtual void setViewport (int x, int y, int width, int height)
 
virtual void clearFrameBufferIfChanged ()
 
virtual void getViewport (int &x, int &y, int &width, int &height) const
 
virtual void setCameraPosition (double x, double y, double z)
 
virtual void setCameraOrientation (double psi, double theta, double phi)
 
virtual void setCameraPositionAndOrientation (double x, double y, double z, double psi, double theta, double phi)
 
virtual void setCameraPositionAndOrientation (osg::Vec3d &pos, osg::Quat &orient)
 
virtual void getCameraPositionAndOrientation (osg::Vec3d &position, osg::Quat &rotation) const
 
virtual void setChannelEnabled (bool enabled, bool partial) override
 
virtual bool channelEnabled () const
 
virtual void connectToObserver ()
 
virtual osgViewer::View & view ()
 
virtual DtCameraNodesceneCamera ()
 
virtual const DtCameraNodesceneCamera () const
 
virtual DtCameraNoderttCamera () const
 
virtual DtCameraNodeactiveMainCamera ()
 
virtual const DtCameraNodeactiveMainCamera () const
 
virtual DtCameraNodeoverlayCamera ()
 
virtual DtCameraNodenormalizedOverlayCamera ()
 
virtual void setRenderToTexture (bool enabled)
 
virtual void setRenderToTextureFormat (int format, int sourceFormat, int sourceType)
 
virtual osg::ref_ptr
< osg::Texture > 
allocateRenderTexture (int width, int height) const
 
virtual osg::ref_ptr
< osg::Texture > 
getRenderTexture ()
 
virtual osg::ref_ptr
< osg::Texture > 
getOcculsionTexture ()
 
virtual osg::ref_ptr
< osg::Texture > 
getDepthTexture () const
 
virtual void setDepthTextureUsesStencilBuffer (bool useStencil)
 
virtual bool depthTextureUsesStencilBuffer () const
 
virtual void setEnablePostProcessors (bool enable)
 
virtual bool getEnablePostProcessors ()
 
virtual bool useOldChannelOffsetCalcuation () const
 
virtual void setUseOldChannelOffsetCalcuation (bool enable)
 
virtual bool forceHdrLuminanceOverride ()
 
virtual void setForceHdrLuminanceOverride (bool force)
 
virtual void clearStateGraph (void)
 
virtual void setEnableHdrPassthrough (bool flag)
 
virtual bool enableHdrPassthrough ()
 
virtual void setHdrOutputScale (float scale)
 
virtual float hdrOutputScale ()
 
virtual void screenCapture ()
 
virtual void setOcclusionTextureEnabled (bool enabled)
 
virtual void initOcclusionTexture ()
 
virtual void updateCameraFrustumPlanes (std::vector< DtVector4< double > > &planes)
 
virtual void updateAcquisitionBoxFrustumPlanes (const int &boxCenterX, const int &boxCenterY, const int &boxWidth, const int &boxHeight, std::vector< DtVector4< double > > &planes)
 
virtual void setChannelSensor (DtOsgChannelSensor *extension)
 
virtual DtOsgChannelSensorfindChannelSensor ()
 
virtual void releaseResources (osg::State *gcState)
 
virtual void updateShowTracksUniform (bool value)
 
virtual std::vector< DtElementIDentitiesInFrustum () override
 
virtual int shadowQuality () const
 
virtual void setProjectionResizePolicy (DtChannelConfiguration::ProjectionResizePolicy policy)
 
virtual void projectionUnitsToFrustum (DtChannelConfiguration::ProjectionUnits units, double &left, double zNear, double &right, double &top, double &bottom)
 
virtual void projectionUnitsToFrustumWithZoomAdjustment (DtChannelConfiguration::ProjectionUnits units, double &left, double zNear, double &right, double &top, double &bottom)
 
virtual void connectChannelToScene ()
 
virtual bool processMouseEvent (const DtMouseEvent &ev)
 
virtual bool processKeyboardEvent (const DtKeyEvent &ev)
 
virtual void getWorldToWindowMatrix (osg::Matrix &worldToWindowMatrix) const
 
virtual void moveMouseToScreenLocation (float screenX, float screenY)
 
virtual void projectToScreen (double dbX, double dbY, double dbZ, double &screenX, double &screenY, double &screenZ) const override
 
virtual void projectToWorld (double screenX, double screenY, double &dbX, double &dbY, double &dbZ) const override
 
virtual DtIntersectorResult findWorldIntersection (double screenX, double screenY, DtIntersector::IntersectProperties properties=DtIntersector::AllNodes, std::vector< DtElementID > *ignoreList=0) override
 
virtual const std::string & name ()
 
virtual void addPostProcessEffect (const std::string &postProcessorEffect)
 
virtual void removePostProcessEffect (const std::string &postProcessorEffect)
 
virtual bool hasPostProcessEffect (const std::string &postProcessorEffect)
 
virtual void set3DCullVisitorParams (DtOsgCullVisitorParameters *params)
 
virtual void set2DCullVisitorParams (DtOsgCullVisitorParameters *params)
 
- Public Member Functions inherited from makVrv::DtChannel
virtual ~DtChannel ()
 
DtObserverObjectfindObserver () const
 
DtModelSetId currentModelSet () const
 
const DtChannelConfigurationconfiguration () const
 
virtual void setObserverName (const std::string &observerName)
 
virtual
DtChannelConfiguration::ProjectionResizePolicy 
projectionResizePolicy () const
 
std::string & observerName ()
 

Protected Member Functions

 DtOculusChannel (DtDe &de, DtOsgWindow *window, DtChannelConfiguration &config)
 
virtual ~DtOculusChannel ()
 
virtual void update ()
 
virtual void updateProjection ()
 
virtual void projectFor3D ()
 
virtual void setupCullVisitor (const osg::observer_ptr< osg::Camera > &camera)
 
osg::Camera * createRTTCamera (int eye)
 
virtual float getPixelsPerDisplayPixel ()
 
void blitMirrorTexture (osg::GraphicsContext *gc)
 
void updateEyes (double znear=0.015, double zfar=10000)
 
Initialization functions
virtual bool initialize ()
 
virtual void initializeOculusDevice (osg::RenderInfo &renderInfo)
 
virtual void initializeOculusChannel ()
 
- Protected Member Functions inherited from makVrv::DtOsgChannel
 DtOsgChannel (DtDe &de, DtOsgWindow *window, DtChannelConfiguration &config)
 
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)
 
virtual bool useAttachedForNearClip (double alt)
 
virtual double calculateNearClip (double alt, double zFar)
 
virtual double calculateFarClip (double alt)
 
virtual double calculateNearClipMagClamp (double zNear, double zFar, float magLevel=2.)
 
virtual void projectFor2D ()
 
virtual void connectRttCameraToScene ()
 
virtual void stopUsingModelSet (DtModelSetId modelSet)
 
virtual void startUsingModelSet (DtModelSetId modelSet)
 
virtual void slot_visualizerRootAdded (DtModelSetId modelSet, int visualType)
 
virtual void slot_shadowsRemoved ()
 
virtual void slot_observerModelSetChanged (DtObserverObject *observer, DtModelSetId modelSet)
 
virtual void slot_observerSettingChanged (DtObserverObject *observer, int setting, bool value)
 
virtual void slot_observerSettingRemoved (DtObserverObject *observer, int setting)
 
virtual void slot_observerColorControlChanged (DtObserverObject *observer)
 
virtual void slot_projectionChanged (DtObserverObject *observer, bool is2D)
 
virtual void slot_windowConfigurationModified (const std::string &deName, const std::string &oldWindowName, const DtWindowConfiguration &config)
 
virtual void slot_channelConfigurationModified (const std::string &deName, const std::string &windowName, const std::string &oldChannelName, const DtChannelConfiguration &channelConfig)
 
virtual void slot_onCoordinateSystemChanged ()
 
virtual void slot_paperMapEnabledChanged (bool setting)
 
virtual void observerRemoved (const std::string &observerName)
 
virtual void updateMultiSampleOverrideSetting ()
 
virtual void getRenderTextureAttachmentInfo (unsigned int &level, unsigned int &face, unsigned int &sampleBuffers, unsigned int &samples)
 
virtual void initializeRenderTextureColor ()
 
virtual void initializeRenderTextureDepth ()
 
virtual void initializeRttCameraDepth ()
 
virtual void changedRttCameraFbo ()
 
virtual void enableLighting (osg::ref_ptr< osg::Camera > camera, bool enable)
 
virtual void calculateAndSetFocusPointDistance (double zNear, double zFar)
 
osgViewer::CompositeViewer * getOrCreateViewer ()
 
virtual void flipHorizontal (bool flip)
 
bool anyPointInFrustum (const std::vector< DtVector4< double >> &camPlanes, const std::vector< DtVector > &points) const
 
virtual void initializeNormalized2DCamera ()
 
virtual void initialize2DCamera (int w, int h)
 
virtual void initializeSceneCamera ()
 
virtual void initializeRenderTexture ()
 
virtual void initializeRTTCamera ()
 
virtual void clearRttCamera ()
 
virtual void recreateRTTCamera ()
 
virtual void setShadowState (bool enable)
 
virtual void addOverlayDrawablesToCameras ()
 
virtual void initializeSignalConnections ()
 
- Protected Member Functions inherited from makVrv::DtChannel
 DtChannel (DtDe &de, DtChannelConfiguration &)
 
virtual void observerAdded (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
 
bool mySensorInitialized
 
bool myChannelEnabled
 
osg::ref_ptr< osg::Group > myRoot
 
osg::ref_ptr< DtCameraNodemySceneCamera
 
osg::ref_ptr< DtCameraNodemy2DCamera
 
osg::ref_ptr< DtCameraNodemyNormalized2DCamera
 
osg::ref_ptr< osg::Texture > myRenderTexture
 
osg::ref_ptr< osg::Texture > myDepthTexture
 
osg::ref_ptr< osg::Texture > myOcclusionTexture
 
bool myDepthTextureUsesStencilBuffer
 
osg::ref_ptr< DtCameraNodemyRTTCamera
 
bool myIsUsingTrackballManipulator
 
bool myCoordinateSystemChanged
 
bool myRenderToTextureFlag
 
bool myShadowState
 
PostProcessorEffectList myPostProcessorEffects
 
osg::Node::NodeMask myOldSceneCameraNodeMask
 
osg::Node::NodeMask myOldRTTCameraNodeMask
 
DtLightmyFlashlight
 
bool myEnablePostProcessors
 
bool myUseOldChannelOffsetCalcuation
 
osg::ref_ptr
< osg::DatabaseRequestHandlerCallback > 
myDatabasePagerCallback
 
bool myEnableHdrPassthrough
 
bool myForceHdrLuminanceOverride
 
float myHdrOutputScale
 
bool myFrameBufferNeedsClear
 
bool myLastMirrorMode
 
double myPreviousClampedNearClipDistance
 
int myLastNumMultiSamplesOverride
 
std::vector< osg::Vec3d > myFocusPoints
 
int myLastFocusPointAttempted
 
DtOsgChannelSensormyChannelSensor
 
bool myShowTracksEnabled
 
DtIntersectorsContainermyIntersectors = nullptr
 
DtOsgEmptySceneLogomyEmptySceneLogo
 
- Protected Attributes inherited from makVrv::DtChannel
DtDemyDe
 
DtChannelConfigurationmyChannelConfiguration
 
DtSignalConnectionManager myConnections
 
DtModelSetId 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::signalslib::signal
< void(int, int, int, int)> 
signal_viewportChanged
 
- Protected Types inherited from makVrv::DtOsgChannel
typedef std::map< int,
DtChannelSpecificGroup * > 
VisualTypeMap
 
- Static Protected Attributes inherited from makVrv::DtOsgChannel
static int theRunningCameraId
 

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 Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)