t1 / TFDContents / Assets / Standard Assets / Windows / Kinect / LongExposureInfraredFrame.cs @ 9
이력 | 보기 | 이력해설 | 다운로드 (6.6 KB)
| 1 |
#if !(UNITY_WSA_10_0 && NETFX_CORE) |
|---|---|
| 2 |
using RootSystem = System; |
| 3 |
using System.Linq; |
| 4 |
using System.Collections.Generic; |
| 5 |
namespace Windows.Kinect |
| 6 |
{
|
| 7 |
// |
| 8 |
// Windows.Kinect.LongExposureInfraredFrame |
| 9 |
// |
| 10 |
public sealed partial class LongExposureInfraredFrame : RootSystem.IDisposable, Helper.INativeWrapper |
| 11 |
|
| 12 |
{
|
| 13 |
internal RootSystem.IntPtr _pNative; |
| 14 |
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
|
| 15 |
|
| 16 |
// Constructors and Finalizers |
| 17 |
internal LongExposureInfraredFrame(RootSystem.IntPtr pNative) |
| 18 |
{
|
| 19 |
_pNative = pNative; |
| 20 |
Windows_Kinect_LongExposureInfraredFrame_AddRefObject(ref _pNative); |
| 21 |
} |
| 22 |
|
| 23 |
~LongExposureInfraredFrame() |
| 24 |
{
|
| 25 |
Dispose(false); |
| 26 |
} |
| 27 |
|
| 28 |
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 29 |
private static extern void Windows_Kinect_LongExposureInfraredFrame_ReleaseObject(ref RootSystem.IntPtr pNative); |
| 30 |
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 31 |
private static extern void Windows_Kinect_LongExposureInfraredFrame_AddRefObject(ref RootSystem.IntPtr pNative); |
| 32 |
private void Dispose(bool disposing) |
| 33 |
{
|
| 34 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 35 |
{
|
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
__EventCleanup(); |
| 40 |
|
| 41 |
Helper.NativeObjectCache.RemoveObject<LongExposureInfraredFrame>(_pNative); |
| 42 |
|
| 43 |
if (disposing) |
| 44 |
{
|
| 45 |
Windows_Kinect_LongExposureInfraredFrame_Dispose(_pNative); |
| 46 |
} |
| 47 |
Windows_Kinect_LongExposureInfraredFrame_ReleaseObject(ref _pNative); |
| 48 |
|
| 49 |
_pNative = RootSystem.IntPtr.Zero; |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
// Public Properties |
| 54 |
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 55 |
private static extern RootSystem.IntPtr Windows_Kinect_LongExposureInfraredFrame_get_FrameDescription(RootSystem.IntPtr pNative); |
| 56 |
public Windows.Kinect.FrameDescription FrameDescription |
| 57 |
{
|
| 58 |
get |
| 59 |
{
|
| 60 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 61 |
{
|
| 62 |
throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrame");
|
| 63 |
} |
| 64 |
|
| 65 |
RootSystem.IntPtr objectPointer = Windows_Kinect_LongExposureInfraredFrame_get_FrameDescription(_pNative); |
| 66 |
Helper.ExceptionHelper.CheckLastError(); |
| 67 |
if (objectPointer == RootSystem.IntPtr.Zero) |
| 68 |
{
|
| 69 |
return null; |
| 70 |
} |
| 71 |
|
| 72 |
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n)); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 77 |
private static extern RootSystem.IntPtr Windows_Kinect_LongExposureInfraredFrame_get_LongExposureInfraredFrameSource(RootSystem.IntPtr pNative); |
| 78 |
public Windows.Kinect.LongExposureInfraredFrameSource LongExposureInfraredFrameSource |
| 79 |
{
|
| 80 |
get |
| 81 |
{
|
| 82 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 83 |
{
|
| 84 |
throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrame");
|
| 85 |
} |
| 86 |
|
| 87 |
RootSystem.IntPtr objectPointer = Windows_Kinect_LongExposureInfraredFrame_get_LongExposureInfraredFrameSource(_pNative); |
| 88 |
Helper.ExceptionHelper.CheckLastError(); |
| 89 |
if (objectPointer == RootSystem.IntPtr.Zero) |
| 90 |
{
|
| 91 |
return null; |
| 92 |
} |
| 93 |
|
| 94 |
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.LongExposureInfraredFrameSource>(objectPointer, n => new Windows.Kinect.LongExposureInfraredFrameSource(n)); |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 99 |
private static extern long Windows_Kinect_LongExposureInfraredFrame_get_RelativeTime(RootSystem.IntPtr pNative); |
| 100 |
public RootSystem.TimeSpan RelativeTime |
| 101 |
{
|
| 102 |
get |
| 103 |
{
|
| 104 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 105 |
{
|
| 106 |
throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrame");
|
| 107 |
} |
| 108 |
|
| 109 |
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_LongExposureInfraredFrame_get_RelativeTime(_pNative)); |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
// Public Methods |
| 115 |
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 116 |
private static extern void Windows_Kinect_LongExposureInfraredFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize); |
| 117 |
public void CopyFrameDataToArray(ushort[] frameData) |
| 118 |
{
|
| 119 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 120 |
{
|
| 121 |
throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrame");
|
| 122 |
} |
| 123 |
|
| 124 |
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned)); |
| 125 |
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject(); |
| 126 |
Windows_Kinect_LongExposureInfraredFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length); |
| 127 |
Helper.ExceptionHelper.CheckLastError(); |
| 128 |
} |
| 129 |
|
| 130 |
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 131 |
private static extern void Windows_Kinect_LongExposureInfraredFrame_Dispose(RootSystem.IntPtr pNative); |
| 132 |
public void Dispose() |
| 133 |
{
|
| 134 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 135 |
{
|
| 136 |
return; |
| 137 |
} |
| 138 |
|
| 139 |
Dispose(true); |
| 140 |
RootSystem.GC.SuppressFinalize(this); |
| 141 |
} |
| 142 |
|
| 143 |
private void __EventCleanup() |
| 144 |
{
|
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
} |
| 149 |
#endif |