-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathARPointCloud.mm
59 lines (47 loc) · 1.23 KB
/
ARPointCloud.mm
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
// Unity Technologies Inc (c) 2018
// ARPointCloud.mm
// Main implementation of ARKit plugin's ARPointCloud
#include "ARKitDefines.h"
#ifdef __cplusplus
extern "C" {
#endif
int pointCloud_GetCount(const void* pointCloudPtr)
{
if (pointCloudPtr == nullptr)
return 0;
ARPointCloud* pointCloud = (__bridge ARPointCloud*)pointCloudPtr;
return [pointCloud count];
}
void* pointCloud_GetPointsPtr(const void* pointCloudPtr)
{
if (pointCloudPtr == nullptr)
{
return 0;
}
if (@available(iOS 11.0, *))
{
ARPointCloud* pointCloud = (__bridge ARPointCloud*)pointCloudPtr;
if (![pointCloud isKindOfClass:[ARPointCloud class]])
{
return 0;
}
const vector_float3 *pointsPtr = [pointCloud points];
return (void*) pointsPtr;
}
else
{
// Fallback on earlier versions
return 0;
}
}
void* pointCloud_GetIdentifiersPtr(const void* pointCloudPtr)
{
if (pointCloudPtr == nullptr)
return 0;
ARPointCloud* pointCloud = (__bridge ARPointCloud*)pointCloudPtr;
const UInt64 *identifiersPtr = [pointCloud identifiers];
return (void*) identifiersPtr;
}
#ifdef __cplusplus
}
#endif