MTek-GDL
0.100.4-muffintrap
Loading...
Searching...
No Matches
include
mgdl
rocket
track.h
1
#ifndef SYNC_TRACK_H
2
#define SYNC_TRACK_H
3
4
#ifdef __cplusplus
5
extern
"C"
{
6
#endif
7
8
#include <string.h>
9
#include <stdlib.h>
10
#include "base.h"
11
12
enum
key_type {
13
KEY_STEP,
/* stay constant */
14
KEY_LINEAR,
/* lerp to the next value */
15
KEY_SMOOTH,
/* smooth curve to the next value */
16
KEY_RAMP,
17
KEY_TYPE_COUNT
18
};
19
20
struct
track_key
{
21
int
row;
22
float
value;
23
enum
key_type type;
24
};
25
26
struct
sync_track
{
27
const
char
*name;
28
struct
track_key
*keys;
29
int
num_keys;
30
};
31
32
// CPP write
33
void
start_save_sync (
const
char
* filename_h,
const
char
* filename_cpp );
34
void
save_sync(
const
struct
sync_track
*t,
const
char
*filename_h,
const
char
* filename_cpp);
35
void
end_save_sync(
const
char
* filename_h,
const
char
* filename_cpp );
36
37
// JSON write
38
void
start_save_sync_json (
const
char
* filename);
39
void
save_sync_json(
const
struct
sync_track
*t,
const
char
*filename);
40
void
end_save_sync_json(
const
char
* filename);
41
42
int
sync_find_key(
const
struct
sync_track
*,
int
);
43
static
inline
int
key_idx_floor(
const
struct
sync_track
*t,
int
row)
44
{
45
int
idx = sync_find_key(t, row);
46
if
(idx < 0)
47
idx = -idx - 2;
48
return
idx;
49
}
50
51
#ifndef SYNC_PLAYER
52
int
sync_set_key(
struct
sync_track
*,
const
struct
track_key
*);
53
int
sync_del_key(
struct
sync_track
*,
int
);
54
static
inline
int
is_key_frame(
const
struct
sync_track
*t,
int
row)
55
{
56
return
sync_find_key(t, row) >= 0;
57
}
58
59
#endif
/* !defined(SYNC_PLAYER) */
60
61
#ifdef __cplusplus
62
}
63
#endif
64
65
#endif
/* SYNC_TRACK_H */
sync_track
Definition
track.h:26
track_key
Definition
track.h:20
Generated by
1.9.8