1 | |
---|
2 | /* |
---|
3 | state.h, encapsulate current camera view and animation settings |
---|
4 | |
---|
5 | An OpenSceneGraph viewer for pyVolution SWW files. |
---|
6 | copyright (C) 2004-2005 Geoscience Australia |
---|
7 | */ |
---|
8 | |
---|
9 | |
---|
10 | /* |
---|
11 | Finite State Machine for animation |
---|
12 | |
---|
13 | 0 1 1 begin storing view/orientation/cull settings |
---|
14 | 0 2 2 if exists, store current settings, commence playback of saved animation path |
---|
15 | 0 3 0 save animation to disk |
---|
16 | |
---|
17 | 1 1 0 stop storing settings |
---|
18 | 1 2 2 stop storing settings and commence playback |
---|
19 | 1 3 1 save animation, keep recording |
---|
20 | |
---|
21 | 2 2 0 stop playback, return to saved settings |
---|
22 | 2 1 2 no effect |
---|
23 | 2 3 2 save animation, continue playing back |
---|
24 | |
---|
25 | header comprised of original command line arguments |
---|
26 | |
---|
27 | state comprised of: |
---|
28 | frame |
---|
29 | elapsedtime |
---|
30 | modelview matrix |
---|
31 | timestep |
---|
32 | cullsteep |
---|
33 | wireframe |
---|
34 | |
---|
35 | */ |
---|
36 | |
---|
37 | #ifndef STATE_H |
---|
38 | #define STATE_H |
---|
39 | |
---|
40 | #include <project.h> |
---|
41 | #include <osg/Quat> |
---|
42 | #include <osg/Vec3> |
---|
43 | #include <osg/Matrix> |
---|
44 | #include <istream> |
---|
45 | #include <vector> |
---|
46 | #include <fstream> |
---|
47 | #include <iostream> |
---|
48 | |
---|
49 | |
---|
50 | class State |
---|
51 | { |
---|
52 | |
---|
53 | public: |
---|
54 | |
---|
55 | State(); |
---|
56 | virtual void setTimestep(unsigned int value){ _timestep = value; } |
---|
57 | virtual void setCulling(bool value){ _culling = value; } |
---|
58 | virtual void setWireframe(bool value){ _wireframe = value; } |
---|
59 | virtual void setMatrix(osg::Matrix value); |
---|
60 | |
---|
61 | virtual unsigned int getTimestep(){ return _timestep; } |
---|
62 | virtual osg::Matrix getMatrix(); |
---|
63 | virtual bool getCulling(){ return _culling; } |
---|
64 | virtual bool getWireframe(){ return _wireframe; } |
---|
65 | |
---|
66 | virtual void write(std::ostream &s); |
---|
67 | virtual bool read(std::istream& s); |
---|
68 | |
---|
69 | virtual ~State(); |
---|
70 | |
---|
71 | |
---|
72 | protected: |
---|
73 | |
---|
74 | unsigned int _timestep; |
---|
75 | osg::Vec3d _position; |
---|
76 | osg::Quat _orientation; |
---|
77 | //osg::Matrix _matrix; |
---|
78 | bool _culling; |
---|
79 | bool _wireframe; |
---|
80 | |
---|
81 | }; |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | class StateList : public std::vector<State> |
---|
87 | { |
---|
88 | |
---|
89 | public: |
---|
90 | |
---|
91 | StateList(); |
---|
92 | bool write(std::ostream& s); |
---|
93 | bool read(std::string filename); |
---|
94 | |
---|
95 | //void ~StateList(); |
---|
96 | |
---|
97 | protected: |
---|
98 | |
---|
99 | }; |
---|
100 | |
---|
101 | |
---|
102 | #endif // STATE_H |
---|