-
Notifications
You must be signed in to change notification settings - Fork 9
/
view.h
83 lines (66 loc) · 2.32 KB
/
view.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#include <eq/eq.h>
#include <osgViewer/View>
namespace eqEarth
{
class View final : public eq::View
{
public:
explicit View( eq::Layout* parent );
protected:
virtual ~View( );
public:
void setSceneID( const eq::uint128_t& id );
eq::uint128_t getSceneID( ) const { return _sceneID; }
void setOverlayID( const eq::uint128_t& id );
eq::uint128_t getOverlayID( ) const { return _overlayID; }
void setViewMatrix( const eq::Matrix4f& viewMatrix );
const eq::Matrix4f& getViewMatrix( ) const { return _viewMatrix; }
void setNearFar( double near, double far );
void getNearFar( double& near, double& far ) const;
void setLatLon( double lat, double lon );
void getLatLon( double& lat, double& lon ) const;
void setWorldPointer( const eq::Vector3f& origin,
const eq::Vector3f& direction );
void getWorldPointer( eq::Vector3f& origin, eq::Vector3f& direction ) const;
// AppNode only
void setOSGView( osgViewer::View* osgView ) { _osgView = osgView; }
osgViewer::View* getOSGView( ) { return _osgView; }
const osgViewer::View* getOSGView( ) const { return _osgView; }
private:
class Proxy : public co::Serializable
{
public:
Proxy( View* view ) : _view( view ) {}
protected:
/** The changed parts of the view. */
enum DirtyBits
{
DIRTY_SCENE = co::Serializable::DIRTY_CUSTOM << 0,
DIRTY_OVERLAY = co::Serializable::DIRTY_CUSTOM << 1,
DIRTY_CAMERA = co::Serializable::DIRTY_CUSTOM << 2,
DIRTY_NEARFAR = co::Serializable::DIRTY_CUSTOM << 3,
DIRTY_LATLON = co::Serializable::DIRTY_CUSTOM << 4,
DIRTY_POINTER = co::Serializable::DIRTY_CUSTOM << 5
};
virtual void serialize( co::DataOStream& os,
const uint64_t dirtyBits );
virtual void deserialize( co::DataIStream& is,
const uint64_t dirtyBits );
virtual void notifyNewVersion( ) { sync( ); }
private:
View* const _view;
friend class View;
};
Proxy _proxy;
friend class Proxy;
eq::uint128_t _sceneID;
eq::uint128_t _overlayID;
eq::Matrix4f _viewMatrix;
double _near, _far;
double _lat, _lon;
eq::Vector3f _origin;
eq::Vector3f _direction;
osg::ref_ptr< osgViewer::View > _osgView;
};
}