VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVirtualRealityDriver.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
14 
15 #include <vrvCore/DtDriver.h>
16 #include <vrvCore/DtDe.h>
17 #include <vrvCore/DtAgentManager.h>
18 
20 #include <vrvUtil/DtQuat.h>
21 
22 #include <matrix/vlVector.h>
23 
24 #include <osg/ref_ptr>
25 #include <osg/Texture2D>
26 #include <osg/Camera>
27 
28 #include <vrvUtil/signalslib.h>
29 
30 #include <list>
31 
32 
33 namespace osg
34 {
35  class RenderInfo;
36 }
37 
38 namespace makVrv
39 {
40  class DtChannel;
41  class DtWindow;
42  class DtObserver;
43  class DtOsgChannel;
44  class DtOsgWindow;
45  class DtChannelManager;
46  class DtInputDriver;
47  class DtSubmitOverlayCallback;
48  class DtVirtualRealityProvider;
49  class DtVirtualRealityChannel;
50  class DtSwapChainPreviewDrawable;
51 
55  {
56  private:
59 
62 
65 
66  public:
69 
71  virtual ~DtVirtualRealityDriver();
72 
74  virtual const std::string& className() const;
75 
78  virtual bool onStart();
79 
81  virtual bool onStop();
82 
84  virtual bool onTick();
85 
87  virtual bool isVrAvailable();
88 
90  virtual vrvVirtualReality::DtVrRenderMode renderMode() const;
91 
93  virtual void resetHmd();
94 
96  virtual void triggerAction1();
97 
100  virtual void setMirroring(makArchives::DtVirtualRealitySettingsRecord::DtMirroring val);
101 
104 
107  virtual void setMirrorChannel(const std::string& val);
108 
111  virtual DtSubmitOverlayCallback* findOverlayCallback();
112 
115  virtual bool getHmdPose(DtVector& pos, DtQuat& ori) const;
116 
118  virtual DtVirtualRealityChannel* findEyeChannel(vrvVirtualReality::DtEye whichEye);
119 
121  virtual DtOsgChannel* findMirrorChannel();
122 
124  virtual DtSwapChainPreviewDrawable* findPreviewDrawable();
125 
128  virtual DtObserver* findHmdObserver() const;
129 
132  virtual void setObserverForHmd(const std::string& obsName);
133 
135  void handleEnableMixedRealityChanged(bool val);
136 
138  void handleEnableRealWorldDepthTestingChanged(bool val);
139 
141  virtual void setProvider(DtVirtualRealityProvider* provider);
142 
144  virtual DtVirtualRealityProvider* findProvider() const;
145 
147  virtual osg::Texture* findOverlayTexture() const;
148 
150  virtual DtOsgChannel* findOverlayChannel();
151 
153  virtual osg::StateSet* findOverlayQuadStateSet() const;
154 
156  virtual void initializeOverlay(DtOsgChannel* channel);
157 
159  virtual void useOverlayRenderTextures(osg::Camera* camera, bool clearDepth);
160 
162  virtual void installMixedRealityMaskingObject(osg::Group* mountTo, osg::Vec3 offset,
163  bool followObserver, const std::string& modelFileOrShapeName);
164 
166  virtual void uninstallMixedRealityMaskingObject();
167 
169  virtual void startMasking();
170 
172  virtual void stopMasking();
173 
175  virtual void setOrientationSmoothingEnabled(bool enabled);
176 
178  virtual void setOrientationSmoothingParams(double alpha, double threshold);
179 
182  boost::signalslib::signal<void()> signal_tick;
183 
185  boost::signalslib::signal<void()> signal_reset;
186 
188  boost::signalslib::signal<void(bool)> signal_vrRunningChaned;
189 
191  boost::signalslib::signal<void()> signal_vrResolutionChanged;
192 
194  boost::signalslib::signal<void()> signal_vrOverlayChanged;
195 
196  protected:
198  virtual DtOsgWindow* findHmdWindow();
199 
202  virtual DtVirtualRealityChannel* createEyeChannel(vrvVirtualReality::DtEye eye, DtDisplayConfiguration* prototypeConfig);
203 
205  virtual void installMultiViewShadersForChannel(DtVirtualRealityChannel* vrChannel);
206 
208  virtual void uninstallOverlay(DtOsgChannel* channel);
209 
211  virtual void handleOverlayDimensionsChanged(float val);
212 
214  virtual void handleResolutionScaleChanged(int scale);
215 
217  virtual void handleEnableVRSChanged(bool enable);
218 
220  virtual void handleDisableAAChanged(bool disable);
221 
224  void installResetKeyMap();
225 
228  void installAction1KeyMap();
229 
231  virtual void handleEnabledChanged(bool val);
232 
234  virtual void handleObserverLost(DtInputDriver*, DtObserver* observer);
235 
238  virtual void enableDesktopMirroring(bool enable);
239 
241  virtual void updateMirroring(makArchives::DtVirtualRealitySettingsRecord::DtMirroring mirrorType, const std::string& channelName);
242 
246  virtual bool getPose(DtVector& position, DtQuat& orienation, int index) const;
247 
249  virtual void connectSignals();
250 
252  virtual void onPretick();
253 
255  virtual void onUpdate(double simTime);
256 
258  virtual void onPostUpdate();
259 
261  virtual void onPostTick();
262 
264  virtual void updatePoseInformation();
265 
267  void slot_hdrEnabledChanged(bool enabled);
268 
270  void slot_channelDestroyed(DtChannelManager* channelManager, DtChannel* channel);
271 
273  void slot_windowToBeDestroyed(DtWindow* window);
274 
275  protected:
278 
279  //HMD observer, offscreen window and eye channels
283 
284  typedef std::map<vrvVirtualReality::DtEye, DtVirtualRealityChannel*> DtVrEyeToChannelMap;
286 
288 
290 
291  //main 2d overlay
295 
296  //mirroring structs
298  std::string myMirrorChannelName;
304 
307 
308  // orientation smoothing
310  double myOriFilterAlpha; //Value should be between 0.01f and 0.99f. Smaller value is more damping.
313  osg::Quat mySmoothedOri;
314  osg::Quat myLastHmdOri;
315  double myLastTime;
316 
318  };
319 
320 }
DtWindowConfiguration myHmdWindowConfig
Definition: DtVirtualRealityDriver.h:282
Abstract Base class.
Definition: DtWindow.h:25
double myOriFilterAlpha
Definition: DtVirtualRealityDriver.h:310
Contains DLL export macros.
DtVrRenderMode
Virtual reality render mode.
Definition: vrvVirtualReality.h:52
bool myOriSmoothingEnabled
Definition: DtVirtualRealityDriver.h:309
DtDe & myDe
Definition: DtVirtualRealityDriver.h:276
osg::ref_ptr< DtSwapChainPreviewDrawable > myPreviewDrawable
Definition: DtVirtualRealityDriver.h:303
Definition: DtSwapChain.h:219
boost::signalslib::signal< void()> signal_vrResolutionChanged
Signal emitted when the resolution changes.
Definition: DtVirtualRealityDriver.h:191
DtVrEyeToChannelMap myChannels
Definition: DtVirtualRealityDriver.h:285
Contains makVrv::DtDe class.
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:26
std::string myMirrorObserverRestore
Definition: DtVirtualRealityDriver.h:301
Contains makArchives::DtVirtualRealitySettingsRecord class.
osg::ref_ptr< osg::Texture2D > myOverlayDepthTexture
Definition: DtVirtualRealityDriver.h:293
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:55
A driver that manages virtual reality HMD and input devices.
Definition: DtVirtualRealityDriver.h:54
boost::signalslib::signal< void()> signal_vrOverlayChanged
Signal emitted when the overlay dimensions change.
Definition: DtVirtualRealityDriver.h:194
#define DT_DLL_VRVVR
Definition: vrvVirtualReality.h:19
DtMirroring
Definition: DtVirtualRealitySettingsRecord.h:28
DtEye
A virtual reality eye.
Definition: vrvVirtualReality.h:37
int myMirrorChannelRenderOrderRestore
Definition: DtVirtualRealityDriver.h:302
DtSignalConnectionManager myConnections
Definition: DtVirtualRealityDriver.h:317
The abstract Channel Class.
Definition: DtChannel.h:35
A facade for a DtObserverObject.
Definition: DtObserver.h:37
Contains makVrv:DtAgentManager class.
The DtDriver is an abstract class. Developers derive from this to create logic that &quot;directs&quot; things ...
Definition: DtDriver.h:31
DtVirtualRealityChannel * myStereoOverlayChannel
Definition: DtVirtualRealityDriver.h:305
DtObserver * myHmdObserver
Definition: DtVirtualRealityDriver.h:280
vrvVirtualReality::DtVrRenderMode myRenderMode
Definition: DtVirtualRealityDriver.h:287
boost::signalslib::signal< void()> signal_reset
Signal emitted when the VR system is reset.
Definition: DtVirtualRealityDriver.h:185
This owns a list of window configurations.
Definition: DtDisplayConfiguration.h:43
double myLastTime
Definition: DtVirtualRealityDriver.h:315
This class&#39;s main responsibility is to handle keyboard and mouse events from OSG (Qt events are route...
Definition: DtInputDriver.h:43
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
An abstract interface that provides VR System API services. Providers are created and provided to the...
Definition: DtVirtualRealityProvider.h:47
Contains makVrv::DtQuat class.
DtWindow * myMirrorWindow
Definition: DtVirtualRealityDriver.h:300
A VRV channel that represents the eyes of the HMD A Virtual Reality channel can render in a few diffe...
Definition: DtVirtualRealityChannel.h:30
The DtAgentManager manages the distributed scene object framework. This includes the objects and upda...
Definition: DtAgentManager.h:38
std::map< vrvVirtualReality::DtEye, DtVirtualRealityChannel * > DtVrEyeToChannelMap
Definition: DtVirtualRealityDriver.h:284
Contains makVrv:DtDriver class.
bool myUseMixedRealityMask
Definition: DtVirtualRealityDriver.h:289
Base class for handling DtChannels. Derived classes should override the tick() method and advance the...
Definition: DtChannelManager.h:32
double myOriFilterThreshold
Definition: DtVirtualRealityDriver.h:311
An OSG camera callback that will submit the channel to the underlying VR system as an overlay channel...
Definition: DtSubmitOverlayCallback.h:32
boost::signalslib::signal< void(bool)> signal_vrRunningChaned
Signal emitted when the VR system is started or stoped.
Definition: DtVirtualRealityDriver.h:188
osg::ref_ptr< osg::MatrixTransform > myOverlayQuad
Definition: DtVirtualRealityDriver.h:306
Base class to provide boost signal/slot management.
osg::Quat mySmoothedOri
Definition: DtVirtualRealityDriver.h:313
bool myOriSmoothingInit
Definition: DtVirtualRealityDriver.h:312
DtOsgWindow * myHmdWindow
Definition: DtVirtualRealityDriver.h:281
makArchives::DtVirtualRealitySettingsRecord::DtMirroring myMirroring
Definition: DtVirtualRealityDriver.h:297
DtVirtualRealityProvider * myVrProvider
Definition: DtVirtualRealityDriver.h:277
osg::ref_ptr< osg::Texture2D > myOverlayTexture
Definition: DtVirtualRealityDriver.h:292
osg::ref_ptr< DtSubmitOverlayCallback > myOverlaySubmitCallback
Definition: DtVirtualRealityDriver.h:294
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:72
boost::signalslib::signal< void()> signal_tick
Signal emitted after the driver&#39;s tick. Useful for doing anything with the VR system that needs to ha...
Definition: DtVirtualRealityDriver.h:182
A utility Quaternion class.
Definition: DtQuat.h:19
osg::Quat myLastHmdOri
Definition: DtVirtualRealityDriver.h:314
voidpf uLong offset
Definition: ioapi.h:42
A basic OSG display window, used to get the osg context for a display window.
Definition: DtOsgWindow.h:36
DtOsgChannel * myMirrorChannel
Definition: DtVirtualRealityDriver.h:299
std::string myMirrorChannelName
Definition: DtVirtualRealityDriver.h:298

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)