VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVarjoProvider.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
6 #pragma once
7 
11 
12 
15 
16 #include <vrvUtil/DtQuat.h>
17 #include <matrix/vlVector.h>
18 
19 #include <osg/Matrixd>
20 #include <osg/RenderInfo>
21 
24 
25 #include <array>
26 #include <string>
27 
28 #include <Varjo.h>
29 #include <Varjo_events.h>
30 #include <Varjo_layers.h>
31 #include <Varjo_mr.h>
32 #include <Varjo_world.h>
33 
34 
35 #define VARJO_USE_GAZE 1
36 
37 namespace makVrv
38 {
39 
40  class DtVirtualRealityChannel;
41 
45 
47  {
48  public:
51 
53  virtual ~DtVarjoVrsUpdater();
54 
56  void setEyeCenters(osg::Vec2 leftEye, osg::Vec2 rightEye);
57 
58  private:
61 
64 
66  DtVarjoVrsUpdater& operator=(const DtVarjoVrsUpdater&);
67 
68  protected:
71  virtual void update(osg::State* state) const;
72 
74  virtual void initProgram(osg::State* state) const;
75 
76  protected:
77 
83 
84  mutable osg::Vec2 myEyeCenters[2];
85 
86  };
87 
90 
92  {
93  public:
94 
97  struct ViewSettings
98  {
100  ViewSettings(): myNearClip(1), myFarClip(10)
101  {
102  //intentional nop
103  }
104 
105  double myNearClip;
106  double myFarClip;
107  };
108 
109  public:
111  DtVarjoProvider(DtDe& de);
112 
114  virtual ~DtVarjoProvider();
115 
116  private:
118  DtVarjoProvider();
119 
122 
124  DtVarjoProvider& operator=(const DtVarjoProvider&);
125 
126  public:
127 
129  virtual DtSubmitOverlayCallback* createOverlayCallback(osg::Texture* tex, DtDe& de, DtVirtualRealityDriver& driver);
130 
133 
135  virtual const std::string& providerName();
136 
138  virtual const std::string& deviceName();
139 
141  virtual bool initializeVR();
142 
144  virtual bool hasFocusViews();
145 
147  virtual bool useVrs();
148 
150  virtual DtVariableRateShadingImageUpdater* findVrsUpdater(DtVirtualRealityChannel* channel);
151 
153  virtual void getRecommendedRenderTargetSize(int& width, int& height, vrvVirtualReality::DtEye whichEye);
154 
156  virtual void getProjectionAngles(vrvVirtualReality::DtEye eye, double& left, double& right, double& bottom, double& top, double znear, double zfar);
157 
159  virtual osg::Matrixd getEyeToHeadTransform(vrvVirtualReality::DtEye eye);
160 
162  virtual void tick();
163 
165  virtual bool getHmdPose(DtVector& pos, DtQuat& ori);
166 
168  virtual void setHmdPoseOffset(const DtVector& pos, const DtQuat& ori);
169 
171  virtual bool getTrackedPose(DtVector& pos, DtQuat& ori, int index);
172 
174  virtual const std::unordered_map<int64_t, DtTrackedMarker>& getTrackedMarkers() const;
175 
177  virtual bool reset();
178 
180  virtual bool shutdown();
181 
183  virtual bool hasTrackedCamera();
184 
186  virtual DtTrackedCamera* findTrackedCamera();
187 
189  virtual DtMixedRealityMask* findMixedRealityMask();
190 
192  virtual bool useStereoOverlay();
193 
195  virtual bool supportsDirectMirroring();
196 
198  virtual void startMixedReality();
199 
201  virtual void stopMixedReality();
202 
204  virtual bool supportsMixedReality();
205 
207  virtual bool supportsDepthBufferSubmission();
208 
210  virtual bool supportsRealWorldDepthTesting();
211 
213  virtual void startRealWorldDepthTesting();
214 
216  virtual void stopRealWorldDepthTesting();
217 
219  void setOverlayEnabled(bool enabled);
220 
221  // need to do this to turn on mr
222  void calibrateEyeTracking();
223 
225 
227  varjo_Session* findVarjoSystem() const;
228 
230  void commitEyeTexture(vrvVirtualReality::DtEye eye, varjo_SwapChain* swapChain, varjo_SwapChain* depthSwapChain, osg::RenderInfo& renderInfo);
231 
233  void commitEyeTexture(unsigned int viewIndex, varjo_Viewport& viewPort, int layer, varjo_SwapChain* swapChain, varjo_SwapChain* depthSwapChain);
234 
236  void commitHudTexture(unsigned int viewIndex, int width, int height, varjo_SwapChain* swapChain, osg::RenderInfo& renderInfo);
237 
238  public:
239 
242  static bool isVrAvailable();
243 
244  protected:
245 
247  virtual void beginFrame();
248 
250  virtual void beginRendering();
251 
253  virtual void endRendering();
254 
256  virtual void initViewports();
257 
259  virtual void updateEyeProjections();
260 
262  virtual void updateEyeProjections(unsigned int viewIndex, DtVirtualRealityChannel* vrChannel, unsigned int layer, bool updateVarjoViewOnly = false, bool isHudView = false);
263 
265  varjo_Viewport calculateFocusRect(varjo_Viewport contextViewport, const double focusProjectionMatrix[16], const double contextProjectionMatrix[16]);
266 
267 #if VARJO_USE_GAZE == 1
268  varjo_Error initGaze();
270 
272  bool getGazeNormalizedCoords(const osg::Matrixd& leftProjection, const osg::Matrixd& rightProjection,
273  osg::Vec2* left, osg::Vec2* right) const;
274 #endif
275 
276  protected:
277 
278  varjo_Session* myVarjoSession;
279  int32_t myViewCount;
280  std::vector<varjo_Viewport> myViewports;
281  std::vector<ViewSettings> myViewSettings;
283  std::vector<varjo_LayerMultiProjView> myMultiprojectionViews;
284  std::vector<varjo_ViewExtensionDepth> myExtDepthViews;
285  std::vector<varjo_ViewExtensionDepthTestRange> myExtDepthTestRangeViews;
286  std::vector<varjo_LayerMultiProjView> myHudViews;
287  varjo_FrameInfo* myFrameInfo;
288  std::string myDeviceName;
289 
292  osg::Vec3d myHmdPostionOffset;
294 
295  varjo_World* myVarjoWorld;
296  std::unordered_map<int64_t, DtTrackedMarker> myTrackedMarkers;
297 
299  std::map<DtVirtualRealityChannel*, osg::ref_ptr<DtVarjoVrsUpdater> > myChannelVrsUpdaters;
300 
303  };
304 }
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
Drawable and pre Drawcallback that draw full screen quad to update vrs image.
std::vector< varjo_LayerMultiProjView > myMultiprojectionViews
Definition: DtVarjoProvider.h:283
std::vector< varjo_ViewExtensionDepth > myExtDepthViews
Definition: DtVarjoProvider.h:284
std::map< DtVirtualRealityChannel *, osg::ref_ptr< DtVarjoVrsUpdater > > myChannelVrsUpdaters
out vrs updater
Definition: DtVarjoProvider.h:299
Wrapper around Nvidia Variable Rate Shading Image functionality Creates a texture of the correct size...
Definition: DtVariableRateShadingImage.h:75
GLint myStepsUniformLocation
Definition: DtVarjoProvider.h:82
DtVirtualRealityDriver * myDriverHandle
store a handle to the driver to avoid repeated lookup
Definition: DtVarjoProvider.h:302
bool myEyeTrackingInitalized
Definition: DtVarjoProvider.h:290
GLint myEyeCenterRightUniformLocation
Definition: DtVarjoProvider.h:80
Contains DLL export macros.
osg::Vec3d myHmdPostionOffset
Definition: DtVarjoProvider.h:292
std::vector< ViewSettings > myViewSettings
Definition: DtVarjoProvider.h:281
bool myHaveCalibratedEyeTracking
Definition: DtVarjoProvider.h:291
ViewSettings()
CTOR.
Definition: DtVarjoProvider.h:100
A Varjo implementation of the DtVirtualRealityProvider abstract base class.
Definition: DtVarjoProvider.h:91
An abstract interface that provides VR System API services.
A Tracked camera is typically attached to the HMD and can provide position and orientation data in ad...
Definition: DtTrackedCamera.h:27
double myFarClip
Definition: DtVarjoProvider.h:106
Base class for GPU updates of the variable rate shading image Draw a full screen quad using a shader ...
Definition: DtVariableRateShadingImageUpdater.h:26
std::vector< varjo_Viewport > myViewports
Definition: DtVarjoProvider.h:280
A driver that manages virtual reality HMD and input devices.
Definition: DtVirtualRealityDriver.h:51
#define DT_DLL_VRVVR
Definition: vrvVirtualReality.h:19
A Varjo implementation of the DtVariableRateShadingImageUpdater Supports updating the vrs map as foav...
Definition: DtVarjoProvider.h:46
DtEye
A virtual reality eye.
Definition: vrvVirtualReality.h:38
varjo_Session * myVarjoSession
Definition: DtVarjoProvider.h:278
osg::Quat myHmdRotationOffset
Definition: DtVarjoProvider.h:293
GLint myEyeCenterLeftUniformLocation
Definition: DtVarjoProvider.h:79
GLint myEdgeUniformLocation
Definition: DtVarjoProvider.h:81
std::vector< varjo_ViewExtensionDepthTestRange > myExtDepthTestRangeViews
Definition: DtVarjoProvider.h:285
An abstract interface that provides VR System API services.
Definition: DtVirtualRealityProvider.h:45
Contains makVrv::DtQuat class.
A VRV channel that represents the eyes of the HMD A Virtual Reality channel can render in a few diffe...
Definition: DtVirtualRealityChannel.h:29
Object to handle rendering a mixed reality mask object into the scene.
Definition: DtMixedRealityMask.h:38
An OSG camera callback that will submit the channel to the underlying VR system as an overlay channel...
Definition: DtSubmitOverlayCallback.h:26
varjo_World * myVarjoWorld
Definition: DtVarjoProvider.h:295
bool myUseDepthLayers
Definition: DtVarjoProvider.h:282
std::vector< varjo_LayerMultiProjView > myHudViews
Definition: DtVarjoProvider.h:286
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
A utility Quaternion class.
Definition: DtQuat.h:19
std::unordered_map< int64_t, DtTrackedMarker > myTrackedMarkers
Definition: DtVarjoProvider.h:296
varjo_FrameInfo * myFrameInfo
Definition: DtVarjoProvider.h:287
double myNearClip
Definition: DtVarjoProvider.h:105
Wraps functionality of Variable Rate Shading Image.
std::string myDeviceName
Definition: DtVarjoProvider.h:288
A post processing effect responsible for submitting and mirroring the eye views to the VR subsystem...
Definition: DtVirtualRealityPostProcessor.h:34
An OSG camera callback that will submit the channel to the underlying VR system as an overlay channel...
Definition: DtSubmitViewCallback.h:29
Holds settings related to a view.
Definition: DtVarjoProvider.h:97
GLint myEyeCenterUniformLocation
Definition: DtVarjoProvider.h:78
int32_t myViewCount
Definition: DtVarjoProvider.h:279

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)