OpenCOVER
coVRCollaboration.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 VR_COLLABORATION_H
9#define VR_COLLABORATION_H
10
24#include <util/coExport.h>
25#include <util/common.h>
26#include <set>
27#include <osg/Matrix>
28#include <vrb/client/SharedState.h>
29#include "ui/Owner.h"
30#include "MatrixSerializer.h"
31
32namespace osg
33{
34class Group;
35}
36
37namespace opencover
38{
39
40namespace ui
41{
42class Group;
43class Menu;
44class Button;
45class Slider;
46class SelectionList;
47class Action;
48}
49
50
51class COVEREXPORT coVRCollaboration: public ui::Owner
52{
53 static coVRCollaboration *s_instance;
55
56public:
58 {
61 TightCoupling
62 };
63
64private:
65 int readConfigFile();
66 void initCollMenu();
67 void setSyncInterval();
68 std::set<int> m_sessions;
69 bool syncXform = false;
70 bool syncScale = false;
71 bool wasLo = false;
72 float syncInterval;
73 bool oldMasterStatus = true;
74 float oldSyncInterval = -1;
75 bool oldAvatarVisibility = true;
76
77public:
79 void config();
80 void showCollaborative(bool visible);
87 // returns collaboration mode
89
90 void setSyncMode(const char *mode); // set one of "LOOSE", "MS", "TIGHT"
91
92 void updateSharedStates(bool force = false);
93 // returns true if this COVER ist master in a collaborative session
94 bool isMaster();
95 // Collaborative menu:
96 bool m_visible = false;
97 ui::Menu *m_collaborativeMenu = nullptr;
98 ui::Group *m_partnerGroup = nullptr;
99 ui::Button *m_showAvatar = nullptr;
100 ui::Button *m_master = nullptr;
101 ui::Action *m_returnToMaster = nullptr;
102 ui::Slider *m_syncInterval = nullptr;
103 ui::SelectionList *m_collaborationMode = nullptr;
104 ui::Menu *menu() const;
105 ui::Group *partnerGroup() const;
106
108 void syncModeChanged(int mode);
109 void init();
110
111 bool update();
112 //sync transform of viewer with partners
113 void SyncXform();
114 //sync scale of world with partner
116 void SyncScale();
118 void sessionChanged(bool isPrivate);
119 void remoteTransform(osg::Matrix &mat);
120 void remoteScale(float d);
121};
122}
123#endif
Definition: ARToolKit.h:33
Definition: coClusterStat.h:29
Definition: coVRCollaboration.h:52
void setSyncMode(const char *mode)
bool showAvatar
Definition: coVRCollaboration.h:82
void sessionChanged(bool isPrivate)
vrb::SharedState< int > syncMode
Definition: coVRCollaboration.h:83
vrb::SharedState< float > scaleFactor
Definition: coVRCollaboration.h:85
ui::Group * partnerGroup() const
void updateSharedStates(bool force=false)
static coVRCollaboration * instance()
SyncMode getCouplingMode() const
vrb::SharedState< osg::Matrix > avatarPosition
0: LooseCoupling, 1: MasterSlaveCoupling, 2 TightCoupling
Definition: coVRCollaboration.h:84
void syncModeChanged(int mode)
void showCollaborative(bool visible)
SyncMode
Definition: coVRCollaboration.h:58
@ LooseCoupling
Definition: coVRCollaboration.h:59
@ MasterSlaveCoupling
Definition: coVRCollaboration.h:60
ui::Menu * menu() const
void remoteTransform(osg::Matrix &mat)