OpenCOVER
OpenCOVER.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
20#ifndef OPEN_COVER_H
21#define OPEN_COVER_H
22
23#include <util/common.h>
25
26#include <vrb/client/VrbCredentials.h>
27
28#include <memory>
29#ifdef HAS_MPI
30#include <mpi.h>
31#ifdef __APPLE__
32typedef void pthread_barrier_t;
33#else
34#include <pthread.h>
35#endif
36#endif
37
38namespace covise
39{
40class Message;
41}
42namespace vrb{
43class VRBClient;
44}
45namespace opencover
46{
47namespace ui
48{
49class Action;
50class Button;
51class Group;
52}
53
54class coHud;
55class buttonSpecCell;
56class coVRPlugin;
57class coTabletUI;
58class coTUITabFolder;
59
60class COVEREXPORT OpenCOVER
61{
62private:
63 vrui::coInteractionManager interactionManager;
64 bool exitFlag;
65 void readConfigFile();
66 void parseLine(char *line);
67 int frameNum;
68 std::unique_ptr<vrb::VrbCredentials> m_vrbCredentials;
69 static OpenCOVER *s_instance;
70 double fl_time, old_fl_time;
71 float sum_time;
72 bool printFPS;
73 bool ignoreMouseEvents;
74
75 void waitForWindowID();
76
77 bool m_loadVistlePlugin = false;
78 coVRPlugin *m_visPlugin;
79 bool m_forceMpi;
80
81 ui::Group *m_quitGroup=nullptr;
82 ui::Action *m_quit=nullptr;
83 ui::Button *m_clusterStats=nullptr;
84
85public:
87#ifdef HAS_MPI
88 OpenCOVER(const MPI_Comm *comm, pthread_barrier_t *shmBarrier);
89#endif
90#ifdef WIN32
91 OpenCOVER(HWND parentWindow);
92#else
93 OpenCOVER(int parentWindow);
94#endif
95 bool run();
96 bool init();
97 bool initDone();
99 void loop();
100 bool frame();
102 void setExitFlag(bool flag);
104 {
105 return exitFlag;
106 }
108 void handleEvents(int type, int state, int code);
112 double lastUpdateTime = -1.0, lastFrameTime = -1.0;
113 std::deque<double> frameDurations;
114 void setIgnoreMouseEvents(bool ign)
115 {
116 ignoreMouseEvents = ign;
117 }
118#ifdef WIN32
119 HWND parentWindow;
120#else
121 // should be Window from <X11/Xlib.h>
123#endif
124
127
128 size_t numTuis() const;
129 coTabletUI *tui(size_t idx) const;
130 coTUITabFolder *tuiTab(size_t idx) const;
131
136 const vrb::VRBClient *vrbc() const;
137 vrb::VRBClient *vrbc();
138 void startVrbc();
140 bool isVRBconnected() const;
141
142private:
143#ifdef HAS_MPI
144 MPI_Comm m_comm;
145 pthread_barrier_t *m_shmBarrier = nullptr;
146#endif
147 bool m_renderNext;
148 bool m_initialized = false;
149 std::vector<coTabletUI *> tabletUIs;
150 std::vector<coTUITabFolder *> tabletTabs;
151 std::unique_ptr<vrb::VRBClient> m_vrbc;
152 std::string m_startSession;
153
154 std::set<int> m_watchedFds;
155};
156}
157#endif
Definition: ARToolKit.h:33
Definition: coTabletUI.h:51
Definition: coTabletUI.h:59
Definition: coHud.h:33
Definition: coTabletUI.h:81
Definition: coTabletUI.h:727
make sure to clean up properly in the plugin's dtor
Definition: coVRPlugin.h:73
Definition: OpenCOVER.h:61
int getExitFlag()
Definition: OpenCOVER.h:103
void setExitFlag(bool flag)
bool isVRBconnected() const
const vrb::VRBClient * vrbc() const
void setIgnoreMouseEvents(bool ign)
Definition: OpenCOVER.h:114
int parentWindow
Definition: OpenCOVER.h:122
static OpenCOVER * instance()
vrb::VRBClient * vrbc()
bool unwatchFileDescriptor(int fd)
remove fd from filedescriptors to watch
coTUITabFolder * tuiTab(size_t idx) const
bool watchFileDescriptor(int fd)
register filedescriptor fd for watching so that scene will be re-rendererd when it is ready
void handleEvents(int type, int state, int code)
OpenCOVER(int parentWindow)
coVRPlugin * visPlugin() const
coHud * hud
Definition: OpenCOVER.h:109
std::deque< double > frameDurations
Definition: OpenCOVER.h:113
size_t numTuis() const
double beginAppTraversal
Definition: OpenCOVER.h:110
double endAppTraversal
Definition: OpenCOVER.h:111
coTabletUI * tui(size_t idx) const
Definition: coInteractionManager.h:23