VR-Forces 5.0.2 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) 2022 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 DtSubmitOverlayCallback;
47  class DtVirtualRealityProvider;
48  class DtVirtualRealityChannel;
49 
53  {
54  private:
57 
60 
63 
64  public:
67 
69  virtual ~DtVirtualRealityDriver();
70 
72  virtual const std::string& className() const;
73 
76  virtual bool onStart();
77 
79  virtual bool onStop();
80 
82  virtual bool onTick();
83 
85  virtual bool isVrAvailable();
86 
88  virtual vrvVirtualReality::DtVrRenderMode renderMode() const;
89 
91  virtual void resetHmd();
92 
94  virtual void triggerAction1();
95 
98  virtual void setMirroring(makArchives::DtVirtualRealitySettingsRecord::DtMirroring val);
99 
102 
105  virtual void setMirrorChannel(const std::string& val);
106 
109  virtual DtSubmitOverlayCallback* findOverlayCallback();
110 
113  virtual bool getHmdPose(DtVector& pos, DtQuat& ori) const;
114 
116  virtual DtVirtualRealityChannel* findEyeChannel(vrvVirtualReality::DtEye whichEye);
117 
119  virtual DtOsgChannel* findMirrorChannel();
120 
123  virtual DtObserver* findHmdObserver() const;
124 
127  virtual void setObserverForHmd(const std::string& obsName);
128 
130  void handleEnableMixedRealityChanged(bool val);
131 
133  void handleEnableRealWorldDepthTestingChanged(bool val);
134 
136  virtual void setProvider(DtVirtualRealityProvider* provider);
137 
139  virtual DtVirtualRealityProvider* findProvider() const;
140 
142  virtual osg::Texture* findOverlayTexture() const;
143 
145  virtual DtOsgChannel* findOverlayChannel();
146 
148  virtual void initializeOverlay(DtOsgChannel* channel);
149 
151  virtual void installMixedRealityMaskingObject(osg::Group* mountTo, osg::Vec3 offset,
152  bool followObserver, const std::string& modelFileOrShapeName);
153 
155  virtual void uninstallMixedRealityMaskingObject();
156 
158  virtual void startMasking();
159 
161  virtual void stopMasking();
162 
164  virtual void setOrientationSmoothingEnabled(bool enabled);
165 
167  virtual void setOrientationSmoothingParams(double alpha, double threshold);
168 
171  boost::signalslib::signal<void()> signal_tick;
172 
174  boost::signalslib::signal<void()> signal_reset;
175 
177  boost::signalslib::signal<void(bool)> signal_vrRunningChaned;
178 
180  boost::signalslib::signal<void()> signal_vrResolutionChanged;
181 
183  boost::signalslib::signal<void()> signal_vrOverlayChanged;
184 
185  protected:
187  virtual DtOsgWindow* findHmdWindow();
188 
191  virtual DtVirtualRealityChannel* createEyeChannel(vrvVirtualReality::DtEye eye, DtDisplayConfiguration* prototypeConfig);
192 
194  virtual void installMultiViewShadersForChannel(DtVirtualRealityChannel* vrChannel);
195 
197  virtual void uninstallOverlay(DtOsgChannel* channel);
198 
200  virtual void handleOverlayDimensionsChanged(float val);
201 
203  virtual void handleResolutionScaleChanged(int scale);
204 
206  virtual void handleEnableVRSChanged(bool enable);
207 
210  void installResetKeyMap();
211 
214  void installAction1KeyMap();
215 
217  virtual void handleEnabledChanged(bool val);
218 
220  virtual void handleObserverLost(DtObserver* obs);
221 
223  virtual void updateMirroring(makArchives::DtVirtualRealitySettingsRecord::DtMirroring mirrorType, const std::string& channelName);
224 
228  virtual bool getPose(DtVector& position, DtQuat& orienation, int index) const;
229 
231  virtual void updatePoseInformation();
232 
234  void slot_hdrEnabledChanged(bool enabled);
235 
237  void slot_channelDestroyed(DtChannelManager* channelManager, DtChannel* channel);
238 
240  void slot_windowToBeDestroyed(DtWindow* window);
241 
242  protected:
245 
246  //HMD observer, offscreen window and eye channels
250 
251  typedef std::map<vrvVirtualReality::DtEye, DtVirtualRealityChannel*> DtVrEyeToChannelMap;
253 
255 
257 
258  //main 2d overlay
262 
263  //mirroring structs
265  std::string myMirrorChannelName;
268 
271 
272  // orientation smoothing
274  double myOriFilterAlpha; //Value should be between 0.01f and 0.99f. Smaller value is more damping.
277  osg::Quat mySmoothedOri;
278  osg::Quat myLastHmdOri;
279  double myLastTime;
280 
282  };
283 
284 }
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
DtWindowConfiguration myHmdWindowConfig
Definition: DtVirtualRealityDriver.h:249
Abstract Base class.
Definition: DtWindow.h:25
double myOriFilterAlpha
Definition: DtVirtualRealityDriver.h:274
Contains DLL export macros.
DtVrRenderMode
Virtual reality render mode.
Definition: vrvVirtualReality.h:52
bool myOriSmoothingEnabled
Definition: DtVirtualRealityDriver.h:273
DtDe & myDe
Definition: DtVirtualRealityDriver.h:243
boost::signalslib::signal< void()> signal_vrResolutionChanged
Signal emitted when the resolution changes.
Definition: DtVirtualRealityDriver.h:180
DtVrEyeToChannelMap myChannels
Definition: DtVirtualRealityDriver.h:252
Contains makVrv::DtDe class.
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:28
std::string myMirrorObserverRestore
Definition: DtVirtualRealityDriver.h:267
Contains makArchives::DtVirtualRealitySettingsRecord class.
osg::ref_ptr< osg::Texture2D > myOverlayDepthTexture
Definition: DtVirtualRealityDriver.h:260
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:52
A driver that manages virtual reality HMD and input devices.
Definition: DtVirtualRealityDriver.h:52
boost::signalslib::signal< void()> signal_vrOverlayChanged
Signal emitted when the overlay dimensions change.
Definition: DtVirtualRealityDriver.h:183
#define DT_DLL_VRVVR
Definition: vrvVirtualReality.h:19
DtMirroring
Definition: DtVirtualRealitySettingsRecord.h:28
DtEye
A virtual reality eye.
Definition: vrvVirtualReality.h:37
DtSignalConnectionManager myConnections
Definition: DtVirtualRealityDriver.h:281
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:269
DtObserver * myHmdObserver
Definition: DtVirtualRealityDriver.h:247
vrvVirtualReality::DtVrRenderMode myRenderMode
Definition: DtVirtualRealityDriver.h:254
boost::signalslib::signal< void()> signal_reset
Signal emitted when the VR system is reset.
Definition: DtVirtualRealityDriver.h:174
This owns a list of window configurations.
Definition: DtDisplayConfiguration.h:47
double myLastTime
Definition: DtVirtualRealityDriver.h:279
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.
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:251
Contains makVrv:DtDriver class.
bool myUseMixedRealityMask
Definition: DtVirtualRealityDriver.h:256
Base class for handling DtChannels. Derived classes should override the tick() method and advance the...
Definition: DtChannelManager.h:32
double myOriFilterThreshold
Definition: DtVirtualRealityDriver.h:275
An OSG camera callback that will submit the channel to the underlying VR system as an overlay channel...
Definition: DtSubmitOverlayCallback.h:30
boost::signalslib::signal< void(bool)> signal_vrRunningChaned
Signal emitted when the VR system is started or stoped.
Definition: DtVirtualRealityDriver.h:177
osg::ref_ptr< osg::MatrixTransform > myOverlayQuad
Definition: DtVirtualRealityDriver.h:270
Base class to provide boost signal/slot management.
osg::Quat mySmoothedOri
Definition: DtVirtualRealityDriver.h:277
bool myOriSmoothingInit
Definition: DtVirtualRealityDriver.h:276
DtOsgWindow * myHmdWindow
Definition: DtVirtualRealityDriver.h:248
makArchives::DtVirtualRealitySettingsRecord::DtMirroring myMirroring
Definition: DtVirtualRealityDriver.h:264
DtVirtualRealityProvider * myVrProvider
Definition: DtVirtualRealityDriver.h:244
osg::ref_ptr< osg::Texture2D > myOverlayTexture
Definition: DtVirtualRealityDriver.h:259
osg::ref_ptr< DtSubmitOverlayCallback > myOverlaySubmitCallback
Definition: DtVirtualRealityDriver.h:261
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
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:171
A utility Quaternion class.
Definition: DtQuat.h:19
osg::Quat myLastHmdOri
Definition: DtVirtualRealityDriver.h:278
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:266
std::string myMirrorChannelName
Definition: DtVirtualRealityDriver.h:265

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)