-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathARTextureHandles.cs
59 lines (49 loc) · 1.86 KB
/
ARTextureHandles.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
using System;
using UnityEngine.XR.iOS;
namespace UnityEngine.XR.iOS
{
public class ARTextureHandles
{
public struct ARTextureHandlesStruct
{
// Native (Metal) texture handles for the device camera buffer
public IntPtr textureY;
public IntPtr textureCbCr;
}
private ARTextureHandlesStruct m_ARTextureHandlesStruct;
public IntPtr TextureY
{
get { return m_ARTextureHandlesStruct.textureY; }
}
public IntPtr TextureCbCr
{
get { return m_ARTextureHandlesStruct.textureCbCr; }
}
public ARTextureHandles(ARTextureHandlesStruct arTextureHandlesStruct)
{
m_ARTextureHandlesStruct = arTextureHandlesStruct;
}
#if !UNITY_EDITOR && UNITY_IOS
~ARTextureHandles()
{
UnityARSessionNativeInterface.ReleaseVideoTextureHandles(m_ARTextureHandlesStruct);
}
#endif
public bool IsNull()
{
return (m_ARTextureHandlesStruct.textureY == IntPtr.Zero) || (m_ARTextureHandlesStruct.textureCbCr == IntPtr.Zero);
}
// Disable the default and copy constructors because we are not currently tracking references of the Objective C handles in this case.
private ARTextureHandles()
{
// This
Debug.Assert(false, "should not call the default constructor for ARTextureHandles");
m_ARTextureHandlesStruct = new ARTextureHandlesStruct { textureY = IntPtr.Zero, textureCbCr = IntPtr.Zero };
}
private ARTextureHandles(ARTextureHandles arTextureHandles)
{
Debug.Assert(false, "should not call the copy constructor for ARTextureHandles");
m_ARTextureHandlesStruct = new ARTextureHandlesStruct { textureY = IntPtr.Zero, textureCbCr = IntPtr.Zero };
}
}
}