VR-Forces 5.0.2 Developer's Guide
 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) 2022 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 #include <thread>
28 
29 #include <Varjo.h>
30 #include <Varjo_events.h>
31 #include <Varjo_layers.h>
32 #include <Varjo_mr.h>
33 #include <Varjo_world.h>
34 
35 
36 #define VARJO_USE_GAZE 1
37 
38 namespace makVrv
39 {
40 
41  class DtVirtualRealityChannel;
42  class DtVrsGazeMapUpdater;
43  class DtVarjoBeginFrameCallback;
44  class DtVarjoWaitForSyncThread;
45 
48 
50  {
51  public:
54 
57  struct ViewSettings
58  {
60  ViewSettings(): myNearClip(1), myFarClip(10)
61  {
62  //intentional nop
63  }
64 
65  double myNearClip;
66  double myFarClip;
67  };
68 
69  public:
71  DtVarjoProvider(DtDe& de);
72 
74  virtual ~DtVarjoProvider();
75 
76  private:
79 
82 
84  DtVarjoProvider& operator=(const DtVarjoProvider&);
85 
86  public:
87 
89  virtual DtSubmitOverlayCallback* createOverlayCallback(osg::Texture* tex, DtDe& de, DtVirtualRealityDriver& driver);
90 
93 
95  virtual DtBeginFrameCallback* createBeginFrameCallback(DtVirtualRealityDriver& driver, vrvVirtualReality::DtEye eye);
96 
98  virtual const std::string& providerName();
99 
101  virtual const std::string& deviceName();
102 
104  virtual bool initializeVR();
105 
107  virtual bool hasFocusViews();
108 
110  virtual bool useVrs();
111 
113  virtual DtVariableRateShadingImageUpdater* findVrsUpdater(DtVirtualRealityChannel* channel);
114 
116  virtual void getRecommendedRenderTargetSize(int& width, int& height, vrvVirtualReality::DtEye whichEye);
117 
119  virtual DtSwapChain* allocateSwapChain(vrvVirtualReality::DtEye whichEye, bool isOverlay);
120 
122  virtual void getProjectionAngles(vrvVirtualReality::DtEye eye, double& left, double& right, double& bottom, double& top, double znear, double zfar);
123 
125  virtual osg::Matrixd getEyeToHeadTransform(vrvVirtualReality::DtEye eye);
126 
128  virtual void commitEyeTexture(osg::RenderInfo& renderInfo, DtSwapChain* swapChain);
129 
131  virtual void commitHudTexture(osg::RenderInfo& renderInfo, DtSwapChain* swapChain);
132 
134  virtual void updateOverlayDimensions(float width, float height, float distance, int pixWidth, int pixHeight);
135 
137  virtual void tick();
138 
140  virtual bool getHmdPose(DtVector& pos, DtQuat& ori);
141 
143  virtual void setHmdPoseOffset(const DtVector& pos, const DtQuat& ori);
144 
146  virtual bool getTrackedPose(DtVector& pos, DtQuat& ori, int index);
147 
149  virtual const std::unordered_map<int64_t, DtTrackedMarker>& getTrackedMarkers() const;
150 
152  virtual bool reset();
153 
155  virtual void triggerAction1();
156 
158  virtual bool shutdown();
159 
161  virtual bool hasTrackedCamera();
162 
164  virtual DtTrackedCamera* findTrackedCamera();
165 
167  virtual DtMixedRealityMask* findMixedRealityMask();
168 
170  virtual vrvVirtualReality::DtVrOverlayMode overlayMode();
171 
173  virtual void startMixedReality();
174 
176  virtual void stopMixedReality();
177 
179  virtual bool supportsMixedReality();
180 
182  virtual bool supportsDepthBufferSubmission();
183 
185  virtual bool supportsRealWorldDepthTesting();
186 
188  virtual void startRealWorldDepthTesting();
189 
191  virtual void stopRealWorldDepthTesting();
192 
194  void setOverlayEnabled(bool enabled);
195 
196  // need to do this to turn on mr
197  void calibrateEyeTracking();
198 
200 
202  varjo_Session* findVarjoSystem() const;
203 
204  public:
205 
208  static bool isVrAvailable();
209 
210  protected:
211 
213  void invokeWaitForSyncOp();
214 
216  void blockTillWaitForSyncComplete();
217 
219  virtual void beginFrame();
220 
222  virtual void beginRendering();
223 
225  virtual void endRendering();
226 
228  virtual void initViewports();
229 
231  void commitEyeTexture(unsigned int viewIndex, varjo_Viewport& viewPort, int layer, varjo_SwapChain* swapChain, varjo_SwapChain* depthSwapChain);
232 
234  void commitHudTexture(unsigned int viewIndex, varjo_Viewport viewPort, varjo_SwapChain* swapChain);
235 
237  virtual void updateEyeProjections();
238 
240  virtual void updateEyeProjections(unsigned int viewIndex, DtVirtualRealityChannel* vrChannel, unsigned int layer, bool updateVarjoViewOnly = false, bool isHudView = false);
241 
243  varjo_Viewport calculateFocusRect(varjo_Viewport contextViewport, const double focusProjectionMatrix[16], const double contextProjectionMatrix[16]);
244 
245 #if VARJO_USE_GAZE == 1
246  varjo_Error initGaze();
248 
250  bool getGazeNormalizedCoords(const osg::Matrixd& leftProjection, const osg::Matrixd& rightProjection,
251  osg::Vec2* left, osg::Vec2* right) const;
252 #endif
253 
254  protected:
255 
256  varjo_Session* myVarjoSession;
257  int32_t myViewCount;
258  std::vector<varjo_Viewport> myViewports;
259  std::vector<ViewSettings> myViewSettings;
261  std::vector<varjo_LayerMultiProjView> myMultiprojectionViews;
262  std::vector<varjo_ViewExtensionDepth> myExtDepthViews;
263  std::vector<varjo_ViewExtensionDepthTestRange> myExtDepthTestRangeViews;
264  std::vector<varjo_LayerMultiProjView> myHudViews;
265  varjo_FrameInfo* myFrameInfo;
266  std::string myDeviceName;
267 
270  osg::Vec3d myHmdPostionOffset;
272 
273  varjo_World* myVarjoWorld;
274  std::unordered_map<int64_t, DtTrackedMarker> myTrackedMarkers;
275 
276  //std::thread* myWaitForSyncThread;
277  DtVarjoWaitForSyncThread* myWaitForSyncThread;
278  };
279 }
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:261
std::vector< varjo_ViewExtensionDepth > myExtDepthViews
Definition: DtVarjoProvider.h:262
bool myEyeTrackingInitalized
Definition: DtVarjoProvider.h:268
Contains DLL export macros.
osg::Vec3d myHmdPostionOffset
Definition: DtVarjoProvider.h:270
std::vector< ViewSettings > myViewSettings
Definition: DtVarjoProvider.h:259
bool myHaveCalibratedEyeTracking
Definition: DtVarjoProvider.h:269
ViewSettings()
CTOR.
Definition: DtVarjoProvider.h:60
A Varjo implementation of the DtVirtualRealityProvider abstract base class.
Definition: DtVarjoProvider.h:49
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:66
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:258
A driver that manages virtual reality HMD and input devices.
Definition: DtVirtualRealityDriver.h:52
#define DT_DLL_VRVVR
Definition: vrvVirtualReality.h:19
DtEye
A virtual reality eye.
Definition: vrvVirtualReality.h:37
varjo_Session * myVarjoSession
Definition: DtVarjoProvider.h:256
osg::Quat myHmdRotationOffset
Definition: DtVarjoProvider.h:271
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
Base implementation of a texture swapchain.
Definition: DtSwapChain.h:35
An OSG camera predraw callback, can be used as a sync point.
Definition: DtBeginFrameCallback.h:23
std::vector< varjo_ViewExtensionDepthTestRange > myExtDepthTestRangeViews
Definition: DtVarjoProvider.h:263
An abstract interface that provides VR System API services. Providers are created and provided to the...
Definition: DtVirtualRealityProvider.h:47
Contains makVrv::DtQuat class.
DtVrOverlayMode
Virtual reality render mode.
Definition: vrvVirtualReality.h:63
DtVarjoWaitForSyncThread * myWaitForSyncThread
Definition: DtVarjoProvider.h:277
A VRV channel that represents the eyes of the HMD A Virtual Reality channel can render in a few diffe...
Definition: DtVirtualRealityChannel.h:30
Object to handle rendering a mixed reality mask object into the scene. Typically the it renders an ob...
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:30
friend DtVarjoBeginFrameCallback
Definition: DtVarjoProvider.h:52
varjo_World * myVarjoWorld
Definition: DtVarjoProvider.h:273
bool myUseDepthLayers
Definition: DtVarjoProvider.h:260
std::vector< varjo_LayerMultiProjView > myHudViews
Definition: DtVarjoProvider.h:264
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
A utility Quaternion class.
Definition: DtQuat.h:19
std::unordered_map< int64_t, DtTrackedMarker > myTrackedMarkers
Definition: DtVarjoProvider.h:274
varjo_FrameInfo * myFrameInfo
Definition: DtVarjoProvider.h:265
double myNearClip
Definition: DtVarjoProvider.h:65
friend DtVarjoWaitForSyncThread
Definition: DtVarjoProvider.h:53
Wraps functionality of Variable Rate Shading Image.
std::string myDeviceName
Definition: DtVarjoProvider.h:266
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:30
Holds settings related to a view.
Definition: DtVarjoProvider.h:57
int32_t myViewCount
Definition: DtVarjoProvider.h:257

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)