summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h
blob: b5247776ad10f3120cee09a8b515a982521ae3e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef COMPOSITEDISPLAY_H_W2MX9CXP
#define COMPOSITEDISPLAY_H_W2MX9CXP

#include "uscxml/concurrency/tinythread.h"
#include <osgGA/TrackballManipulator>
#include <osgViewer/Viewer>
#include <osgViewer/CompositeViewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/StateSetManipulator>
#include <assert.h>
#include <iostream>

class CompositeDisplay : public osgViewer::CompositeViewer {
public:
	CompositeDisplay(unsigned int x,
	                 unsigned int y,
	                 unsigned int width,
	                 unsigned int height,
	                 int screenId);
	virtual ~CompositeDisplay();

	virtual void addView(const std::string& name, osg::Viewport* v, osgViewer::View* view);
	virtual void moveView(const std::string& name, osg::Viewport* v);
	virtual void removeView(const std::string& name);

	virtual void frame(double simulationTime);
	virtual bool checkNeedToDoFrame();

	int getWidth() {
		return _width;
	}
	int getHeight() {
		return _height;
	}

	static void getResolution(unsigned int& width, unsigned int& height, int screenId);

protected:
	tthread::recursive_mutex _mutex;
	tthread::condition_variable _monitor;
	bool _waitForViewOp;
	std::map<std::string, osgViewer::View*> _views;
	std::map<std::string, osg::Viewport*> _viewports;
	osg::ref_ptr<osg::GraphicsContext> _gc;

	static osg::GraphicsContext::WindowingSystemInterface* wsi;
	int _width, _height;
};


#endif /* end of include guard: COMPOSITEDISPLAY_H_W2MX9CXP */