-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvvApplicationState.h
79 lines (63 loc) · 2.05 KB
/
vvApplicationState.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
#ifndef VVAPPLICATIONSTATE_H
#define VVAPPLICATIONSTATE_H
class GLContextData;
class vvContextState;
class vvFramerate;
class vvGLObject;
class vvProgress;
#include <string>
#include <vector>
/**
* @brief The vvApplicationState class holds application state.
*
* vvApplicationState holds application state needed by vvGLObjects.
* An instance of this class is used to update vvGLObjects via
* vvGLObject::syncApplicationState in vvApplication::frame().
*/
class vvApplicationState
{
public:
using Objects = std::vector<vvGLObject*>;
vvApplicationState();
virtual ~vvApplicationState();
/**
* Initialize application state. Calls vvGLObject::init on all objects in
* objects().
*/
virtual void init();
/**
* Initialize per-context state. Calls vvGLObject::initVvContext on all
* objects in objects().
*/
virtual void initContext(vvContextState &state, GLContextData &data) const;
/**
* Per-frame sync of application state. Calls vvGLObject::syncApplicationState
* on all objects in objects().
*/
virtual void syncApplicationState();
/**
* Sync per-context state. Calls vvGLObject::syncContextState on all
* objects in objects().
*/
virtual void syncContextState(const vvContextState &contextState,
GLContextData &contextData) const;
/** List of all vvGLObjects. */
Objects& objects() { return m_objects; }
const Objects& objects() const { return m_objects; }
/** Framerate overlay. */
vvFramerate& framerate() { return *m_framerate; }
const vvFramerate& framerate() const { return *m_framerate; }
/** Async progress monitor.
* Unfortunately not const-correct, since this needs to be modified in
* vvAsyncGLObject::syncApplicationState(const vvAppState&). */
vvProgress& progress() const { return *m_progress; }
protected:
Objects m_objects;
private:
// Not implemented:
vvApplicationState(const vvApplicationState&);
vvApplicationState& operator=(const vvApplicationState&);
vvFramerate *m_framerate;
vvProgress *m_progress;
};
#endif // VVAPPLICATIONSTATE_H