-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnityNativeWrapper.cpp
More file actions
31 lines (24 loc) · 918 Bytes
/
UnityNativeWrapper.cpp
File metadata and controls
31 lines (24 loc) · 918 Bytes
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
#include "UnityNativeBasic.h"
#if _MSC_VER
#define EXPORT_API __declspec(dllexport)
#else
#define EXPORT_API
#endif
extern "C" {
intptr_t EXPORT_API CreateUnityNative() {
return reinterpret_cast<intptr_t>(new UnityNativeBasic());
}
int EXPORT_API GetPointCount(intptr_t unityNative) {
return reinterpret_cast<UnityNativeBasic*>(unityNative)->getPointCount();
}
void EXPORT_API FillPoints(intptr_t unityNative, int count) {
reinterpret_cast<UnityNativeBasic*>(unityNative)->fill(count);
}
void EXPORT_API DestroyUnityNative(intptr_t unityNative) {
delete reinterpret_cast<UnityNativeBasic*>(unityNative);
}
void EXPORT_API GetPoints(intptr_t unityNative, Vector3 *data) {
auto pts = reinterpret_cast<UnityNativeBasic*>(unityNative)->getPoints();
std::copy(pts, pts+(GetPointCount(unityNative) * sizeof(Vector3)), data);
}
}