OpenCOVER
coVRConfig.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8#ifndef CO_VR_CONFIG_H
9#define CO_VR_CONFIG_H
10
24#include <util/coExport.h>
25#include <osg/Vec3>
26#include <osg/ref_ptr>
27#include <osg/Camera>
28#include <osg/Multisample>
29#include <osg/Texture2D>
30#include <osgViewer/GraphicsWindow>
31#include <osgUtil/SceneView>
32#include <string>
33
34namespace osg
35{
36class DisplaySettings;
37class GraphicsContext;
38}
39
40namespace osgViewer
41{
42class GraphicsWindow;
43}
44
45namespace opencover
46{
47
48class coVRPlugin;
49
52{
53 float hsize; // current horizontal size in mm
54 float vsize; // current vertical size in mm
55 float configuredHsize = 0.f; // configured horizontal size in mm
56 float configuredVsize = 0.f; // configured vertical size in mm
57 osg::Vec3 xyz; // screen center in mm
58 osg::Vec3 hpr; // screen orientation in degree euler angles
59 std::string name;
60 bool render;
61 float lTan; // left, right, top bottom field of views, default/not set is -1
62 float rTan;
63 float tTan;
64 float bTan;
65
67 : hsize(0)
68 , vsize(0)
69 , xyz(0, 0, 0)
70 , hpr(0, 0, 0)
71 , name("UninitializedScreen")
72 , render(false)
73 , lTan(-1)
74 , rTan(-1)
75 , tTan(-1)
76 , bTan(-1)
77 {}
78};
79
82{
83 std::string name;
84
85 int PBONum; // destination PBO or -1 if rendering to a viewport directly
86 int viewportNum; // destination viewport or -1 if rendering to a PBO
87 int screenNum; // screen index
88
89 osg::ref_ptr<osg::Camera> camera;
90 osg::DisplaySettings *ds;
91 bool stereo;
95 osg::Matrixd leftView, rightView;
96 osg::Matrixd leftProj, rightProj;
97
99 : name("UninitializedChannel")
100 , PBONum(-1)
101 , viewportNum(-1)
102 , screenNum(-1)
103 , ds(NULL)
104 , stereo(true)
105 , stereoMode(osg::DisplaySettings::LEFT_EYE)
106 , fixedViewer(false)
107 , stereoOffset(0.f)
108 {}
109};
110
113{
114 int PBOsx, PBOsy; // PBO size
115 int windowNum; // pipe to render to
116 osg::ref_ptr<osg::Texture2D> renderTargetTexture;
117
119 : PBOsx(-1)
120 , PBOsy(-1)
121 , windowNum(-1)
122 {}
123};
124
125
126class COVEREXPORT angleStruct
127{
128public:
129 int analogInput; // number of analog port at Cereal Box
130 float cmin, cmax; // min and max values that analog port delivers
131 float minangle, maxangle; // minimum and maximum angle in real world
132 int screen; // screen number for these values
133 float *value; // actual value (is set by VRPolhemusTracker::initCereal)
134 int hpr; // which angle: hue, pitch or roll?
135};
136
139{
140 int ox, oy;
141 int sx, sy;
142 osg::ref_ptr<osg::GraphicsContext> context;
143 osg::ref_ptr<osgViewer::GraphicsWindow> window;
145 std::string name;
147 bool resize;
148 bool stereo;
155 std::string type;
157
159 : ox(-1)
160 , oy(-1)
161 , sx(-1)
162 , sy(-1)
163 , context(NULL)
164 , window(NULL)
165 , pipeNum(-1)
166 , name("UninitializedWindow")
167 , decoration(true)
168 , resize(true)
169 , stereo(false)
170 , embedded(false)
171 , pbuffer(false)
172 , doublebuffer(true)
173 , swapGroup(-1)
174 , swapBarrier(-1)
175 , windowPlugin(NULL)
176 , screenNum(-1)
177 {}
178};
179
180struct viewportStruct // describes an OpenGL Viewport
181{
182 enum Mode
183 {
184 Channel, //< channel renders directly into viewport
185 PBO, //< PBO is copied to viewport
186 TridelityML, //< 5 PBOs are copied interweaved into viewport
187 TridelityMV, //< 5 PBOs are copied interweaved into viewport
188 };
189 Mode mode; //< image source
191 std::vector<int> pbos;
197
202
203 std::string distortMeshName;
205
207 : mode(Channel)
208 , window(-1)
209 , PBOnum(-1)
210 , distortMeshName("NoDistortMesh")
211 , blendingTextureName("NoBlendingTexture")
212 {}
213};
214
215struct blendingTextureStruct // describes a blending Texture
216{
222
224
226 : window(-1)
227 , blendingTextureName("UninitialzedBlendingTexture")
228 {}
229};
230
233{
236 std::string x11DisplayHost;
238
240 : x11DisplayNum(-1)
241 , x11ScreenNum(-1)
242 , useDISPLAY(false)
243 {}
244};
245
246class COVEREXPORT coVRConfig
247{
248 friend class coVRPluginSupport;
249 friend class VRWindow;
250 friend class VRSceneGraph;
251 friend class OpenCOVER;
252 friend class VRViewer;
253
254 static coVRConfig *s_instance;
255
256public:
258
260 {
264 MONO_NONE
265 };
266
267 // mono rendering mode
269
270 enum
271 {
276 NONE
277 } envMapModes;
278 /*
279 //my
280 enum MarkNodes
281 {
282 MOVE,
283 SHOWHIDE,
284 SELECTION,
285 ANNOTATION
286 };
287 */
288 int getEnvMapMode(){return m_envMapMode;};
289 int numScreens() const;
290 int numChannels() const;
291 int numPBOs() const;
292 int numViewports() const;
294 int numWindows() const;
295 int numPipes() const;
296 int lockToCPU() const;
297
298 // get the scene size defined in covise.config
299 float getSceneSize() const;
300
301 int stereoMode() const;
302 static int parseStereoMode(const char *modeName, bool *stereo=NULL);
303 static bool requiresTwoViewpoints(int stereomode);
304 // have all the screens the same orientation?
305 bool haveFlatDisplay() const;
306
307 // if mouse needs to be checked
308 bool mouseNav() const;
309
310 // if mouse needs to be checked
311 bool mouseTracking() const;
312
313 // whether there is a Person with a 6DoF input device
314 bool has6DoFInput() const;
315
316 // if WiiMote needs to be checked
317 bool useWiiMote() const;
318 // wii navigation
320
321 // menu mode on
322 bool isMenuModeOn() const;
323 // color scene in menu mode
325
326 // optional Collaborative configuration file (-c option)
328
329 // optional Collaborative configuration file (-c option)
330 std::string viewpointsFile;
331
332 // returns true if level <= debugLevel
333 // debug levels should be used like this
334 // 0 no output
335 // 1 covise.config entries, coVRInit
336 // 2 constructors, destructors
337 // 3 all functions which are not called continously
338 // 4
339 // 5 all functions which are called continously
340 bool debugLevel(int level) const;
341
342 // get debug level
343 int getDebugLevel() const;
344
345 // set debug level
346 void setDebugLevel(int level);
347
348 // return true, if OpenCOVER is configured for stereo rendering
349 bool stereoState() const;
350
351 float stereoSeparation() const;
352
353 // get number of requested stencil bits (default = 1)
354 int numStencilBits() const;
355
356 // current configured angle of workbench
357 float worldAngle() const;
358
360 bool frozen() const;
361
363 void setFrozen(bool state);
364
366 bool orthographic() const;
367
369 void setOrthographic(bool state);
370
372 bool useDisplayLists() const;
373
375 bool useVBOs() const;
376
378 float nearClip() const;
379
381 float farClip() const;
382
384 float getLODScale() const;
385 void setLODScale(float);
386
388 {
389 return multisample;
390 }
392 {
393 return multisampleInvert;
394 }
396 {
397 return multisampleCoverage;
398 }
400 {
401 return multisampleSamples;
402 }
404 {
405 return multisampleSampleBuffers;
406 }
407 osg::Multisample::Mode getMultisampleMode()
408 {
409 return multisampleMode;
410 }
411
412 bool stencil() const;
413
414 void setFrameRate(float fr);
415 float frameRate() const;
416
418
419 std::vector<screenStruct> screens; // list of physical screens
420 std::vector<channelStruct> channels; // list of physical screens
421 std::vector<PBOStruct> PBOs; // list of physical screens
422 std::vector<pipeStruct> pipes; // list of pipes (X11: identified by display and screen)
423 std::vector<windowStruct> windows; // list of windows
424 std::vector<viewportStruct> viewports; // list of PixelBufferObjects
425 std::vector<blendingTextureStruct> blendingTextures; // list of blendingTextures
426
428 {
429 return m_useDISPLAY;
430 }
431
432 bool useVirtualGL() const
433 {
434 return m_useVirtualGL;
435 }
436
437 void setNearFar(float nearC, float farC)
438 {
439 if (nearC > 0 && farC > 0)
440 {
441 m_farClip = farC;
442 m_nearClip = nearC;
443 }
444 }
445
446 int getLanguage() const
447 {
448 return m_language;
449 }
451 {
453 GERMAN
454 };
456 std::string glVersion;
458
459private:
460 coVRConfig();
461 ~coVRConfig();
462
463 // configuration entries
464
465 bool m_useDisplayLists;
466 bool m_useVBOs;
467
468 bool m_useDISPLAY;
469 bool m_useVirtualGL;
470 int m_stencilBits;
471 float m_sceneSize;
472
473 float m_nearClip;
474 float m_farClip;
475 float m_LODScale;
476 float m_worldAngle;
477
478 bool m_stereoState;
479 int m_stereoMode;
480 float m_stereoSeparation;
481 MonoViews m_monoView; // MONO_MIDDLE MONO_LEFT MONO_RIGHT
482 int m_envMapMode;
483 bool m_freeze;
484 bool m_passiveStereo;
485 bool m_orthographic;
486 bool m_stencil; //< user stencil buffers
487 bool HMDMode;
488
489 bool trackedHMD;
490
491 int drawStatistics;
492
493 // multi-sampling
494 int multisampleSamples;
495 int multisampleSampleBuffers;
496 float multisampleCoverage;
497 bool multisampleInvert;
498 bool multisample;
499 osg::Multisample::Mode multisampleMode;
500
501 int m_dLevel; // debugLevel
502 bool m_useWiiMote;
503 bool m_useWiiNavVisenso;
504
505 bool m_flatDisplay;
506 bool m_doRender;
507
508 bool constantFrameRate;
509 float constFrameTime;
510 bool m_continuousRendering;
511
512 int m_language;
513
514 bool m_menuModeOn;
515 bool m_coloringSceneInMenuMode;
516 int m_lockToCPU;
517};
518}
519#endif
Definition: ARToolKit.h:33
Definition: coClusterStat.h:29
Definition: coVRConfig.h:41
describes a physical screen, such as one wall of a CAVE
Definition: coVRConfig.h:52
float vsize
Definition: coVRConfig.h:54
osg::Vec3 hpr
Definition: coVRConfig.h:58
float rTan
Definition: coVRConfig.h:62
screenStruct()
Definition: coVRConfig.h:66
float configuredHsize
Definition: coVRConfig.h:55
float hsize
Definition: coVRConfig.h:53
float configuredVsize
Definition: coVRConfig.h:56
float lTan
Definition: coVRConfig.h:61
std::string name
Definition: coVRConfig.h:59
float tTan
Definition: coVRConfig.h:63
bool render
Definition: coVRConfig.h:60
osg::Vec3 xyz
Definition: coVRConfig.h:57
float bTan
Definition: coVRConfig.h:64
describes a render Channel which renders to a PBO or viewport
Definition: coVRConfig.h:82
int screenNum
Definition: coVRConfig.h:87
osg::Matrixd leftProj
Definition: coVRConfig.h:96
osg::DisplaySettings * ds
Definition: coVRConfig.h:90
int stereoMode
Definition: coVRConfig.h:92
osg::Matrixd leftView
Definition: coVRConfig.h:95
std::string name
Definition: coVRConfig.h:83
osg::Matrixd rightProj
Definition: coVRConfig.h:96
float stereoOffset
Definition: coVRConfig.h:94
bool fixedViewer
Definition: coVRConfig.h:93
osg::ref_ptr< osg::Camera > camera
Definition: coVRConfig.h:89
osg::Matrixd rightView
Definition: coVRConfig.h:95
int PBONum
Definition: coVRConfig.h:85
bool stereo
Definition: coVRConfig.h:91
int viewportNum
Definition: coVRConfig.h:86
channelStruct()
Definition: coVRConfig.h:98
describes a PBO
Definition: coVRConfig.h:113
int PBOsx
Definition: coVRConfig.h:114
osg::ref_ptr< osg::Texture2D > renderTargetTexture
Definition: coVRConfig.h:116
int PBOsy
Definition: coVRConfig.h:114
int windowNum
Definition: coVRConfig.h:115
PBOStruct()
Definition: coVRConfig.h:118
Definition: coVRConfig.h:127
int analogInput
Definition: coVRConfig.h:129
float maxangle
Definition: coVRConfig.h:131
int screen
Definition: coVRConfig.h:132
float * value
Definition: coVRConfig.h:133
int hpr
Definition: coVRConfig.h:134
float cmax
Definition: coVRConfig.h:130
describes one window of the windowing system
Definition: coVRConfig.h:139
bool decoration
Definition: coVRConfig.h:146
int swapGroup
Definition: coVRConfig.h:152
std::string type
Definition: coVRConfig.h:155
int screenNum
Definition: coVRConfig.h:154
windowStruct()
Definition: coVRConfig.h:158
osg::ref_ptr< osg::GraphicsContext > context
Definition: coVRConfig.h:142
int oy
Definition: coVRConfig.h:140
std::string name
Definition: coVRConfig.h:145
bool pbuffer
Definition: coVRConfig.h:150
int ox
Definition: coVRConfig.h:140
int swapBarrier
Definition: coVRConfig.h:153
bool embedded
Definition: coVRConfig.h:149
bool stereo
Definition: coVRConfig.h:148
bool doublebuffer
Definition: coVRConfig.h:151
int pipeNum
Definition: coVRConfig.h:144
bool resize
Definition: coVRConfig.h:147
int sx
Definition: coVRConfig.h:141
int sy
Definition: coVRConfig.h:141
coVRPlugin * windowPlugin
Definition: coVRConfig.h:156
osg::ref_ptr< osgViewer::GraphicsWindow > window
Definition: coVRConfig.h:143
Definition: coVRConfig.h:181
float sourceYMin
Definition: coVRConfig.h:194
float viewportXMax
Definition: coVRConfig.h:200
Mode mode
Definition: coVRConfig.h:189
float sourceXMax
Definition: coVRConfig.h:195
float viewportYMin
Definition: coVRConfig.h:199
viewportStruct()
Definition: coVRConfig.h:206
float sourceXMin
Definition: coVRConfig.h:193
std::vector< int > pbos
Definition: coVRConfig.h:191
float sourceYMax
Definition: coVRConfig.h:196
std::string blendingTextureName
Definition: coVRConfig.h:204
std::string distortMeshName
Definition: coVRConfig.h:203
float viewportXMin
Definition: coVRConfig.h:198
int window
Definition: coVRConfig.h:190
int PBOnum
Definition: coVRConfig.h:192
float viewportYMax
Definition: coVRConfig.h:201
Mode
Definition: coVRConfig.h:183
@ PBO
Definition: coVRConfig.h:185
@ Channel
Definition: coVRConfig.h:184
@ TridelityMV
Definition: coVRConfig.h:187
@ TridelityML
Definition: coVRConfig.h:186
Definition: coVRConfig.h:216
float viewportXMax
Definition: coVRConfig.h:220
float viewportXMin
Definition: coVRConfig.h:218
float viewportYMax
Definition: coVRConfig.h:221
std::string blendingTextureName
Definition: coVRConfig.h:223
blendingTextureStruct()
Definition: coVRConfig.h:225
float viewportYMin
Definition: coVRConfig.h:219
int window
Definition: coVRConfig.h:217
describes what is responsible for rendering the window
Definition: coVRConfig.h:233
bool useDISPLAY
Definition: coVRConfig.h:237
pipeStruct()
Definition: coVRConfig.h:239
std::string x11DisplayHost
Definition: coVRConfig.h:236
int x11ScreenNum
Definition: coVRConfig.h:235
int x11DisplayNum
Definition: coVRConfig.h:234
Definition: coVRConfig.h:247
int numWindows() const
MonoViews
Definition: coVRConfig.h:260
@ MONO_RIGHT
Definition: coVRConfig.h:263
@ MONO_MIDDLE
Definition: coVRConfig.h:261
@ MONO_LEFT
Definition: coVRConfig.h:262
std::vector< pipeStruct > pipes
Definition: coVRConfig.h:422
int numStencilBits() const
void setLODScale(float)
bool useDisplayVariable() const
Definition: coVRConfig.h:427
void setNearFar(float nearC, float farC)
Definition: coVRConfig.h:437
std::vector< PBOStruct > PBOs
Definition: coVRConfig.h:421
std::string glVersion
Definition: coVRConfig.h:456
bool isMenuModeOn() const
float getLODScale() const
scale factor for level of detail computation
MonoViews monoView() const
bool orthographic() const
return true if projection is orthographic
std::string collaborativeOptionsFile
Definition: coVRConfig.h:327
int stereoMode() const
int getLanguage() const
Definition: coVRConfig.h:446
bool continuousRendering() const
bool useVirtualGL() const
Definition: coVRConfig.h:432
int numBlendingTextures() const
float getMultisampleCoverage()
Definition: coVRConfig.h:395
void setFrozen(bool state)
true: stop head tracking, false: enable head tracking
bool frozen() const
return true if the position of the tracked head is not taken into account
bool debugLevel(int level) const
Languages
Definition: coVRConfig.h:451
@ ENGLISH
Definition: coVRConfig.h:452
static coVRConfig * instance()
bool stencil() const
float farClip() const
distance of far clipping plane
int getMultisampleSampleBuffers()
Definition: coVRConfig.h:403
bool getMultisampleInvert()
Definition: coVRConfig.h:391
std::vector< viewportStruct > viewports
Definition: coVRConfig.h:424
bool mouseNav() const
float nearClip() const
distance of near clipping plane
bool OpenVR_HMD
Definition: coVRConfig.h:457
static bool requiresTwoViewpoints(int stereomode)
int getEnvMapMode()
Definition: coVRConfig.h:288
void setFrameRate(float fr)
std::vector< blendingTextureStruct > blendingTextures
Definition: coVRConfig.h:425
float frameRate() const
@ FIXED_TO_VIEWER_FRONT
Definition: coVRConfig.h:274
@ FIXED_TO_VIEWER
Definition: coVRConfig.h:272
@ FIXED_TO_OBJROOT
Definition: coVRConfig.h:273
@ FIXED_TO_OBJROOT_FRONT
Definition: coVRConfig.h:275
bool has6DoFInput() const
bool haveFlatDisplay() const
static int parseStereoMode(const char *modeName, bool *stereo=NULL)
std::string viewpointsFile
Definition: coVRConfig.h:330
std::vector< screenStruct > screens
Definition: coVRConfig.h:419
void setOrthographic(bool state)
true: projection is orthographic
int numViewports() const
void setDebugLevel(int level)
osg::Multisample::Mode getMultisampleMode()
Definition: coVRConfig.h:407
bool stereoState() const
bool doMultisample()
Definition: coVRConfig.h:387
bool colorSceneInMenuMode() const
int getMultisampleSamples()
Definition: coVRConfig.h:399
int getDebugLevel() const
std::vector< windowStruct > windows
Definition: coVRConfig.h:423
bool useWiiMote() const
bool mouseTracking() const
bool useVBOs() const
return true, if configured for vertex buffer objects
float HMDViewingAngle
Definition: coVRConfig.h:455
int numChannels() const
float worldAngle() const
bool useDisplayLists() const
return true, if configured for display lists
int numScreens() const
float getSceneSize() const
std::vector< channelStruct > channels
Definition: coVRConfig.h:420
float stereoSeparation() const
bool useWiiNavigationVisenso() const
make sure to clean up properly in the plugin's dtor
Definition: coVRPlugin.h:73
Definition: coVRPluginSupport.h:192
Definition: OpenCOVER.h:61
Definition: VRSceneGraph.h:61
Definition: VRViewer.h:53
Definition: VRWindow.h:43