VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOculusChannel.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2015 MAK Technologies, Inc.
3  * All rights reserved.
4  ******************************************************************************/
5 
9 
10 #pragma once
11 
14 
15 #include <vrvOsg/DtOsgChannel.h>
16 
17 #include <vrvUtil/DtQuat.h>
18 
20 
21 #include <OVR_CAPI.h>
22 #include <OVR_CAPI_GL.h>
23 
24 
25 #ifdef LEAP_SUPPORT
26 #include <Leap.h>
27 #endif
28 
29 union ovrGLConfig;
30 
31 namespace makVrv
32 {
36  {
37  protected:
38  friend class DtOculusChannelCreator;
39  friend class DtOculusDrawable;
40  friend class DtOculusSwapCallback;
41 
45  DtOculusChannel(DtDe& de, DtOsgWindow* window,
46  DtChannelConfiguration& config);
47 
49  virtual ~DtOculusChannel();
50 
52 
53 
55  virtual bool initialize();
56 
60  virtual void initializeOculusDevice(osg::RenderInfo& renderInfo);
61 
63  virtual void initializeOculusChannel();
65 
67  virtual void update();
68 
71  virtual void updateProjection();
72 
75  virtual void projectFor3D();
76 
78  virtual void setupCullVisitor(const osg::observer_ptr<osg::Camera>& camera);
79 
81  osg::Camera* createRTTCamera(int eye);
82 
87  virtual float getPixelsPerDisplayPixel();
88 
91  void blitMirrorTexture(osg::GraphicsContext *gc);
92 
93  public:
94 
96  virtual void resetSensor();
97 
100  virtual void onPreTick();
101 
105  virtual void onPostTick();
106 
109  virtual void onShutdown();
110 
113  //virtual void warnOnOVRErrors();
114 
119 
120  virtual void setMirroring(int view);
121  virtual int mirroring();
123 
125  virtual std::vector<const osg::Camera*> getShadowableCameras() const;
126 
127  virtual DtQuat hmdOrientation() {return DtQuat(myHmdOrientation.x(), myHmdOrientation.y(), myHmdOrientation.z(), myHmdOrientation.w()); }
128  virtual DtVector hmdPosition() {return DtVector(myHmdPosition.x(), myHmdPosition.y(), myHmdPosition.z()); }
129 
130  protected:
131  void updateEyes(double znear = 0.015, double zfar = 10000);
132 
133  ovrSession mySession;
134  ovrHmdDesc myHmdDesc;
135  ovrPosef myEyeRenderPose[2];
136  ovrEyeRenderDesc myEyeRenderDesc[2];
137  ovrFovPort myEyeFov[2];
138  ovrLayerEyeFov myLayer;
139 
142 
144 
147 
148  osg::ref_ptr<osg::Camera> myRTTCameras[2];
151 
152  osg::Quat myHmdOrientation;
153  osg::Vec3d myHmdPosition;
156  osg::Matrixf myLeftEyeViewMatrix;
157  osg::Matrixf myRightEyeViewMatrix;
158 
162 
165 
167 
169 
170 #ifdef LEAP_SUPPORT
171  Leap::Controller myLeapController;
172  double myLastSimulationTime;
173 #endif
174  };
175 
179  {
180  public:
182  virtual DtChannel* create(DtDe& de, DtWindow* window, DtChannelConfiguration& config);
183  };
184 
189  class DT_DLL_VRVOCULUSCHANNELPLUGIN DtOculusDrawable : public osg::Drawable
190  {
191  public:
193  DtOculusDrawable(DtOculusChannel* channel) : myOculusChannel(channel) {};
194 
197  virtual void drawImplementation(osg::RenderInfo& renderInfo) const
198  {
199  DtOculusDrawable *mutableThis = const_cast< DtOculusDrawable *>(this);
200  mutableThis->myOculusChannel->initializeOculusDevice(renderInfo);
201  }
202 
203  virtual Object* cloneType() const {
204  return new DtOculusDrawable(myOculusChannel);
205  }
206  virtual Object* clone(const osg::CopyOp& copyop) const {
207  return new DtOculusDrawable(myOculusChannel);
208  }
209  protected:
211  };
212 
214  {
215  public:
216  DtOculusSwapCallback(DtOculusChannel* channel) : myChannel(channel) {};
217  void swapBuffersImplementation(osg::GraphicsContext *);
218 
219  protected:
221  };
222 }
virtual DtQuat hmdOrientation()
Definition: DtOculusChannel.h:127
Definition: DtOculusChannel.h:213
#define DT_DLL_VRVOCULUSCHANNELPLUGIN
Definition: vrvOculusChannelPlugin.h:18
Abstract Base class.
Definition: DtWindow.h:25
bool myFrameStarted
Definition: DtOculusChannel.h:143
osg::ref_ptr< osg::Group > myOculusDrawableGroup
Definition: DtOculusChannel.h:160
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
When this is called the graphics context is good to go and the Oculus can be fully initialized...
Definition: DtOculusChannel.h:197
Contains makVrv::DtOsgChannel class.
DtOculusChannel * myOculusChannel
Definition: DtOculusChannel.h:210
virtual void initializeOculusDevice(osg::RenderInfo &renderInfo)
Configures the HMD created in the plugin, including the rendering &amp; tracking configuration.
The abstract channel creator for the abstract channel class.
Definition: DtChannel.h:161
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:75
osg::ref_ptr< OculusMirrorTexture > myMirrorTexture
Definition: DtOculusChannel.h:141
bool myOculusInitialized
Definition: DtOculusChannel.h:161
virtual Object * clone(const osg::CopyOp &copyop) const
Definition: DtOculusChannel.h:206
virtual DtVector hmdPosition()
Definition: DtOculusChannel.h:128
osg::ref_ptr< DtOculusDrawable > myOculusDrawable
Definition: DtOculusChannel.h:159
The abstract Channel Class.
Definition: DtChannel.h:29
osg::Quat myHmdOrientation
Definition: DtOculusChannel.h:152
osg::ref_ptr< osg::Billboard > myHUDBillboard
Definition: DtOculusChannel.h:163
ovrHmdDesc myHmdDesc
Definition: DtOculusChannel.h:134
This is modeled after the DtTritonDrawable which is used by the DtTritonManager to insure that Triton...
Definition: DtOculusChannel.h:189
virtual Object * cloneType() const
Definition: DtOculusChannel.h:203
The channel creator for the abstract channel class.
Definition: DtOculusChannel.h:178
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:24
DtOculusChannel * myChannel
Definition: DtOculusChannel.h:220
Contains makVrv::DtQuat class.
osg::ref_ptr< osg::GraphicsContext::SwapCallback > mySwapCallback
Definition: DtOculusChannel.h:166
osg::Matrixf myLeftEyeViewMatrix
Definition: DtOculusChannel.h:156
osg::Matrixf myRightEyeViewMatrix
Definition: DtOculusChannel.h:157
osg::Matrixf myLeftEyeProjectionMatrix
Definition: DtOculusChannel.h:154
ovrLayerEyeFov myLayer
Definition: DtOculusChannel.h:138
osg::ref_ptr< osg::Texture2D > myLeftDepthTexture
Definition: DtOculusChannel.h:149
Base class to provide boost signal/slot management.
ovrSession mySession
Definition: DtOculusChannel.h:133
Configuration for a single channel Serialized and sent to remote displays as necessary to configure r...
Definition: DtChannelConfiguration.h:26
osg::ref_ptr< osg::MatrixTransform > myHUDMatrixTransform
Definition: DtOculusChannel.h:164
Extension of OSG channel for Oculus Rift support.
Definition: DtOculusChannel.h:35
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
A utility Quaternion class.
Definition: DtQuat.h:22
DtOculusSwapCallback(DtOculusChannel *channel)
Definition: DtOculusChannel.h:216
osg::Vec3d myHmdPosition
Definition: DtOculusChannel.h:153
osg::Matrixf myRightEyeProjectionMatrix
Definition: DtOculusChannel.h:155
A basic OSG display window, used to get the osg context for a display window.
Definition: DtOsgWindow.h:36
bool myMonoscopic
Definition: DtOculusChannel.h:146
DtSignalConnectionManager myConnections
Definition: DtOculusChannel.h:168
osg::ref_ptr< osg::Texture2D > myRightDepthTexture
Definition: DtOculusChannel.h:150
DtOculusDrawable(DtOculusChannel *channel)
CTOR.
Definition: DtOculusChannel.h:193
int myMirroringView
Definition: DtOculusChannel.h:145

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)