summaryrefslogtreecommitdiffhomepage
path: root/opentrack-api/opentrack.h
blob: 95339d083abbf95cbc516f8c7d1c1f4c38d5a267 (plain)
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
#pragma once

#ifdef __cplusplus
extern "C" {
#endif
#ifndef IN_OPENTRACK
/* opaque pointers, forward definitions */
struct opentrack_opaque_ctx;
typedef opentrack_opaque_ctx* opentrack;
struct opentrack_opaque_tracker;
typedef opentrack_opaque_tracker* opentrack_tracker;
#endif

#ifdef IN_OPENTRACK
#   ifdef _WIN32
#       define OPENTRACK_EXPORT __declspec(dllexport)
#   else
#       define OPENTRACK_EXPORT
#   endif
#else
#   ifdef _WIN32
#       define OPENTRACK_EXPORT __declspec(dllimport)
#   else
#       define OPENTRACK_EXPORT
#   endif
#endif

#ifdef __GNUC__
#   define OPENTRACK_VISIBLE __attribute__((visibility ("default")))
#else
#   define OPENTRACK_VISIBLE
#endif

/* for `opentrack_tracker_tick', individual headpose elts */
#ifndef IN_OPENTRACK
enum opentrack_dof {
    TX = 0,
    TY,
    TZ,
    Yaw,
    Pitch,
    Roll,
    DOF_count
};
#endif

opentrack OPENTRACK_VISIBLE opentrack_make_ctx(const char* dir);
void OPENTRACK_VISIBLE opentrack_finalize_ctx(opentrack self);

/* no need to free the return value; invalid to modify it */
const char** OPENTRACK_VISIBLE opentrack_enum_trackers(opentrack self);

/*
 * don't `opentrack_tracker_tick an unstarted tracker, it's invalid to do so
 * it's also invalid to start a finalized tracker
 */
opentrack_tracker OPENTRACK_VISIBLE opentrack_make_tracker(opentrack ctx, const char* name);
void OPENTRACK_VISIBLE opentrack_tracker_start(opentrack self, opentrack_tracker tracker);
int OPENTRACK_VISIBLE opentrack_tracker_tick(opentrack_tracker tracker, double* headpose);
void OPENTRACK_VISIBLE opentrack_finalize_tracker(opentrack_tracker tracker);
#ifdef __cplusplus
}
#endif