forked from intel/riggingtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrig2cInterop.cs
91 lines (78 loc) · 2.57 KB
/
librig2cInterop.cs
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Runtime.InteropServices;
public static class rig2cInterop
{
#if UNITY_IOS && !UNITY_EDITOR
const string LIB_NAME = "__Internal";
#else
const string LIB_NAME = "rig2c";
#endif
public enum RETURN_CODE
{
NO_ERROR = 0,
BAD_FILE_VERSION = -1,
BAD_PATH = -2,
NOT_STARTED = -4,
BAD_JSON = -5,
BAD_HANDLE = -6,
BAD_KEY = -7,
BAD_DATA = -8,
API_NOT_INITIALIZED = -9,
NO_CALLBACK = -10,
UNKNOWN_ERROR = -12345
}
/// <summary>
/// Delegates for native callbacks
/// </summary>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void OnErrorDelegate( string rigId,
int errorCode,
string description );
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void OnBoundsDelegate( string rigId,
int startTimestamp,
int endTimestamp );
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void OnFrameDelegate( string rigId,
int frameTimestamp,
IntPtr locationXYZ,
IntPtr boneRotations,
int numBoneRotations,
IntPtr boneLengths,
int numBoneLengths,
IntPtr boneOffsets,
int numBoneOffsets );
/// <summary>
/// Native functions
/// </summary>
[DllImport(LIB_NAME)]
public static extern RETURN_CODE rig_initialize( IntPtr platformContext );
[DllImport(LIB_NAME)]
public static extern void rig_uninitialize();
[DllImport(LIB_NAME)]
public static extern void rig_setErrorCallback( OnErrorDelegate functionPtr );
[DllImport(LIB_NAME)]
public static extern void rig_setBoundsCallback( OnBoundsDelegate functionPtr );
[DllImport(LIB_NAME)]
public static extern void rig_setFrameCallback( OnFrameDelegate functionPtr );
[DllImport(LIB_NAME)]
public static extern RETURN_CODE rig_getLastError();
[DllImport(LIB_NAME)]
public static extern RETURN_CODE rig_getRestPoseHumanoid( string previousName,
IntPtr joint );
[DllImport(LIB_NAME)]
public static extern RETURN_CODE rig_getInfo( string url,
string key,
System.Text.StringBuilder value,
int valueSize );
[DllImport(LIB_NAME)]
public static extern RETURN_CODE rig_getRigInfo( string url,
string rigId,
string key,
System.Text.StringBuilder value,
int valueSize);
[DllImport(LIB_NAME)]
public static extern void rig_startRead( string url );
[DllImport(LIB_NAME)]
public static extern void rig_stopRead();
}