VR-Forces 4.8 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) 2020 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 
33 
34 #define VARJO_USE_GAZE 1
35 
36 namespace makVrv
37 {
38 
39  class DtVirtualRealityChannel;
40 
44 
46  {
47  public:
50 
52  virtual ~DtVarjoVrsUpdater();
53 
55  void setEyeCenters(osg::Vec2 leftEye, osg::Vec2 rightEye);
56 
57  private:
60 
63 
65  DtVarjoVrsUpdater& operator=(const DtVarjoVrsUpdater&);
66 
67  protected:
70  virtual void update(osg::State* state) const;
71 
73  virtual void initProgram(osg::State* state) const;
74 
75  protected:
76 
82 
83  mutable osg::Vec2 myEyeCenters[2];
84 
85  };
86 
89 
91  {
92  public:
93 
96  struct ViewSettings
97  {
99  ViewSettings(): myNearClip(1), myFarClip(10)
100  {
101  //intentional nop
102  }
103 
104  double myNearClip;
105  double myFarClip;
106  };
107 
108  public:
110  DtVarjoProvider(DtDe& de);
111 
113  virtual ~DtVarjoProvider();
114 
115  private:
117  DtVarjoProvider();
118 
121 
123  DtVarjoProvider& operator=(const DtVarjoProvider&);
124 
125  public:
126 
128  virtual DtSubmitOverlayCallback* createOverlayCallback(osg::Texture2D* tex, DtDe& de, DtVirtualRealityDriver& driver);
129 
132 
134  virtual const std::string& providerName();
135 
137  virtual const std::string& deviceName();
138 
140  virtual bool initializeVR();
141 
143  virtual bool hasFocusViews();
144 
146  virtual bool useVrs();
147 
149  virtual DtVariableRateShadingImageUpdater* findVrsUpdater(DtVirtualRealityChannel* channel);
150 
152  virtual void getRecommendedRenderTargetSize(int& width, int& height, vrvVirtualReality::DtEye whichEye);
153 
155  virtual void getProjectionAngles(vrvVirtualReality::DtEye eye, double& left, double& right, double& bottom, double& top, double znear, double zfar);
156 
158  virtual osg::Matrixd getEyeToHeadTransform(vrvVirtualReality::DtEye eye);
159 
161  virtual void tick();
162 
164  virtual bool getHmdPose(DtVector& pos, DtQuat& ori);
165 
167  virtual bool getTrackedPose(DtVector& pos, DtQuat& ori, int index);
168 
170  virtual bool reset();
171 
173  virtual bool shutdown();
174 
176  virtual bool hasTrackedCamera();
177 
179  virtual DtTrackedCamera* findTrackedCamera();
180 
182  virtual DtMixedRealityMask* findMixedRealityMask();
183 
185  void setOverlayEnabled(bool enabled);
186 
188 
190  varjo_Session* findVarjoSystem() const;
191 
193  void commitEyeTexture(vrvVirtualReality::DtEye eye, varjo_SwapChain* swapChain, varjo_SwapChain* depthSwapChain, osg::RenderInfo& renderInfo);
194 
196  void commitEyeTexture(unsigned int viewIndex, varjo_Viewport& viewPort, int layer, varjo_SwapChain* swapChain, varjo_SwapChain* depthSwapChain);
197 
199  void commitHudTexture(unsigned int viewIndex, int width, int height, varjo_SwapChain* swapChain, osg::RenderInfo& renderInfo);
200 
201  public:
202 
205  static bool isVrAvailable();
206 
207  protected:
208 
210  virtual void beginFrame();
211 
213  virtual void beginRendering();
214 
216  virtual void endRendering();
217 
219  virtual void initViewports();
220 
222  virtual void updateEyeProjections();
223 
225  virtual void updateEyeProjections(unsigned int viewIndex, DtVirtualRealityChannel* vrChannel, unsigned int layer, bool updateVarjoViewOnly = false);
226 
228  varjo_Viewport calculateFocusRect(varjo_Viewport contextViewport, const double focusProjectionMatrix[16], const double contextProjectionMatrix[16]);
229 
230 #if VARJO_USE_GAZE == 1
231  varjo_Error initGaze() const;
233 
235  bool getGazeNormalizedCoords(const osg::Matrixd& leftProjection, const osg::Matrixd& rightProjection,
236  osg::Vec2* left, osg::Vec2* right) const;
237 #endif
238 
239  protected:
240 
241  varjo_Session* myVarjoSession;
242  int32_t myViewCount;
243  std::vector<varjo_Viewport> myViewports;
244  std::vector<ViewSettings> myViewSettings;
246  std::vector<varjo_LayerMultiProjView> myMultiprojectionViews;
247  std::vector<varjo_ViewExtensionDepth> myExtDepthViews;
248  std::vector<varjo_ViewExtensionDepthTestRange> myExtDepthTestRangeViews;
249  std::vector<varjo_LayerMultiProjView> myHudViews;
250  varjo_FrameInfo* myFrameInfo;
251  std::string myDeviceName;
254  osg::Vec3d myInvResetPos;
255 
257  std::map<DtVirtualRealityChannel*, osg::ref_ptr<DtVarjoVrsUpdater> > myChannelVrsUpdaters;
258 
261  };
262 }
osg::Vec3d myInvResetPos
Definition: DtVarjoProvider.h:254
Drawable and pre Drawcallback that draw full screen quad to update vrs image.
std::vector< varjo_LayerMultiProjView > myMultiprojectionViews
Definition: DtVarjoProvider.h:246
std::vector< varjo_ViewExtensionDepth > myExtDepthViews
Definition: DtVarjoProvider.h:247
std::map< DtVirtualRealityChannel *, osg::ref_ptr< DtVarjoVrsUpdater > > myChannelVrsUpdaters
out vrs updater
Definition: DtVarjoProvider.h:257
Wrapper around Nvidia Variable Rate Shading Image functionality Creates a texture of the correct size...
Definition: DtVariableRateShadingImage.h:75
GLint myStepsUniformLocation
Definition: DtVarjoProvider.h:81
DtVirtualRealityDriver * myDriverHandle
store a handle to the driver to avoid repeated lookup
Definition: DtVarjoProvider.h:260
GLint myEyeCenterRightUniformLocation
Definition: DtVarjoProvider.h:79
Contains DLL export macros.
std::vector< ViewSettings > myViewSettings
Definition: DtVarjoProvider.h:244
bool myHaveCalibratedEyeTracking
Definition: DtVarjoProvider.h:253
ViewSettings()
CTOR.
Definition: DtVarjoProvider.h:99
A Varjo implementation of the DtVirtualRealityProvider abstract base class.
Definition: DtVarjoProvider.h:90
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:105
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:243
A driver that manages virtual reality HMD and input devices.
Definition: DtVirtualRealityDriver.h:49
#define DT_DLL_VRVVR
Definition: vrvVirtualReality.h:19
A Varjo implementation of the DtVariableRateShadingImageUpdater Supports updating the vrs map as foav...
Definition: DtVarjoProvider.h:45
DtEye
A virtual reality eye.
Definition: vrvVirtualReality.h:37
varjo_Session * myVarjoSession
Definition: DtVarjoProvider.h:241
GLint myEyeCenterLeftUniformLocation
Definition: DtVarjoProvider.h:78
GLint myEdgeUniformLocation
Definition: DtVarjoProvider.h:80
std::vector< varjo_ViewExtensionDepthTestRange > myExtDepthTestRangeViews
Definition: DtVarjoProvider.h:248
An abstract interface that provides VR System API services.
Definition: DtVirtualRealityProvider.h:43
Contains makVrv::DtQuat class.
bool myMixedRealityAvailable
Definition: DtVarjoProvider.h:252
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:32
An OSG camera callback that will submit the channel to the underlying VR system as an overlay channel...
Definition: DtSubmitOverlayCallback.h:26
bool myUseDepthLayers
Definition: DtVarjoProvider.h:245
std::vector< varjo_LayerMultiProjView > myHudViews
Definition: DtVarjoProvider.h:249
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
A utility Quaternion class.
Definition: DtQuat.h:22
varjo_FrameInfo * myFrameInfo
Definition: DtVarjoProvider.h:250
double myNearClip
Definition: DtVarjoProvider.h:104
Wraps functionality of Variable Rate Shading Image.
std::string myDeviceName
Definition: DtVarjoProvider.h:251
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:96
GLint myEyeCenterUniformLocation
Definition: DtVarjoProvider.h:77
int32_t myViewCount
Definition: DtVarjoProvider.h:242

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)