]> git.mxchange.org Git - flightgear.git/blob - src/Aircraft/replay.hxx
Canvas: CSS like property value inheritance.
[flightgear.git] / src / Aircraft / replay.hxx
1 // replay.hxx - a system to record and replay FlightGear flights
2 //
3 // Written by Curtis Olson, started July 2003.
4 //
5 // Copyright (C) 2003  Curtis L. Olson  - http://www.flightgear.org/~curt
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_REPLAY_HXX
25 #define _FG_REPLAY_HXX 1
26
27 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30
31 #include <simgear/compiler.h>
32
33 #include <deque>
34
35 #include <simgear/math/sg_types.hxx>
36 #include <simgear/props/props.hxx>
37 #include <simgear/structure/subsystem_mgr.hxx>
38
39 using std::deque;
40
41 class FGFlightRecorder;
42
43 typedef struct {
44     double sim_time;
45     char   raw_data;
46     /* more data here, hidden to the outside world */
47 } FGReplayData;
48
49 typedef deque < FGReplayData *> replay_list_type;
50
51
52
53 /**
54  * A recording/replay module for FlightGear flights
55  * 
56  */
57
58 class FGReplay : public SGSubsystem
59 {
60
61 public:
62
63     FGReplay ();
64     virtual ~FGReplay();
65
66     virtual void init();
67     virtual void reinit();
68     virtual void bind();
69     virtual void unbind();
70     virtual void update( double dt );
71     bool start();
72
73 private:
74     void clear();
75     FGReplayData* record(double time);
76     void interpolate(double time, const replay_list_type &list);
77     void replay(double time, FGReplayData* pCurrentFrame, FGReplayData* pOldFrame=NULL);
78
79     bool replay( double time );
80     double get_start_time();
81     double get_end_time();
82
83     double sim_time;
84     double last_mt_time;
85     double last_lt_time;
86     int last_replay_state;
87
88     replay_list_type short_term;
89     replay_list_type medium_term;
90     replay_list_type long_term;
91     replay_list_type recycler;
92     SGPropertyNode_ptr disable_replay;
93     SGPropertyNode_ptr replay_master;
94     SGPropertyNode_ptr replay_time;
95     SGPropertyNode_ptr replay_time_str;
96     SGPropertyNode_ptr replay_looped;
97     SGPropertyNode_ptr speed_up;
98
99     double m_high_res_time;    // default: 60 secs of high res data
100     double m_medium_res_time;  // default: 10 mins of 1 fps data
101     double m_low_res_time;     // default: 1 hr of 10 spf data
102     // short term sample rate is as every frame
103     double m_medium_sample_rate; // medium term sample rate (sec)
104     double m_long_sample_rate;   // long term sample rate (sec)
105
106     FGFlightRecorder* m_pRecorder;
107 };
108
109
110 #endif // _FG_REPLAY_HXX