15 #ifndef CMETAINTERVAL_H
16 #define CMETAINTERVAL_H
18 #include "directbase.h"
19 #include "cInterval.h"
20 #include "pointerTo.h"
45 INLINE
void set_precision(
double precision);
46 INLINE
double get_precision()
const;
48 void clear_intervals();
49 int push_level(
const string &name,
50 double rel_time, RelativeStart rel_to);
52 double rel_time = 0.0f,
53 RelativeStart rel_to = RS_previous_end);
54 int add_ext_index(
int ext_index,
const string &name,
55 double duration,
bool open_ended,
56 double rel_time, RelativeStart rel_to);
57 int pop_level(
double duration = -1.0);
59 bool set_interval_start_time(
const string &name,
double rel_time,
60 RelativeStart rel_to = RS_level_begin);
61 double get_interval_start_time(
const string &name)
const;
62 double get_interval_end_time(
const string &name)
const;
71 INLINE
int get_num_defs()
const;
72 INLINE DefType get_def_type(
int n)
const;
73 INLINE
CInterval *get_c_interval(
int n)
const;
74 INLINE
int get_ext_index(
int n)
const;
85 INLINE
bool is_event_ready();
86 INLINE
int get_event_index()
const;
87 INLINE
double get_event_t()
const;
88 INLINE EventType get_event_type()
const;
91 virtual void write(ostream &out,
int indent_level)
const;
92 void timeline(ostream &out)
const;
95 virtual void do_recompute();
104 double _ext_duration;
105 bool _ext_open_ended;
107 RelativeStart _rel_to;
108 int _actual_begin_time;
111 enum PlaybackEventType {
117 class PlaybackEvent {
119 INLINE PlaybackEvent(
int time,
int n, PlaybackEventType type);
120 INLINE
bool operator < (
const PlaybackEvent &other)
const;
123 PlaybackEventType _type;
124 PlaybackEvent *_begin_event;
127 class EventQueueEntry {
129 INLINE EventQueueEntry(
int n, EventType event_type,
int time);
131 EventType _event_type;
143 INLINE
int double_to_int_time(
double t)
const;
144 INLINE
double int_to_double_time(
int time)
const;
147 void do_event_forward(PlaybackEvent *event,
ActiveEvents &new_active,
149 void finish_events_forward(
int now,
ActiveEvents &new_active);
150 void do_event_reverse(PlaybackEvent *event,
ActiveEvents &new_active,
152 void finish_events_reverse(
int now,
ActiveEvents &new_active);
154 void enqueue_event(
int n, CInterval::EventType event_type,
bool is_initial,
156 void enqueue_self_event(CInterval::EventType event_type,
double t = 0.0);
157 void enqueue_done_event();
158 bool service_event_queue();
160 int recompute_level(
int n,
int level_begin,
int &level_end);
161 int get_begin_time(
const IntervalDef &def,
int level_begin,
162 int previous_begin,
int previous_end);
164 void write_event_desc(ostream &out,
const IntervalDef &def,
165 int &extra_indent_level)
const;
170 int _current_nesting_level;
176 size_t _next_event_index;
177 bool _processing_events;
191 static void init_type() {
192 CInterval::init_type();
193 register_type(_type_handle,
"CMetaInterval",
194 CInterval::get_class_type());
197 return get_class_type();
199 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
205 #include "cMetaInterval.I"
virtual void priv_step(double t)
Advances the time on the interval.
virtual void priv_instant()
This is called in lieu of priv_initialize() .
The base class for timeline components.
virtual void priv_finalize()
This is called to stop an interval, forcing it to whatever state it would be after it played all the ...
virtual void priv_interrupt()
This is called while the interval is playing to indicate that it is about to be interrupted; that is...
virtual void priv_reverse_initialize(double t)
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indi...
virtual void priv_initialize(double t)
This replaces the first call to priv_step(), and indicates that the interval has just begun...
virtual void priv_reverse_instant()
This is called in lieu of priv_reverse_initialize()
TypeHandle is the identifier used to differentiate C++ class types.
virtual void priv_reverse_finalize()
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself...