add kinect module

This commit is contained in:
Chikashi Miyama 2019-06-30 14:46:10 +02:00
parent ba29aa6092
commit 0327d9e575
206 changed files with 13379 additions and 11 deletions

View file

@ -54,13 +54,17 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets\ThridParty\CameraIntrinsics.cs" /> <Compile Include="Assets\ThridParty\KinectScript\CameraIntrinsics.cs" />
<Compile Include="Assets\ThridParty\CollectionMap.cs" /> <Compile Include="Assets\ThridParty\KinectScript\CollectionMap.cs" />
<Compile Include="Assets\ThridParty\EventPump.cs" /> <Compile Include="Assets\ThridParty\KinectScript\EventPump.cs" />
<Compile Include="Assets\ThridParty\ExceptionHelper.cs" /> <Compile Include="Assets\ThridParty\KinectScript\ExceptionHelper.cs" />
<Compile Include="Assets\ThridParty\INativeWrapper.cs" /> <Compile Include="Assets\ThridParty\KinectScript\INativeWrapper.cs" />
<Compile Include="Assets\ThridParty\KinectBuffer.cs" /> <Compile Include="Assets\ThridParty\KinectScript\KinectBuffer.cs" />
<Compile Include="Assets\ThridParty\KinectSpecialCases.cs" /> <Compile Include="Assets\ThridParty\KinectScript\KinectSpecialCases.cs" />
<Compile Include="Assets\ThridParty\KinectScript\NativeObjectCache.cs" />
<Compile Include="Assets\ThridParty\KinectScript\NativeWrapper.cs" />
<Compile Include="Assets\ThridParty\KinectScript\SmartGCHandle.cs" />
<Compile Include="Assets\ThridParty\KinectScript\ThreadSafeDictionary.cs" />
<Compile Include="Assets\ThridParty\KinectView\Scripts\BodySourceManager.cs" /> <Compile Include="Assets\ThridParty\KinectView\Scripts\BodySourceManager.cs" />
<Compile Include="Assets\ThridParty\KinectView\Scripts\BodySourceView.cs" /> <Compile Include="Assets\ThridParty\KinectView\Scripts\BodySourceView.cs" />
<Compile Include="Assets\ThridParty\KinectView\Scripts\ColorSourceManager.cs" /> <Compile Include="Assets\ThridParty\KinectView\Scripts\ColorSourceManager.cs" />
@ -71,10 +75,6 @@
<Compile Include="Assets\ThridParty\KinectView\Scripts\InfraredSourceManager.cs" /> <Compile Include="Assets\ThridParty\KinectView\Scripts\InfraredSourceManager.cs" />
<Compile Include="Assets\ThridParty\KinectView\Scripts\InfraredSourceView.cs" /> <Compile Include="Assets\ThridParty\KinectView\Scripts\InfraredSourceView.cs" />
<Compile Include="Assets\ThridParty\KinectView\Scripts\MultiSourceManager.cs" /> <Compile Include="Assets\ThridParty\KinectView\Scripts\MultiSourceManager.cs" />
<Compile Include="Assets\ThridParty\NativeObjectCache.cs" />
<Compile Include="Assets\ThridParty\NativeWrapper.cs" />
<Compile Include="Assets\ThridParty\SmartGCHandle.cs" />
<Compile Include="Assets\ThridParty\ThreadSafeDictionary.cs" />
<Compile Include="Assets\ThridParty\Windows\Data\PropertyChangedEventArgs.cs" /> <Compile Include="Assets\ThridParty\Windows\Data\PropertyChangedEventArgs.cs" />
<Compile Include="Assets\ThridParty\Windows\Kinect\Activity.cs" /> <Compile Include="Assets\ThridParty\Windows\Kinect\Activity.cs" />
<Compile Include="Assets\ThridParty\Windows\Kinect\Appearance.cs" /> <Compile Include="Assets\ThridParty\Windows\Kinect\Appearance.cs" />

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ca30ef5db57550d4c80d44a639774594
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d679b93fcd19ce040b8f9a6cfda5b25d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,70 @@
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
using System.IO;
public static class KinectCopyPluginDataHelper
{
private const string DataDirSuffix = "_Data";
private const string PluginsDirName = "Plugins";
private static Dictionary<BuildTarget, string> TargetToDirName = new Dictionary<BuildTarget, string>()
{
{BuildTarget.StandaloneWindows, "x86"},
{BuildTarget.StandaloneWindows64, "x86_64"}
};
public static void CopyPluginData(BuildTarget target, string buildTargetPath, string subDirToCopy)
{
string subDirName;
if (!TargetToDirName.TryGetValue (target, out subDirName))
{
// No work to do
return;
}
// Get Required Paths
var buildName = Path.GetFileNameWithoutExtension(buildTargetPath);
var targetDir = Directory.GetParent(buildTargetPath);
var separator = Path.DirectorySeparatorChar;
var buildDataDir = targetDir.FullName + separator + buildName + DataDirSuffix + separator;
var tgtPluginsDir = buildDataDir + separator + PluginsDirName + separator + subDirToCopy + separator;
var srcPluginsDir = Application.dataPath + separator + PluginsDirName + separator + subDirName + separator + subDirToCopy + separator;
CopyAll (new DirectoryInfo (srcPluginsDir), new DirectoryInfo(tgtPluginsDir));
}
/// <summary>
/// Recursive Copy Directory Method
/// </summary>
private static void CopyAll(DirectoryInfo source, DirectoryInfo target)
{
// Check if the source directory exists, if not, don't do any work.
if (!Directory.Exists(source.FullName))
{
return;
}
// Check if the target directory exists, if not, create it.
if (!Directory.Exists(target.FullName))
{
Directory.CreateDirectory(target.FullName);
}
// Copy each file into its new directory.
foreach (var fileInfo in source.GetFiles())
{
fileInfo.CopyTo (Path.Combine (target.ToString (), fileInfo.Name), true);
}
// Copy each subdirectory using recursion.
foreach (var subDirInfo in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(subDirInfo.Name);
CopyAll(subDirInfo, nextTargetSubDir);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a103df75c03c9c54096627354fdb1398
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ac64ad8b219357b4a8aa514e7c2b4b3a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,58 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.CameraIntrinsics
//
[RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)]
public struct CameraIntrinsics
{
public float FocalLengthX { get; set; }
public float FocalLengthY { get; set; }
public float PrincipalPointX { get; set; }
public float PrincipalPointY { get; set; }
public float RadialDistortionSecondOrder { get; set; }
public float RadialDistortionFourthOrder { get; set; }
public float RadialDistortionSixthOrder { get; set; }
public override int GetHashCode()
{
return FocalLengthX.GetHashCode() ^ FocalLengthY.GetHashCode() ^
PrincipalPointX.GetHashCode() ^ PrincipalPointY.GetHashCode() ^
RadialDistortionSecondOrder.GetHashCode() ^ RadialDistortionFourthOrder.GetHashCode() ^
RadialDistortionSixthOrder.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is CameraIntrinsics))
{
return false;
}
return this.Equals((CameraIntrinsics)obj);
}
public bool Equals(CameraIntrinsics obj)
{
return FocalLengthX.Equals(obj.FocalLengthX) && FocalLengthY.Equals(obj.FocalLengthY) &&
PrincipalPointX.Equals(obj.PrincipalPointX) && PrincipalPointY.Equals(obj.PrincipalPointY) &&
RadialDistortionSecondOrder.Equals(obj.RadialDistortionSecondOrder) &&
RadialDistortionFourthOrder.Equals(obj.RadialDistortionFourthOrder) &&
RadialDistortionSixthOrder.Equals(obj.RadialDistortionSixthOrder);
}
public static bool operator ==(CameraIntrinsics a, CameraIntrinsics b)
{
return a.Equals(b);
}
public static bool operator !=(CameraIntrinsics a, CameraIntrinsics b)
{
return !(a.Equals(b));
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bc11ab9581163ba44b721acb44ce8763
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Helper
{
class CollectionMap<TKey, TValue> : Helper.ThreadSafeDictionary<TKey, TValue> where TValue : new()
{
public bool TryAddDefault(TKey key)
{
lock (_impl)
{
if (!_impl.ContainsKey(key))
{
_impl.Add(key, new TValue());
return true;
}
else
{
return false;
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b404867256ddca245871a9152fd54294
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
internal class EventPump : UnityEngine.MonoBehaviour
{
private static object s_Lock = new object();
private Queue<Action> m_Queue = new Queue<Action>();
public static EventPump Instance
{
get;
private set;
}
public static void EnsureInitialized()
{
try
{
if (EventPump.Instance == null)
{
lock (s_Lock)
{
if (EventPump.Instance == null)
{
UnityEngine.GameObject parent = new UnityEngine.GameObject("Kinect Desktop Event Pump");
EventPump.Instance = parent.AddComponent<Helper.EventPump>();
DontDestroyOnLoad(parent);
}
}
}
}
catch
{
UnityEngine.Debug.LogError("Events must be registered on the main thread.");
return;
}
}
private void Update()
{
lock (m_Queue)
{
while (m_Queue.Count > 0)
{
var action = m_Queue.Dequeue();
try
{
action.Invoke();
}
catch { }
}
}
}
private void OnApplicationQuit()
{
var sensor = Windows.Kinect.KinectSensor.GetDefault();
if (sensor != null && sensor.IsOpen)
{
sensor.Close();
}
NativeObjectCache.Flush();
}
public void Enqueue(Action action)
{
lock (m_Queue)
{
m_Queue.Enqueue(action);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: debd3e6b79ccfa7439ef3bc59b8d30e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,50 @@
using System;
using System.Runtime.InteropServices;
namespace Helper
{
public static class ExceptionHelper
{
private const int E_NOTIMPL = unchecked((int)0x80004001);
private const int E_OUTOFMEMORY = unchecked((int)0x8007000E);
private const int E_INVALIDARG = unchecked((int)0x80070057);
private const int E_POINTER = unchecked((int) 0x80004003);
private const int E_PENDING = unchecked((int)0x8000000A);
private const int E_FAIL = unchecked((int)0x80004005);
public static void CheckLastError()
{
int hr = Marshal.GetLastWin32Error();
if ((hr == E_PENDING) || (hr == E_FAIL))
{
// Ignore E_PENDING/E_FAIL - We use this to indicate no pending or missed frames
return;
}
if (hr < 0)
{
Exception exception = Marshal.GetExceptionForHR(hr);
string message = string.Format("This API has returned an exception from an HRESULT: 0x{0:X}", hr);
switch (hr)
{
case E_NOTIMPL:
throw new NotImplementedException(message, exception);
case E_OUTOFMEMORY:
throw new OutOfMemoryException(message, exception);
case E_INVALIDARG:
throw new ArgumentException(message, exception);
case E_POINTER:
throw new ArgumentNullException(message, exception);
default:
throw new InvalidOperationException(message, exception);
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 86085617855511d45b0648e6b62e1584
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
internal interface INativeWrapper
{
System.IntPtr nativePtr { get; }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 010db25b57d940546a60549c96171b70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,129 @@
using RootSystem = System;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Windows.Kinect
{
// NOTE: This uses an IBuffer under the covers, it is renamed here to give parity to our managed APIs.
public class KinectBuffer : Helper.INativeWrapper, IDisposable
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal KinectBuffer(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Storage_Streams_IBuffer_AddRefObject(ref _pNative);
}
~KinectBuffer()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern void Windows_Storage_Streams_IBuffer_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern void Windows_Storage_Streams_IBuffer_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Helper.NativeObjectCache.RemoveObject<KinectBuffer>(_pNative);
if (disposing)
{
Windows_Storage_Streams_IBuffer_Dispose(_pNative);
}
Windows_Storage_Streams_IBuffer_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern uint Windows_Storage_Streams_IBuffer_get_Capacity(RootSystem.IntPtr pNative);
public uint Capacity
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
uint capacity = Windows_Storage_Streams_IBuffer_get_Capacity(_pNative);
Helper.ExceptionHelper.CheckLastError();
return capacity;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern uint Windows_Storage_Streams_IBuffer_get_Length(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern void Windows_Storage_Streams_IBuffer_put_Length(RootSystem.IntPtr pNative, uint value);
public uint Length
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
uint length = Windows_Storage_Streams_IBuffer_get_Length(_pNative);
Helper.ExceptionHelper.CheckLastError();
return length;
}
set
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
Windows_Storage_Streams_IBuffer_put_Length(_pNative, value);
Helper.ExceptionHelper.CheckLastError();
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern void Windows_Storage_Streams_IBuffer_Dispose(RootSystem.IntPtr pNative);
// Constructors and Finalizers
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Storage_Streams_IBuffer_get_UnderlyingBuffer(RootSystem.IntPtr pNative);
public IntPtr UnderlyingBuffer
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
RootSystem.IntPtr value = Windows_Storage_Streams_IBuffer_get_UnderlyingBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
return value;
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a27f97f1b27134f4bbee290cf18c791c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,604 @@
using RootSystem = System;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Windows.Kinect
{
[RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)]
public struct PointF
{
public float X { get; set; }
public float Y { get; set; }
public override int GetHashCode()
{
return X.GetHashCode() ^ Y.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is PointF))
{
return false;
}
return this.Equals((ColorSpacePoint)obj);
}
public bool Equals(ColorSpacePoint obj)
{
return (X == obj.X) && (Y == obj.Y);
}
public static bool operator ==(PointF a, PointF b)
{
return a.Equals(b);
}
public static bool operator !=(PointF a, PointF b)
{
return !(a.Equals(b));
}
}
public sealed partial class AudioBeamSubFrame
{
[RootSystem.Runtime.InteropServices.DllImport(
"KinectUnityAddin",
EntryPoint = "Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray",
CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl,
SetLastError = true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToIntPtr(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, uint frameDataSize);
public void CopyFrameDataToIntPtr(RootSystem.IntPtr frameData, uint size)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToIntPtr(_pNative, frameData, size);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamSubFrame_LockAudioBuffer(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectBuffer LockAudioBuffer()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamSubFrame_LockAudioBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectBuffer>(objectPointer, n => new Windows.Kinect.KinectBuffer(n));
}
}
public sealed partial class AudioBeamFrame
{
private Windows.Kinect.AudioBeamSubFrame[] _subFrames = null;
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
if (_subFrames != null)
{
foreach (var subFrame in _subFrames)
{
subFrame.Dispose();
}
_subFrames = null;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrame>(_pNative);
Windows_Kinect_AudioBeamFrame_ReleaseObject(ref _pNative);
if (disposing)
{
Windows_Kinect_AudioBeamFrame_Dispose(_pNative);
}
_pNative = RootSystem.IntPtr.Zero;
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern void Windows_Kinect_AudioBeamFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern int Windows_Kinect_AudioBeamFrame_get_SubFrames(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern int Windows_Kinect_AudioBeamFrame_get_SubFrames_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBeamSubFrame> SubFrames
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
if (_subFrames == null)
{
int collectionSize = Windows_Kinect_AudioBeamFrame_get_SubFrames_Length(_pNative);
var outCollection = new RootSystem.IntPtr[collectionSize];
_subFrames = new Windows.Kinect.AudioBeamSubFrame[collectionSize];
collectionSize = Windows_Kinect_AudioBeamFrame_get_SubFrames(_pNative, outCollection, collectionSize);
Helper.ExceptionHelper.CheckLastError();
for (int i = 0; i < collectionSize; i++)
{
if (outCollection[i] == RootSystem.IntPtr.Zero)
{
continue;
}
var obj = Helper.NativeObjectCache.GetObject<Windows.Kinect.AudioBeamSubFrame>(outCollection[i]);
if (obj == null)
{
obj = new Windows.Kinect.AudioBeamSubFrame(outCollection[i]);
Helper.NativeObjectCache.AddObject<Windows.Kinect.AudioBeamSubFrame>(outCollection[i], obj);
}
_subFrames[i] = obj;
}
}
return _subFrames;
}
}
}
public sealed partial class BodyFrame
{
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern void Windows_Kinect_BodyFrame_GetAndRefreshBodyData(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] bodies, int bodiesSize);
public void GetAndRefreshBodyData(RootSystem.Collections.Generic.IList<Windows.Kinect.Body> bodies)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
int _bodies_idx = 0;
var _bodies = new RootSystem.IntPtr[bodies.Count];
for (int i = 0; i < bodies.Count; i++)
{
if (bodies[i] == null)
{
bodies[i] = new Body();
}
_bodies[_bodies_idx] = bodies[i].GetIntPtr();
_bodies_idx++;
}
Windows_Kinect_BodyFrame_GetAndRefreshBodyData(_pNative, _bodies, bodies.Count);
Helper.ExceptionHelper.CheckLastError();
for (int i = 0; i < bodies.Count; i++)
{
bodies[i].SetIntPtr(_bodies[i]);
}
}
}
public sealed partial class Body
{
internal void SetIntPtr(RootSystem.IntPtr value) { _pNative = value; }
internal RootSystem.IntPtr GetIntPtr() { return _pNative; }
internal Body() { }
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_Body_get_Lean(RootSystem.IntPtr pNative);
public Windows.Kinect.PointF Lean
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
var objectPointer = Windows_Kinect_Body_get_Lean(_pNative);
Helper.ExceptionHelper.CheckLastError();
var obj = (Windows.Kinect.PointF)RootSystem.Runtime.InteropServices.Marshal.PtrToStructure(objectPointer, typeof(Windows.Kinect.PointF));
RootSystem.Runtime.InteropServices.Marshal.FreeHGlobal(objectPointer);
return obj;
}
}
}
public sealed partial class ColorFrame
{
[RootSystem.Runtime.InteropServices.DllImport(
"KinectUnityAddin",
EntryPoint = "Windows_Kinect_ColorFrame_CopyRawFrameDataToArray",
CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl,
SetLastError = true)]
private static extern void Windows_Kinect_ColorFrame_CopyRawFrameDataToIntPtr(RootSystem.IntPtr pNative, IntPtr frameData, uint frameDataSize);
public void CopyRawFrameDataToIntPtr(RootSystem.IntPtr frameData, uint size)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
Windows_Kinect_ColorFrame_CopyRawFrameDataToIntPtr(_pNative, frameData, size);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport(
"KinectUnityAddin",
EntryPoint = "Windows_Kinect_ColorFrame_CopyConvertedFrameDataToArray",
CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl,
SetLastError = true)]
private static extern void Windows_Kinect_ColorFrame_CopyConvertedFrameDataToIntPtr(RootSystem.IntPtr pNative, IntPtr frameData, uint frameDataSize, Windows.Kinect.ColorImageFormat colorFormat);
public void CopyConvertedFrameDataToIntPtr(RootSystem.IntPtr frameData, uint size, Windows.Kinect.ColorImageFormat colorFormat)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
Windows_Kinect_ColorFrame_CopyConvertedFrameDataToIntPtr(_pNative, frameData, size, colorFormat);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_LockRawImageBuffer(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectBuffer LockRawImageBuffer()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_LockRawImageBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectBuffer>(objectPointer, n => new Windows.Kinect.KinectBuffer(n));
}
}
public sealed partial class DepthFrame
{
[RootSystem.Runtime.InteropServices.DllImport(
"KinectUnityAddin",
EntryPoint = "Windows_Kinect_DepthFrame_CopyFrameDataToArray",
CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl,
SetLastError = true)]
private static extern void Windows_Kinect_DepthFrame_CopyFrameDataToIntPtr(RootSystem.IntPtr pNative, IntPtr frameData, uint frameDataSize);
public void CopyFrameDataToIntPtr(RootSystem.IntPtr frameData, uint size)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
Windows_Kinect_DepthFrame_CopyFrameDataToIntPtr(_pNative, frameData, size / sizeof(ushort));
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_DepthFrame_LockImageBuffer(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectBuffer LockImageBuffer()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrame_LockImageBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectBuffer>(objectPointer, n => new Windows.Kinect.KinectBuffer(n));
}
}
public sealed partial class BodyIndexFrame
{
[RootSystem.Runtime.InteropServices.DllImport(
"KinectUnityAddin",
EntryPoint = "Windows_Kinect_BodyIndexFrame_CopyFrameDataToArray",
CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl,
SetLastError = true)]
private static extern void Windows_Kinect_BodyIndexFrame_CopyFrameDataToIntPtr(RootSystem.IntPtr pNative, IntPtr frameData, uint frameDataSize);
public void CopyFrameDataToIntPtr(RootSystem.IntPtr frameData, uint size)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
Windows_Kinect_BodyIndexFrame_CopyFrameDataToIntPtr(_pNative, frameData, size);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrame_LockImageBuffer(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectBuffer LockImageBuffer()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrame_LockImageBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectBuffer>(objectPointer, n => new Windows.Kinect.KinectBuffer(n));
}
}
public sealed partial class InfraredFrame
{
[RootSystem.Runtime.InteropServices.DllImport(
"KinectUnityAddin",
EntryPoint = "Windows_Kinect_InfraredFrame_CopyFrameDataToArray",
CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl,
SetLastError = true)]
private static extern void Windows_Kinect_InfraredFrame_CopyFrameDataToIntPtr(RootSystem.IntPtr pNative, IntPtr frameData, uint frameDataSize);
public void CopyFrameDataToIntPtr(RootSystem.IntPtr frameData, uint size)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("InfraredFrame");
}
Windows_Kinect_InfraredFrame_CopyFrameDataToIntPtr(_pNative, frameData, size / sizeof(ushort));
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_InfraredFrame_LockImageBuffer(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectBuffer LockImageBuffer()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("InfraredFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_InfraredFrame_LockImageBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectBuffer>(objectPointer, n => new Windows.Kinect.KinectBuffer(n));
}
}
public sealed partial class KinectSensor
{
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
if (IsOpen)
{
Close();
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<KinectSensor>(_pNative);
Windows_Kinect_KinectSensor_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
}
public sealed partial class LongExposureInfraredFrame
{
[RootSystem.Runtime.InteropServices.DllImport(
"KinectUnityAddin",
EntryPoint = "Windows_Kinect_LongExposureInfraredFrame_CopyFrameDataToArray",
CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl,
SetLastError = true)]
private static extern void Windows_Kinect_LongExposureInfraredFrame_CopyFrameDataToIntPtr(RootSystem.IntPtr pNative, IntPtr frameData, uint frameDataSize);
public void CopyFrameDataToIntPtr(RootSystem.IntPtr frameData, uint size)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrame");
}
Windows_Kinect_LongExposureInfraredFrame_CopyFrameDataToIntPtr(_pNative, frameData, size / sizeof(ushort));
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_LongExposureInfraredFrame_LockImageBuffer(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectBuffer LockImageBuffer()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("LongExposureInfraredFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_LongExposureInfraredFrame_LockImageBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectBuffer>(objectPointer, n => new Windows.Kinect.KinectBuffer(n));
}
}
public sealed partial class CoordinateMapper
{
private PointF[] _DepthFrameToCameraSpaceTable = null;
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Kinect_CoordinateMapper_GetDepthCameraIntrinsics(RootSystem.IntPtr pNative);
public Windows.Kinect.CameraIntrinsics GetDepthCameraIntrinsics()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("CoordinateMapper");
}
var objectPointer = Windows_Kinect_CoordinateMapper_GetDepthCameraIntrinsics(_pNative);
Helper.ExceptionHelper.CheckLastError();
var obj = (Windows.Kinect.CameraIntrinsics)RootSystem.Runtime.InteropServices.Marshal.PtrToStructure(objectPointer, typeof(Windows.Kinect.CameraIntrinsics));
RootSystem.Runtime.InteropServices.Marshal.FreeHGlobal(objectPointer);
return obj;
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern int Windows_Kinect_CoordinateMapper_GetDepthFrameToCameraSpaceTable(RootSystem.IntPtr pNative, RootSystem.IntPtr outCollection, uint outCollectionSize);
public Windows.Kinect.PointF[] GetDepthFrameToCameraSpaceTable()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("CoordinateMapper");
}
if (_DepthFrameToCameraSpaceTable == null)
{
var desc = KinectSensor.GetDefault().DepthFrameSource.FrameDescription;
_DepthFrameToCameraSpaceTable = new PointF[desc.Width * desc.Height];
var pointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(_DepthFrameToCameraSpaceTable, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _points = pointsSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_CoordinateMapper_GetDepthFrameToCameraSpaceTable(_pNative, _points, (uint)_DepthFrameToCameraSpaceTable.Length);
Helper.ExceptionHelper.CheckLastError();
}
return _DepthFrameToCameraSpaceTable;
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern void Windows_Kinect_CoordinateMapper_MapColorFrameToDepthSpace(
RootSystem.IntPtr pNative,
RootSystem.IntPtr depthFrameData,
uint depthFrameDataSize,
RootSystem.IntPtr depthSpacePoints,
uint depthSpacePointsSize);
public void MapColorFrameToDepthSpaceUsingIntPtr(RootSystem.IntPtr depthFrameData, uint depthFrameSize, RootSystem.IntPtr depthSpacePoints, uint depthSpacePointsSize)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("CoordinateMapper");
}
uint length = depthFrameSize / sizeof(UInt16);
Windows_Kinect_CoordinateMapper_MapColorFrameToDepthSpace(_pNative, depthFrameData, length, depthSpacePoints, depthSpacePointsSize);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern void Windows_Kinect_CoordinateMapper_MapColorFrameToCameraSpace(
RootSystem.IntPtr pNative,
RootSystem.IntPtr depthFrameData,
uint depthFrameDataSize,
RootSystem.IntPtr cameraSpacePoints,
uint cameraSpacePointsSize);
public void MapColorFrameToCameraSpaceUsingIntPtr(RootSystem.IntPtr depthFrameData, int depthFrameSize, RootSystem.IntPtr cameraSpacePoints, uint cameraSpacePointsSize)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("CoordinateMapper");
}
uint length = (uint)depthFrameSize / sizeof(UInt16);
Windows_Kinect_CoordinateMapper_MapColorFrameToCameraSpace(_pNative, depthFrameData, length, cameraSpacePoints, cameraSpacePointsSize);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern void Windows_Kinect_CoordinateMapper_MapDepthFrameToColorSpace(
RootSystem.IntPtr pNative,
RootSystem.IntPtr depthFrameData,
uint depthFrameDataSize,
RootSystem.IntPtr colorSpacePoints,
uint colorSpacePointsSize);
public void MapDepthFrameToColorSpaceUsingIntPtr(RootSystem.IntPtr depthFrameData, int depthFrameSize, RootSystem.IntPtr colorSpacePoints, uint colorSpacePointsSize)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("CoordinateMapper");
}
uint length = (uint)depthFrameSize / sizeof(UInt16);
Windows_Kinect_CoordinateMapper_MapDepthFrameToColorSpace(_pNative, depthFrameData, length, colorSpacePoints, colorSpacePointsSize);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern void Windows_Kinect_CoordinateMapper_MapDepthFrameToCameraSpace(
RootSystem.IntPtr pNative,
IntPtr depthFrameData,
uint depthFrameDataSize,
RootSystem.IntPtr cameraSpacePoints,
uint cameraSpacePointsSize);
public void MapDepthFrameToCameraSpaceUsingIntPtr(RootSystem.IntPtr depthFrameData, int depthFrameSize, RootSystem.IntPtr cameraSpacePoints, uint cameraSpacePointsSize)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("CoordinateMapper");
}
uint length = (uint)depthFrameSize / sizeof(UInt16);
Windows_Kinect_CoordinateMapper_MapDepthFrameToCameraSpace(_pNative, depthFrameData, length, cameraSpacePoints, cameraSpacePointsSize);
Helper.ExceptionHelper.CheckLastError();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c59b79770236fae42a76e291570f2447
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public static class NativeObjectCache
{
private static object _lock = new object();
private static Dictionary<Type, Dictionary<IntPtr, WeakReference>> _objectCache = new Dictionary<Type, Dictionary<IntPtr, WeakReference>>();
public static void AddObject<T>(IntPtr nativePtr, T obj) where T : class
{
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
objCache[nativePtr] = new WeakReference(obj);
}
}
public static void Flush()
{
lock(_lock)
{
foreach (var byType in _objectCache.ToArray())
{
foreach(var kvp in byType.Value.ToArray())
{
IDisposable disp = kvp.Value.Target as IDisposable;
if(disp != null)
{
disp.Dispose();
}
}
}
}
}
public static void RemoveObject<T>(IntPtr nativePtr)
{
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
if (objCache.ContainsKey(nativePtr))
{
objCache.Remove(nativePtr);
}
}
}
public static T GetObject<T>(IntPtr nativePtr) where T : class
{
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
WeakReference reference = null;
if (objCache.TryGetValue(nativePtr, out reference))
{
if (reference != null)
{
T obj = reference.Target as T;
if (obj != null)
{
return (T)obj;
}
}
}
return null;
}
}
public static T CreateOrGetObject<T>(IntPtr nativePtr, Func<System.IntPtr,T> create) where T : class
{
T outputValue = null;
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
WeakReference reference = null;
if (objCache.TryGetValue(nativePtr, out reference))
{
if ((reference != null) && reference.IsAlive)
{
outputValue = reference.Target as T;
}
}
if (outputValue == null)
{
if (create != null)
{
outputValue = create(nativePtr);
objCache[nativePtr] = new WeakReference(outputValue);
}
else if(typeof(T) == typeof(System.Object))
{
//T is an object, so lets just pass back our IntPtr, which is an object.
outputValue = (T)(System.Object)nativePtr;
}
}
}
return outputValue;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 96cf7d466b0b0bb4d92fb09d817ad613
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public static class NativeWrapper
{
public static System.IntPtr GetNativePtr(Object obj)
{
if(obj == null)
{
return System.IntPtr.Zero;
}
var nativeWrapperIface = obj as INativeWrapper;
if(nativeWrapperIface != null)
{
return nativeWrapperIface.nativePtr;
}
else
{
throw new ArgumentException("Object must wrap native type");
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0eb32acf7ae62044194131ae0f7e4516
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public class SmartGCHandle : IDisposable
{
private GCHandle handle;
public SmartGCHandle(GCHandle handle)
{
this.handle = handle;
}
~SmartGCHandle()
{
Dispose(false);
}
public System.IntPtr AddrOfPinnedObject()
{
return handle.AddrOfPinnedObject();
}
public virtual void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool disposing)
{
this.handle.Free();
}
public static implicit operator GCHandle(SmartGCHandle other)
{
return other.handle;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: adc912eeb5de2014f9ca670eca6ac808
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public class ThreadSafeDictionary<TKey, TValue>
{
protected readonly Dictionary<TKey, TValue> _impl = new Dictionary<TKey, TValue>();
public TValue this[TKey key]
{
get
{
lock (_impl)
{
return _impl[key];
}
}
set
{
lock (_impl)
{
_impl[key] = value;
}
}
}
public void Add(TKey key, TValue value)
{
lock (_impl)
{
_impl.Add(key, value);
}
}
public bool TryGetValue(TKey key, out TValue value)
{
lock (_impl)
{
return _impl.TryGetValue(key, out value);
}
}
public bool Remove(TKey key)
{
lock (_impl)
{
return _impl.Remove(key);
}
}
public void Clear()
{
lock (_impl)
{
_impl.Clear();
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b31ad795626855f41842734c10d2a41f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: abc0bdd9d88ff784ba2ef62dea99f5cb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: be6b0f8f61cfb0546b28fc9e1e07aea7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc347fec4001191469ed16345b5e71dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: f2ea145c63353784985576f08398a815
NativeFormatImporter:
userData:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2fe8ee5ed16142f4db68624c68e84b89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,70 @@
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class BodySourceManager : MonoBehaviour
{
private KinectSensor _Sensor;
private BodyFrameReader _Reader;
private Body[] _Data = null;
public Body[] GetData()
{
return _Data;
}
void Start ()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.BodyFrameSource.OpenReader();
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
if (_Data == null)
{
_Data = new Body[_Sensor.BodyFrameSource.BodyCount];
}
frame.GetAndRefreshBodyData(_Data);
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e74aed0503c9d24290a1ae5438fddc3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,179 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Kinect = Windows.Kinect;
public class BodySourceView : MonoBehaviour
{
public Material BoneMaterial;
public GameObject BodySourceManager;
private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>();
private BodySourceManager _BodyManager;
private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>()
{
{ Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft },
{ Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft },
{ Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft },
{ Kinect.JointType.HipLeft, Kinect.JointType.SpineBase },
{ Kinect.JointType.FootRight, Kinect.JointType.AnkleRight },
{ Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight },
{ Kinect.JointType.KneeRight, Kinect.JointType.HipRight },
{ Kinect.JointType.HipRight, Kinect.JointType.SpineBase },
{ Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.HandLeft, Kinect.JointType.WristLeft },
{ Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft },
{ Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft },
{ Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.HandTipRight, Kinect.JointType.HandRight },
{ Kinect.JointType.ThumbRight, Kinect.JointType.HandRight },
{ Kinect.JointType.HandRight, Kinect.JointType.WristRight },
{ Kinect.JointType.WristRight, Kinect.JointType.ElbowRight },
{ Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight },
{ Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineBase, Kinect.JointType.SpineMid },
{ Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineShoulder, Kinect.JointType.Neck },
{ Kinect.JointType.Neck, Kinect.JointType.Head },
};
void Update ()
{
if (BodySourceManager == null)
{
return;
}
_BodyManager = BodySourceManager.GetComponent<BodySourceManager>();
if (_BodyManager == null)
{
return;
}
Kinect.Body[] data = _BodyManager.GetData();
if (data == null)
{
return;
}
List<ulong> trackedIds = new List<ulong>();
foreach(var body in data)
{
if (body == null)
{
continue;
}
if(body.IsTracked)
{
trackedIds.Add (body.TrackingId);
}
}
List<ulong> knownIds = new List<ulong>(_Bodies.Keys);
// First delete untracked bodies
foreach(ulong trackingId in knownIds)
{
if(!trackedIds.Contains(trackingId))
{
Destroy(_Bodies[trackingId]);
_Bodies.Remove(trackingId);
}
}
foreach(var body in data)
{
if (body == null)
{
continue;
}
if(body.IsTracked)
{
if(!_Bodies.ContainsKey(body.TrackingId))
{
_Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId);
}
RefreshBodyObject(body, _Bodies[body.TrackingId]);
}
}
}
private GameObject CreateBodyObject(ulong id)
{
GameObject body = new GameObject("Body:" + id);
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
LineRenderer lr = jointObj.AddComponent<LineRenderer>();
lr.SetVertexCount(2);
lr.material = BoneMaterial;
lr.SetWidth(0.05f, 0.05f);
jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
jointObj.name = jt.ToString();
jointObj.transform.parent = body.transform;
}
return body;
}
private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject)
{
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
Kinect.Joint sourceJoint = body.Joints[jt];
Kinect.Joint? targetJoint = null;
if(_BoneMap.ContainsKey(jt))
{
targetJoint = body.Joints[_BoneMap[jt]];
}
Transform jointObj = bodyObject.transform.Find(jt.ToString());
jointObj.localPosition = GetVector3FromJoint(sourceJoint);
LineRenderer lr = jointObj.GetComponent<LineRenderer>();
if(targetJoint.HasValue)
{
lr.SetPosition(0, jointObj.localPosition);
lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
lr.SetColors(GetColorForState (sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState));
}
else
{
lr.enabled = false;
}
}
}
private static Color GetColorForState(Kinect.TrackingState state)
{
switch (state)
{
case Kinect.TrackingState.Tracked:
return Color.green;
case Kinect.TrackingState.Inferred:
return Color.red;
default:
return Color.black;
}
}
private static Vector3 GetVector3FromJoint(Kinect.Joint joint)
{
return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10);
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8821130411451d343a1488e2a9db134e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,78 @@
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class ColorSourceManager : MonoBehaviour
{
public int ColorWidth { get; private set; }
public int ColorHeight { get; private set; }
private KinectSensor _Sensor;
private ColorFrameReader _Reader;
private Texture2D _Texture;
private byte[] _Data;
public Texture2D GetColorTexture()
{
return _Texture;
}
void Start()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.ColorFrameSource.OpenReader();
var frameDesc = _Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba);
ColorWidth = frameDesc.Width;
ColorHeight = frameDesc.Height;
_Texture = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.RGBA32, false);
_Data = new byte[frameDesc.BytesPerPixel * frameDesc.LengthInPixels];
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
frame.CopyConvertedFrameDataToArray(_Data, ColorImageFormat.Rgba);
_Texture.LoadRawTextureData(_Data);
_Texture.Apply();
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 92ab5bea6110edb4081e490c0982748d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class ColorSourceView : MonoBehaviour
{
public GameObject ColorSourceManager;
private ColorSourceManager _ColorManager;
void Start ()
{
gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", new Vector2(-1, 1));
}
void Update()
{
if (ColorSourceManager == null)
{
return;
}
_ColorManager = ColorSourceManager.GetComponent<ColorSourceManager>();
if (_ColorManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _ColorManager.GetColorTexture();
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee5302fdf7d10e74fbbbe1a2f7503f46
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,59 @@
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class DepthSourceManager : MonoBehaviour
{
private KinectSensor _Sensor;
private DepthFrameReader _Reader;
private ushort[] _Data;
public ushort[] GetData()
{
return _Data;
}
void Start ()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.DepthFrameSource.OpenReader();
_Data = new ushort[_Sensor.DepthFrameSource.FrameDescription.LengthInPixels];
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
frame.CopyFrameDataToArray(_Data);
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1cd019cdd7a54604b9ae8091d242d8a4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,252 @@
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public enum DepthViewMode
{
SeparateSourceReaders,
MultiSourceReader,
}
public class DepthSourceView : MonoBehaviour
{
public DepthViewMode ViewMode = DepthViewMode.SeparateSourceReaders;
public GameObject ColorSourceManager;
public GameObject DepthSourceManager;
public GameObject MultiSourceManager;
private KinectSensor _Sensor;
private CoordinateMapper _Mapper;
private Mesh _Mesh;
private Vector3[] _Vertices;
private Vector2[] _UV;
private int[] _Triangles;
// Only works at 4 right now
private const int _DownsampleSize = 4;
private const double _DepthScale = 0.1f;
private const int _Speed = 50;
private MultiSourceManager _MultiManager;
private ColorSourceManager _ColorManager;
private DepthSourceManager _DepthManager;
void Start()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Mapper = _Sensor.CoordinateMapper;
var frameDesc = _Sensor.DepthFrameSource.FrameDescription;
// Downsample to lower resolution
CreateMesh(frameDesc.Width / _DownsampleSize, frameDesc.Height / _DownsampleSize);
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void CreateMesh(int width, int height)
{
_Mesh = new Mesh();
GetComponent<MeshFilter>().mesh = _Mesh;
_Vertices = new Vector3[width * height];
_UV = new Vector2[width * height];
_Triangles = new int[6 * ((width - 1) * (height - 1))];
int triangleIndex = 0;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
int index = (y * width) + x;
_Vertices[index] = new Vector3(x, -y, 0);
_UV[index] = new Vector2(((float)x / (float)width), ((float)y / (float)height));
// Skip the last row/col
if (x != (width - 1) && y != (height - 1))
{
int topLeft = index;
int topRight = topLeft + 1;
int bottomLeft = topLeft + width;
int bottomRight = bottomLeft + 1;
_Triangles[triangleIndex++] = topLeft;
_Triangles[triangleIndex++] = topRight;
_Triangles[triangleIndex++] = bottomLeft;
_Triangles[triangleIndex++] = bottomLeft;
_Triangles[triangleIndex++] = topRight;
_Triangles[triangleIndex++] = bottomRight;
}
}
}
_Mesh.vertices = _Vertices;
_Mesh.uv = _UV;
_Mesh.triangles = _Triangles;
_Mesh.RecalculateNormals();
}
void OnGUI()
{
GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height));
GUI.TextField(new Rect(Screen.width - 250 , 10, 250, 20), "DepthMode: " + ViewMode.ToString());
GUI.EndGroup();
}
void Update()
{
if (_Sensor == null)
{
return;
}
if (Input.GetButtonDown("Fire1"))
{
if(ViewMode == DepthViewMode.MultiSourceReader)
{
ViewMode = DepthViewMode.SeparateSourceReaders;
}
else
{
ViewMode = DepthViewMode.MultiSourceReader;
}
}
float yVal = Input.GetAxis("Horizontal");
float xVal = -Input.GetAxis("Vertical");
transform.Rotate(
(xVal * Time.deltaTime * _Speed),
(yVal * Time.deltaTime * _Speed),
0,
Space.Self);
if (ViewMode == DepthViewMode.SeparateSourceReaders)
{
if (ColorSourceManager == null)
{
return;
}
_ColorManager = ColorSourceManager.GetComponent<ColorSourceManager>();
if (_ColorManager == null)
{
return;
}
if (DepthSourceManager == null)
{
return;
}
_DepthManager = DepthSourceManager.GetComponent<DepthSourceManager>();
if (_DepthManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _ColorManager.GetColorTexture();
RefreshData(_DepthManager.GetData(),
_ColorManager.ColorWidth,
_ColorManager.ColorHeight);
}
else
{
if (MultiSourceManager == null)
{
return;
}
_MultiManager = MultiSourceManager.GetComponent<MultiSourceManager>();
if (_MultiManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _MultiManager.GetColorTexture();
RefreshData(_MultiManager.GetDepthData(),
_MultiManager.ColorWidth,
_MultiManager.ColorHeight);
}
}
private void RefreshData(ushort[] depthData, int colorWidth, int colorHeight)
{
var frameDesc = _Sensor.DepthFrameSource.FrameDescription;
ColorSpacePoint[] colorSpace = new ColorSpacePoint[depthData.Length];
_Mapper.MapDepthFrameToColorSpace(depthData, colorSpace);
for (int y = 0; y < frameDesc.Height; y += _DownsampleSize)
{
for (int x = 0; x < frameDesc.Width; x += _DownsampleSize)
{
int indexX = x / _DownsampleSize;
int indexY = y / _DownsampleSize;
int smallIndex = (indexY * (frameDesc.Width / _DownsampleSize)) + indexX;
double avg = GetAvg(depthData, x, y, frameDesc.Width, frameDesc.Height);
avg = avg * _DepthScale;
_Vertices[smallIndex].z = (float)avg;
// Update UV mapping with CDRP
var colorSpacePoint = colorSpace[(y * frameDesc.Width) + x];
_UV[smallIndex] = new Vector2(colorSpacePoint.X / colorWidth, colorSpacePoint.Y / colorHeight);
}
}
_Mesh.vertices = _Vertices;
_Mesh.uv = _UV;
_Mesh.triangles = _Triangles;
_Mesh.RecalculateNormals();
}
private double GetAvg(ushort[] depthData, int x, int y, int width, int height)
{
double sum = 0.0;
for (int y1 = y; y1 < y + 4; y1++)
{
for (int x1 = x; x1 < x + 4; x1++)
{
int fullIndex = (y1 * width) + x1;
if (depthData[fullIndex] == 0)
sum += 4500;
else
sum += depthData[fullIndex];
}
}
return sum / 16;
}
void OnApplicationQuit()
{
if (_Mapper != null)
{
_Mapper = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 383e102cbe3bfb34d94c98ea3c2479b4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,11 @@
using UnityEngine;
using System.Collections;
public class DisableOnStart : MonoBehaviour {
// Use this for initialization
void Start ()
{
gameObject.SetActive (false);
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 61e5c93f5da1e324aa7fd9671db875bc
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,85 @@
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class InfraredSourceManager : MonoBehaviour
{
private KinectSensor _Sensor;
private InfraredFrameReader _Reader;
private ushort[] _Data;
private byte[] _RawData;
// I'm not sure this makes sense for the Kinect APIs
// Instead, this logic should be in the VIEW
private Texture2D _Texture;
public Texture2D GetInfraredTexture()
{
return _Texture;
}
void Start()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.InfraredFrameSource.OpenReader();
var frameDesc = _Sensor.InfraredFrameSource.FrameDescription;
_Data = new ushort[frameDesc.LengthInPixels];
_RawData = new byte[frameDesc.LengthInPixels * 4];
_Texture = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.BGRA32, false);
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
frame.CopyFrameDataToArray(_Data);
int index = 0;
foreach(var ir in _Data)
{
byte intensity = (byte)(ir >> 8);
_RawData[index++] = intensity;
_RawData[index++] = intensity;
_RawData[index++] = intensity;
_RawData[index++] = 255; // Alpha
}
_Texture.LoadRawTextureData(_RawData);
_Texture.Apply();
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 63eff7f54e54aa049a2331755f3cb99c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
public class InfraredSourceView : MonoBehaviour
{
public GameObject InfraredSourceManager;
private InfraredSourceManager _InfraredManager;
void Start ()
{
gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", new Vector2(-1, 1));
}
void Update()
{
if (InfraredSourceManager == null)
{
return;
}
_InfraredManager = InfraredSourceManager.GetComponent<InfraredSourceManager>();
if (_InfraredManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _InfraredManager.GetInfraredTexture();
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 98f8736f9d8c8e44592c96e57d57c5d4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,100 @@
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class MultiSourceManager : MonoBehaviour {
public int ColorWidth { get; private set; }
public int ColorHeight { get; private set; }
private KinectSensor _Sensor;
private MultiSourceFrameReader _Reader;
private Texture2D _ColorTexture;
private ushort[] _DepthData;
private byte[] _ColorData;
public Texture2D GetColorTexture()
{
return _ColorTexture;
}
public ushort[] GetDepthData()
{
return _DepthData;
}
void Start ()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth);
var colorFrameDesc = _Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba);
ColorWidth = colorFrameDesc.Width;
ColorHeight = colorFrameDesc.Height;
_ColorTexture = new Texture2D(colorFrameDesc.Width, colorFrameDesc.Height, TextureFormat.RGBA32, false);
_ColorData = new byte[colorFrameDesc.BytesPerPixel * colorFrameDesc.LengthInPixels];
var depthFrameDesc = _Sensor.DepthFrameSource.FrameDescription;
_DepthData = new ushort[depthFrameDesc.LengthInPixels];
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
var colorFrame = frame.ColorFrameReference.AcquireFrame();
if (colorFrame != null)
{
var depthFrame = frame.DepthFrameReference.AcquireFrame();
if (depthFrame != null)
{
colorFrame.CopyConvertedFrameDataToArray(_ColorData, ColorImageFormat.Rgba);
_ColorTexture.LoadRawTextureData(_ColorData);
_ColorTexture.Apply();
depthFrame.CopyFrameDataToArray(_DepthData);
depthFrame.Dispose();
depthFrame = null;
}
colorFrame.Dispose();
colorFrame = null;
}
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f752c4e07617d8d4eb21d4975a2d7c61
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 54de333b03246424ba3091b44f9e0114
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5a7a988c4678d55498baf13c6fc26ef0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,73 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Data
{
//
// Windows.Data.PropertyChangedEventArgs
//
public sealed partial class PropertyChangedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal PropertyChangedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Data_PropertyChangedEventArgs_AddRefObject(ref _pNative);
}
~PropertyChangedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Data_PropertyChangedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Data_PropertyChangedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<PropertyChangedEventArgs>(_pNative);
Windows_Data_PropertyChangedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Data_PropertyChangedEventArgs_get_PropertyName(RootSystem.IntPtr pNative);
public string PropertyName
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("PropertyChangedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Data_PropertyChangedEventArgs_get_PropertyName(_pNative);
Helper.ExceptionHelper.CheckLastError();
var managedString = RootSystem.Runtime.InteropServices.Marshal.PtrToStringUni(objectPointer);
RootSystem.Runtime.InteropServices.Marshal.FreeCoTaskMem(objectPointer);
return managedString;
}
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0f717bd2a5c39cc43a49fc8904889932
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b566cd4d01a560341b7da441f29bffe5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.Activity
//
public enum Activity : int
{
EyeLeftClosed =0,
EyeRightClosed =1,
MouthOpen =2,
MouthMoved =3,
LookingAway =4,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ec6785f19ac6c494a9957fa63f49fcf5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.Appearance
//
public enum Appearance : int
{
WearingGlasses =0,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00eb0d9c4964c0b4f9e3090704ff7201
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,240 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeam
//
public sealed partial class AudioBeam : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeam(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeam_AddRefObject(ref _pNative);
}
~AudioBeam()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeam_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeam_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeam>(_pNative);
Windows_Kinect_AudioBeam_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.AudioBeamMode Windows_Kinect_AudioBeam_get_AudioBeamMode(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeam_put_AudioBeamMode(RootSystem.IntPtr pNative, Windows.Kinect.AudioBeamMode audioBeamMode);
public Windows.Kinect.AudioBeamMode AudioBeamMode
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeam");
}
return Windows_Kinect_AudioBeam_get_AudioBeamMode(_pNative);
}
set
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeam");
}
Windows_Kinect_AudioBeam_put_AudioBeamMode(_pNative, value);
Helper.ExceptionHelper.CheckLastError();
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeam_get_AudioSource(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioSource AudioSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeam");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeam_get_AudioSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioSource>(objectPointer, n => new Windows.Kinect.AudioSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_AudioBeam_get_BeamAngle(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeam_put_BeamAngle(RootSystem.IntPtr pNative, float beamAngle);
public float BeamAngle
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeam");
}
return Windows_Kinect_AudioBeam_get_BeamAngle(_pNative);
}
set
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeam");
}
Windows_Kinect_AudioBeam_put_BeamAngle(_pNative, value);
Helper.ExceptionHelper.CheckLastError();
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_AudioBeam_get_BeamAngleConfidence(RootSystem.IntPtr pNative);
public float BeamAngleConfidence
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeam");
}
return Windows_Kinect_AudioBeam_get_BeamAngleConfidence(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeam_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeam");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeam_get_RelativeTime(_pNative));
}
}
// Events
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Data_PropertyChangedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Data_PropertyChangedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>> Windows_Data_PropertyChangedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Data_PropertyChangedEventArgs_Delegate))]
private static void Windows_Data_PropertyChangedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>> callbackList = null;
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<AudioBeam>(pNative);
var args = new Windows.Data.PropertyChangedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeam_add_PropertyChanged(RootSystem.IntPtr pNative, _Windows_Data_PropertyChangedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs> PropertyChanged
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Data_PropertyChangedEventArgs_Delegate(Windows_Data_PropertyChangedEventArgs_Delegate_Handler);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_AudioBeam_add_PropertyChanged(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_AudioBeam_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
// Public Methods
private void __EventCleanup()
{
{
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_AudioBeam_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
}
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e64f7eb8de6f72e42874eb2ea7c01be5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,114 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrame
//
public sealed partial class AudioBeamFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrame_AddRefObject(ref _pNative);
}
~AudioBeamFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrame_AddRefObject(ref RootSystem.IntPtr pNative);
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrame_get_AudioBeam(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioBeam AudioBeam
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrame_get_AudioBeam(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeam>(objectPointer, n => new Windows.Kinect.AudioBeam(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrame_get_AudioSource(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioSource AudioSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrame_get_AudioSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioSource>(objectPointer, n => new Windows.Kinect.AudioSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamFrame_get_Duration(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan Duration
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrame_get_Duration(_pNative));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamFrame_get_RelativeTimeStart(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTimeStart
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrame_get_RelativeTimeStart(_pNative));
}
}
// Public Methods
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ff93fd69396b944ea1e0d067cf5b091
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,75 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrameArrivedEventArgs
//
public sealed partial class AudioBeamFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~AudioBeamFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrameArrivedEventArgs>(_pNative);
Windows_Kinect_AudioBeamFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioBeamFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrameReference>(objectPointer, n => new Windows.Kinect.AudioBeamFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb78a9668fb2c694881a216e349cb1e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,71 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrameList
//
public sealed partial class AudioBeamFrameList : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrameList(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrameList_AddRefObject(ref _pNative);
}
~AudioBeamFrameList()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameList_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameList_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrameList>(_pNative);
if (disposing)
{
Windows_Kinect_AudioBeamFrameList_Dispose(_pNative);
}
Windows_Kinect_AudioBeamFrameList_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameList_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe7ef6722da9a6d42b589d3f8b35b6f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,309 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrameReader
//
public sealed partial class AudioBeamFrameReader : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrameReader(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrameReader_AddRefObject(ref _pNative);
}
~AudioBeamFrameReader()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReader_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReader_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrameReader>(_pNative);
if (disposing)
{
Windows_Kinect_AudioBeamFrameReader_Dispose(_pNative);
}
Windows_Kinect_AudioBeamFrameReader_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrameReader_get_AudioSource(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioSource AudioSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReader");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrameReader_get_AudioSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioSource>(objectPointer, n => new Windows.Kinect.AudioSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern bool Windows_Kinect_AudioBeamFrameReader_get_IsPaused(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReader_put_IsPaused(RootSystem.IntPtr pNative, bool isPaused);
public bool IsPaused
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReader");
}
return Windows_Kinect_AudioBeamFrameReader_get_IsPaused(_pNative);
}
set
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReader");
}
Windows_Kinect_AudioBeamFrameReader_put_IsPaused(_pNative, value);
Helper.ExceptionHelper.CheckLastError();
}
}
// Events
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.AudioBeamFrameArrivedEventArgs>>> Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.AudioBeamFrameArrivedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate))]
private static void Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Kinect.AudioBeamFrameArrivedEventArgs>> callbackList = null;
Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<AudioBeamFrameReader>(pNative);
var args = new Windows.Kinect.AudioBeamFrameArrivedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReader_add_FrameArrived(RootSystem.IntPtr pNative, _Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Kinect.AudioBeamFrameArrivedEventArgs> FrameArrived
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate(Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handler);
_Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_AudioBeamFrameReader_add_FrameArrived(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_AudioBeamFrameReader_add_FrameArrived(_pNative, Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handler, true);
_Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handle.Free();
}
}
}
}
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Data_PropertyChangedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Data_PropertyChangedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>> Windows_Data_PropertyChangedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Data_PropertyChangedEventArgs_Delegate))]
private static void Windows_Data_PropertyChangedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>> callbackList = null;
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<AudioBeamFrameReader>(pNative);
var args = new Windows.Data.PropertyChangedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReader_add_PropertyChanged(RootSystem.IntPtr pNative, _Windows_Data_PropertyChangedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs> PropertyChanged
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Data_PropertyChangedEventArgs_Delegate(Windows_Data_PropertyChangedEventArgs_Delegate_Handler);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_AudioBeamFrameReader_add_PropertyChanged(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_AudioBeamFrameReader_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamFrameReader_AcquireLatestBeamFrames_Length(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamFrameReader_AcquireLatestBeamFrames(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBeamFrame> AcquireLatestBeamFrames()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReader");
}
int outCollectionSize = Windows_Kinect_AudioBeamFrameReader_AcquireLatestBeamFrames_Length(_pNative);
var outCollection = new RootSystem.IntPtr[outCollectionSize];
var managedCollection = new Windows.Kinect.AudioBeamFrame[outCollectionSize];
outCollectionSize = Windows_Kinect_AudioBeamFrameReader_AcquireLatestBeamFrames(_pNative, outCollection, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
if(outCollection[i] == RootSystem.IntPtr.Zero)
{
continue;
}
var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrame>(outCollection[i], n => new Windows.Kinect.AudioBeamFrame(n));
managedCollection[i] = obj;
}
return managedCollection;
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReader_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
{
Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_AudioBeamFrameReader_add_FrameArrived(_pNative, Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handler, true);
}
_Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handle.Free();
}
}
}
{
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_AudioBeamFrameReader_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
}
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: df51c172437a76942a0ec4a4f1438a8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,101 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrameReference
//
public sealed partial class AudioBeamFrameReference : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrameReference(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrameReference_AddRefObject(ref _pNative);
}
~AudioBeamFrameReference()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReference_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrameReference>(_pNative);
Windows_Kinect_AudioBeamFrameReference_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBeamFrame> AcquireBeamFrames()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference");
}
int outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(_pNative);
var outCollection = new RootSystem.IntPtr[outCollectionSize];
var managedCollection = new Windows.Kinect.AudioBeamFrame[outCollectionSize];
outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(_pNative, outCollection, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
if(outCollection[i] == RootSystem.IntPtr.Zero)
{
continue;
}
var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrame>(outCollection[i], n => new Windows.Kinect.AudioBeamFrame(n));
managedCollection[i] = obj;
}
return managedCollection;
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0fe91384e0a914a4985b0cc2f1026a72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamMode
//
public enum AudioBeamMode : int
{
Automatic =0,
Manual =1,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f287bc065b7e7a4faa7cf96c175eabb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,212 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamSubFrame
//
public sealed partial class AudioBeamSubFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamSubFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref _pNative);
}
~AudioBeamSubFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamSubFrame>(_pNative);
if (disposing)
{
Windows_Kinect_AudioBeamSubFrame_Dispose(_pNative);
}
Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.AudioBeamMode Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioBeamMode AudioBeamMode
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBodyCorrelation> AudioBodyCorrelations
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
int outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(_pNative);
var outCollection = new RootSystem.IntPtr[outCollectionSize];
var managedCollection = new Windows.Kinect.AudioBodyCorrelation[outCollectionSize];
outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(_pNative, outCollection, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
if(outCollection[i] == RootSystem.IntPtr.Zero)
{
continue;
}
var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBodyCorrelation>(outCollection[i], n => new Windows.Kinect.AudioBodyCorrelation(n));
managedCollection[i] = obj;
}
return managedCollection;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(RootSystem.IntPtr pNative);
public float BeamAngle
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(RootSystem.IntPtr pNative);
public float BeamAngleConfidence
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamSubFrame_get_Duration(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan Duration
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_Duration(_pNative));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern uint Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(RootSystem.IntPtr pNative);
public uint FrameLengthInBytes
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize);
public void CopyFrameDataToArray(byte[] frameData)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e3bf3859145801247a7f6d4dcd90b2be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,68 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBodyCorrelation
//
public sealed partial class AudioBodyCorrelation : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBodyCorrelation(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBodyCorrelation_AddRefObject(ref _pNative);
}
~AudioBodyCorrelation()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBodyCorrelation_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBodyCorrelation_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBodyCorrelation>(_pNative);
Windows_Kinect_AudioBodyCorrelation_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern ulong Windows_Kinect_AudioBodyCorrelation_get_BodyTrackingId(RootSystem.IntPtr pNative);
public ulong BodyTrackingId
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBodyCorrelation");
}
return Windows_Kinect_AudioBodyCorrelation_get_BodyTrackingId(_pNative);
}
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f12e3715b57390a47aeecc0046c6d6ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,361 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioSource
//
public sealed partial class AudioSource : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioSource(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioSource_AddRefObject(ref _pNative);
}
~AudioSource()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioSource_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioSource_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioSource>(_pNative);
Windows_Kinect_AudioSource_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioSource_get_AudioBeams(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioSource_get_AudioBeams_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBeam> AudioBeams
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
int outCollectionSize = Windows_Kinect_AudioSource_get_AudioBeams_Length(_pNative);
var outCollection = new RootSystem.IntPtr[outCollectionSize];
var managedCollection = new Windows.Kinect.AudioBeam[outCollectionSize];
outCollectionSize = Windows_Kinect_AudioSource_get_AudioBeams(_pNative, outCollection, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
if(outCollection[i] == RootSystem.IntPtr.Zero)
{
continue;
}
var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeam>(outCollection[i], n => new Windows.Kinect.AudioBeam(n));
managedCollection[i] = obj;
}
return managedCollection;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern bool Windows_Kinect_AudioSource_get_IsActive(RootSystem.IntPtr pNative);
public bool IsActive
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
return Windows_Kinect_AudioSource_get_IsActive(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioSource_get_KinectSensor(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectSensor KinectSensor
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioSource_get_KinectSensor(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectSensor>(objectPointer, n => new Windows.Kinect.KinectSensor(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern uint Windows_Kinect_AudioSource_get_MaxSubFrameCount(RootSystem.IntPtr pNative);
public uint MaxSubFrameCount
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
return Windows_Kinect_AudioSource_get_MaxSubFrameCount(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioSource_get_SubFrameDuration(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan SubFrameDuration
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioSource_get_SubFrameDuration(_pNative));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern uint Windows_Kinect_AudioSource_get_SubFrameLengthInBytes(RootSystem.IntPtr pNative);
public uint SubFrameLengthInBytes
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
return Windows_Kinect_AudioSource_get_SubFrameLengthInBytes(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.KinectAudioCalibrationState Windows_Kinect_AudioSource_get_AudioCalibrationState(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectAudioCalibrationState AudioCalibrationState
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
return Windows_Kinect_AudioSource_get_AudioCalibrationState(_pNative);
}
}
// Events
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Kinect_FrameCapturedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs>>> Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Kinect_FrameCapturedEventArgs_Delegate))]
private static void Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs>> callbackList = null;
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<AudioSource>(pNative);
var args = new Windows.Kinect.FrameCapturedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioSource_add_FrameCaptured(RootSystem.IntPtr pNative, _Windows_Kinect_FrameCapturedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs> FrameCaptured
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Kinect_FrameCapturedEventArgs_Delegate(Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler);
_Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_AudioSource_add_FrameCaptured(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_AudioSource_add_FrameCaptured(_pNative, Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler, true);
_Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle.Free();
}
}
}
}
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Data_PropertyChangedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Data_PropertyChangedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>> Windows_Data_PropertyChangedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Data_PropertyChangedEventArgs_Delegate))]
private static void Windows_Data_PropertyChangedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>> callbackList = null;
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<AudioSource>(pNative);
var args = new Windows.Data.PropertyChangedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioSource_add_PropertyChanged(RootSystem.IntPtr pNative, _Windows_Data_PropertyChangedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs> PropertyChanged
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Data_PropertyChangedEventArgs_Delegate(Windows_Data_PropertyChangedEventArgs_Delegate_Handler);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_AudioSource_add_PropertyChanged(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_AudioSource_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioSource_OpenReader(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioBeamFrameReader OpenReader()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioSource");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioSource_OpenReader(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrameReader>(objectPointer, n => new Windows.Kinect.AudioBeamFrameReader(n));
}
private void __EventCleanup()
{
{
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_AudioSource_add_FrameCaptured(_pNative, Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler, true);
}
_Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle.Free();
}
}
}
{
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_AudioSource_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
}
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cb60632e999b8d44cb5cfd848e264abf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,355 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.Body
//
public sealed partial class Body : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal Body(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_Body_AddRefObject(ref _pNative);
}
~Body()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_Body_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_Body_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<Body>(_pNative);
Windows_Kinect_Body_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Activities(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.Activity[] outKeys, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.DetectionResult[] outValues, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Activities_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.Dictionary<Windows.Kinect.Activity, Windows.Kinect.DetectionResult> Activities
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
int outCollectionSize = Windows_Kinect_Body_get_Activities_Length(_pNative);
var outKeys = new Windows.Kinect.Activity[outCollectionSize];
var outValues = new Windows.Kinect.DetectionResult[outCollectionSize];
var managedDictionary = new RootSystem.Collections.Generic.Dictionary<Windows.Kinect.Activity, Windows.Kinect.DetectionResult>();
outCollectionSize = Windows_Kinect_Body_get_Activities(_pNative, outKeys, outValues, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
managedDictionary.Add(outKeys[i], outValues[i]);
}
return managedDictionary;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Appearance(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.Appearance[] outKeys, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.DetectionResult[] outValues, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Appearance_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.Dictionary<Windows.Kinect.Appearance, Windows.Kinect.DetectionResult> Appearance
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
int outCollectionSize = Windows_Kinect_Body_get_Appearance_Length(_pNative);
var outKeys = new Windows.Kinect.Appearance[outCollectionSize];
var outValues = new Windows.Kinect.DetectionResult[outCollectionSize];
var managedDictionary = new RootSystem.Collections.Generic.Dictionary<Windows.Kinect.Appearance, Windows.Kinect.DetectionResult>();
outCollectionSize = Windows_Kinect_Body_get_Appearance(_pNative, outKeys, outValues, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
managedDictionary.Add(outKeys[i], outValues[i]);
}
return managedDictionary;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.FrameEdges Windows_Kinect_Body_get_ClippedEdges(RootSystem.IntPtr pNative);
public Windows.Kinect.FrameEdges ClippedEdges
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_ClippedEdges(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.DetectionResult Windows_Kinect_Body_get_Engaged(RootSystem.IntPtr pNative);
public Windows.Kinect.DetectionResult Engaged
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_Engaged(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Expressions(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.Expression[] outKeys, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.DetectionResult[] outValues, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Expressions_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.Dictionary<Windows.Kinect.Expression, Windows.Kinect.DetectionResult> Expressions
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
int outCollectionSize = Windows_Kinect_Body_get_Expressions_Length(_pNative);
var outKeys = new Windows.Kinect.Expression[outCollectionSize];
var outValues = new Windows.Kinect.DetectionResult[outCollectionSize];
var managedDictionary = new RootSystem.Collections.Generic.Dictionary<Windows.Kinect.Expression, Windows.Kinect.DetectionResult>();
outCollectionSize = Windows_Kinect_Body_get_Expressions(_pNative, outKeys, outValues, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
managedDictionary.Add(outKeys[i], outValues[i]);
}
return managedDictionary;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.TrackingConfidence Windows_Kinect_Body_get_HandLeftConfidence(RootSystem.IntPtr pNative);
public Windows.Kinect.TrackingConfidence HandLeftConfidence
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_HandLeftConfidence(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.HandState Windows_Kinect_Body_get_HandLeftState(RootSystem.IntPtr pNative);
public Windows.Kinect.HandState HandLeftState
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_HandLeftState(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.TrackingConfidence Windows_Kinect_Body_get_HandRightConfidence(RootSystem.IntPtr pNative);
public Windows.Kinect.TrackingConfidence HandRightConfidence
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_HandRightConfidence(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.HandState Windows_Kinect_Body_get_HandRightState(RootSystem.IntPtr pNative);
public Windows.Kinect.HandState HandRightState
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_HandRightState(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern bool Windows_Kinect_Body_get_IsRestricted(RootSystem.IntPtr pNative);
public bool IsRestricted
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_IsRestricted(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern bool Windows_Kinect_Body_get_IsTracked(RootSystem.IntPtr pNative);
public bool IsTracked
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_IsTracked(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_JointOrientations(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.JointType[] outKeys, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.JointOrientation[] outValues, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_JointOrientations_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.Dictionary<Windows.Kinect.JointType, Windows.Kinect.JointOrientation> JointOrientations
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
int outCollectionSize = Windows_Kinect_Body_get_JointOrientations_Length(_pNative);
var outKeys = new Windows.Kinect.JointType[outCollectionSize];
var outValues = new Windows.Kinect.JointOrientation[outCollectionSize];
var managedDictionary = new RootSystem.Collections.Generic.Dictionary<Windows.Kinect.JointType, Windows.Kinect.JointOrientation>();
outCollectionSize = Windows_Kinect_Body_get_JointOrientations(_pNative, outKeys, outValues, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
managedDictionary.Add(outKeys[i], outValues[i]);
}
return managedDictionary;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Joints(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.JointType[] outKeys, [RootSystem.Runtime.InteropServices.Out] Windows.Kinect.Joint[] outValues, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_Joints_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.Dictionary<Windows.Kinect.JointType, Windows.Kinect.Joint> Joints
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
int outCollectionSize = Windows_Kinect_Body_get_Joints_Length(_pNative);
var outKeys = new Windows.Kinect.JointType[outCollectionSize];
var outValues = new Windows.Kinect.Joint[outCollectionSize];
var managedDictionary = new RootSystem.Collections.Generic.Dictionary<Windows.Kinect.JointType, Windows.Kinect.Joint>();
outCollectionSize = Windows_Kinect_Body_get_Joints(_pNative, outKeys, outValues, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
managedDictionary.Add(outKeys[i], outValues[i]);
}
return managedDictionary;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.TrackingState Windows_Kinect_Body_get_LeanTrackingState(RootSystem.IntPtr pNative);
public Windows.Kinect.TrackingState LeanTrackingState
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_LeanTrackingState(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern ulong Windows_Kinect_Body_get_TrackingId(RootSystem.IntPtr pNative);
public ulong TrackingId
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("Body");
}
return Windows_Kinect_Body_get_TrackingId(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_Body_get_JointCount();
public static int JointCount
{
get
{
return Windows_Kinect_Body_get_JointCount();
}
}
// Public Methods
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2de6a71b01a15e740a2fb488ab8a1b07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,144 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrame
//
public sealed partial class BodyFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrame_AddRefObject(ref _pNative);
}
~BodyFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrame>(_pNative);
if (disposing)
{
Windows_Kinect_BodyFrame_Dispose(_pNative);
}
Windows_Kinect_BodyFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_BodyFrame_get_BodyCount(RootSystem.IntPtr pNative);
public int BodyCount
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
return Windows_Kinect_BodyFrame_get_BodyCount(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrame_get_BodyFrameSource(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrameSource BodyFrameSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrame_get_BodyFrameSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameSource>(objectPointer, n => new Windows.Kinect.BodyFrameSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrame_get_FloorClipPlane(RootSystem.IntPtr pNative);
public Windows.Kinect.Vector4 FloorClipPlane
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
var objectPointer = Windows_Kinect_BodyFrame_get_FloorClipPlane(_pNative);
Helper.ExceptionHelper.CheckLastError();
var obj = (Windows.Kinect.Vector4)RootSystem.Runtime.InteropServices.Marshal.PtrToStructure(objectPointer, typeof(Windows.Kinect.Vector4));
Windows.Kinect.KinectUnityAddinUtils.FreeMemory(objectPointer);
return obj;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_BodyFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 19d23b65a55461b4c8fcfc815e9a8be5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,75 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrameArrivedEventArgs
//
public sealed partial class BodyFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~BodyFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrameArrivedEventArgs>(_pNative);
Windows_Kinect_BodyFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameReference>(objectPointer, n => new Windows.Kinect.BodyFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 676ce9850965f6d4fad5e20fa2a8da30
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,297 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrameReader
//
public sealed partial class BodyFrameReader : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrameReader(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrameReader_AddRefObject(ref _pNative);
}
~BodyFrameReader()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReader_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReader_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrameReader>(_pNative);
if (disposing)
{
Windows_Kinect_BodyFrameReader_Dispose(_pNative);
}
Windows_Kinect_BodyFrameReader_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameReader_get_BodyFrameSource(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrameSource BodyFrameSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReader");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameReader_get_BodyFrameSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameSource>(objectPointer, n => new Windows.Kinect.BodyFrameSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern bool Windows_Kinect_BodyFrameReader_get_IsPaused(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReader_put_IsPaused(RootSystem.IntPtr pNative, bool isPaused);
public bool IsPaused
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReader");
}
return Windows_Kinect_BodyFrameReader_get_IsPaused(_pNative);
}
set
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReader");
}
Windows_Kinect_BodyFrameReader_put_IsPaused(_pNative, value);
Helper.ExceptionHelper.CheckLastError();
}
}
// Events
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Kinect_BodyFrameArrivedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.BodyFrameArrivedEventArgs>>> Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.BodyFrameArrivedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Kinect_BodyFrameArrivedEventArgs_Delegate))]
private static void Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Kinect.BodyFrameArrivedEventArgs>> callbackList = null;
Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<BodyFrameReader>(pNative);
var args = new Windows.Kinect.BodyFrameArrivedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReader_add_FrameArrived(RootSystem.IntPtr pNative, _Windows_Kinect_BodyFrameArrivedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Kinect.BodyFrameArrivedEventArgs> FrameArrived
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Kinect_BodyFrameArrivedEventArgs_Delegate(Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handler);
_Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_BodyFrameReader_add_FrameArrived(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_BodyFrameReader_add_FrameArrived(_pNative, Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handler, true);
_Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handle.Free();
}
}
}
}
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Data_PropertyChangedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Data_PropertyChangedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>> Windows_Data_PropertyChangedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Data_PropertyChangedEventArgs_Delegate))]
private static void Windows_Data_PropertyChangedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>> callbackList = null;
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<BodyFrameReader>(pNative);
var args = new Windows.Data.PropertyChangedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReader_add_PropertyChanged(RootSystem.IntPtr pNative, _Windows_Data_PropertyChangedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs> PropertyChanged
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Data_PropertyChangedEventArgs_Delegate(Windows_Data_PropertyChangedEventArgs_Delegate_Handler);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_BodyFrameReader_add_PropertyChanged(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_BodyFrameReader_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameReader_AcquireLatestFrame(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrame AcquireLatestFrame()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReader");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameReader_AcquireLatestFrame(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrame>(objectPointer, n => new Windows.Kinect.BodyFrame(n));
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReader_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
{
Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_BodyFrameReader_add_FrameArrived(_pNative, Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handler, true);
}
_Windows_Kinect_BodyFrameArrivedEventArgs_Delegate_Handle.Free();
}
}
}
{
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_BodyFrameReader_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
}
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3af2f300d248d614eb0f026c16be6e51
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,89 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrameReference
//
public sealed partial class BodyFrameReference : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrameReference(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrameReference_AddRefObject(ref _pNative);
}
~BodyFrameReference()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReference_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrameReference>(_pNative);
Windows_Kinect_BodyFrameReference_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_BodyFrameReference_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReference");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyFrameReference_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameReference_AcquireFrame(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrame AcquireFrame()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReference");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameReference_AcquireFrame(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrame>(objectPointer, n => new Windows.Kinect.BodyFrame(n));
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 083a7736def5ad3429a51cc96a6c4564
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,308 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrameSource
//
public sealed partial class BodyFrameSource : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrameSource(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrameSource_AddRefObject(ref _pNative);
}
~BodyFrameSource()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameSource_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameSource_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrameSource>(_pNative);
Windows_Kinect_BodyFrameSource_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_BodyFrameSource_get_BodyCount(RootSystem.IntPtr pNative);
public int BodyCount
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameSource");
}
return Windows_Kinect_BodyFrameSource_get_BodyCount(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern bool Windows_Kinect_BodyFrameSource_get_IsActive(RootSystem.IntPtr pNative);
public bool IsActive
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameSource");
}
return Windows_Kinect_BodyFrameSource_get_IsActive(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameSource_get_KinectSensor(RootSystem.IntPtr pNative);
public Windows.Kinect.KinectSensor KinectSensor
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameSource");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameSource_get_KinectSensor(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.KinectSensor>(objectPointer, n => new Windows.Kinect.KinectSensor(n));
}
}
// Events
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Kinect_FrameCapturedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs>>> Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Kinect_FrameCapturedEventArgs_Delegate))]
private static void Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs>> callbackList = null;
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<BodyFrameSource>(pNative);
var args = new Windows.Kinect.FrameCapturedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameSource_add_FrameCaptured(RootSystem.IntPtr pNative, _Windows_Kinect_FrameCapturedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Kinect.FrameCapturedEventArgs> FrameCaptured
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Kinect_FrameCapturedEventArgs_Delegate(Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler);
_Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_BodyFrameSource_add_FrameCaptured(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_BodyFrameSource_add_FrameCaptured(_pNative, Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler, true);
_Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle.Free();
}
}
}
}
private static RootSystem.Runtime.InteropServices.GCHandle _Windows_Data_PropertyChangedEventArgs_Delegate_Handle;
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private delegate void _Windows_Data_PropertyChangedEventArgs_Delegate(RootSystem.IntPtr args, RootSystem.IntPtr pNative);
private static Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>> Windows_Data_PropertyChangedEventArgs_Delegate_callbacks = new Helper.CollectionMap<RootSystem.IntPtr, List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>>>();
[AOT.MonoPInvokeCallbackAttribute(typeof(_Windows_Data_PropertyChangedEventArgs_Delegate))]
private static void Windows_Data_PropertyChangedEventArgs_Delegate_Handler(RootSystem.IntPtr result, RootSystem.IntPtr pNative)
{
List<RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs>> callbackList = null;
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryGetValue(pNative, out callbackList);
lock(callbackList)
{
var objThis = Helper.NativeObjectCache.GetObject<BodyFrameSource>(pNative);
var args = new Windows.Data.PropertyChangedEventArgs(result);
foreach(var func in callbackList)
{
Helper.EventPump.Instance.Enqueue(() => { try { func(objThis, args); } catch { } });
}
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameSource_add_PropertyChanged(RootSystem.IntPtr pNative, _Windows_Data_PropertyChangedEventArgs_Delegate eventCallback, bool unsubscribe);
public event RootSystem.EventHandler<Windows.Data.PropertyChangedEventArgs> PropertyChanged
{
add
{
Helper.EventPump.EnsureInitialized();
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Add(value);
if(callbackList.Count == 1)
{
var del = new _Windows_Data_PropertyChangedEventArgs_Delegate(Windows_Data_PropertyChangedEventArgs_Delegate_Handler);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle = RootSystem.Runtime.InteropServices.GCHandle.Alloc(del);
Windows_Kinect_BodyFrameSource_add_PropertyChanged(_pNative, del, false);
}
}
}
remove
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
callbackList.Remove(value);
if(callbackList.Count == 0)
{
Windows_Kinect_BodyFrameSource_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameSource_OpenReader(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrameReader OpenReader()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameSource");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameSource_OpenReader(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameReader>(objectPointer, n => new Windows.Kinect.BodyFrameReader(n));
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameSource_OverrideHandTracking(RootSystem.IntPtr pNative, ulong trackingId);
public void OverrideHandTracking(ulong trackingId)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameSource");
}
Windows_Kinect_BodyFrameSource_OverrideHandTracking(_pNative, trackingId);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameSource_OverrideHandTracking_1(RootSystem.IntPtr pNative, ulong oldTrackingId, ulong newTrackingId);
public void OverrideHandTracking(ulong oldTrackingId, ulong newTrackingId)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameSource");
}
Windows_Kinect_BodyFrameSource_OverrideHandTracking_1(_pNative, oldTrackingId, newTrackingId);
Helper.ExceptionHelper.CheckLastError();
}
private void __EventCleanup()
{
{
Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Kinect_FrameCapturedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_BodyFrameSource_add_FrameCaptured(_pNative, Windows_Kinect_FrameCapturedEventArgs_Delegate_Handler, true);
}
_Windows_Kinect_FrameCapturedEventArgs_Delegate_Handle.Free();
}
}
}
{
Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(_pNative);
var callbackList = Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[_pNative];
lock (callbackList)
{
if (callbackList.Count > 0)
{
callbackList.Clear();
if (_pNative != RootSystem.IntPtr.Zero)
{
Windows_Kinect_BodyFrameSource_add_PropertyChanged(_pNative, Windows_Data_PropertyChangedEventArgs_Delegate_Handler, true);
}
_Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
}
}
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3679e372811a218438e365b6da52873c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,147 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyIndexFrame
//
public sealed partial class BodyIndexFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyIndexFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyIndexFrame_AddRefObject(ref _pNative);
}
~BodyIndexFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyIndexFrame>(_pNative);
if (disposing)
{
Windows_Kinect_BodyIndexFrame_Dispose(_pNative);
}
Windows_Kinect_BodyIndexFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrame_get_BodyIndexFrameSource(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyIndexFrameSource BodyIndexFrameSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrame_get_BodyIndexFrameSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrameSource>(objectPointer, n => new Windows.Kinect.BodyIndexFrameSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrame_get_FrameDescription(RootSystem.IntPtr pNative);
public Windows.Kinect.FrameDescription FrameDescription
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrame_get_FrameDescription(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_BodyIndexFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyIndexFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize);
public void CopyFrameDataToArray(byte[] frameData)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_BodyIndexFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 31029a9c200fe984790d50a6d2875e32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,75 @@
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyIndexFrameArrivedEventArgs
//
public sealed partial class BodyIndexFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyIndexFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyIndexFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~BodyIndexFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyIndexFrameArrivedEventArgs>(_pNative);
Windows_Kinect_BodyIndexFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyIndexFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrameReference>(objectPointer, n => new Windows.Kinect.BodyIndexFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 673826e3a38138946b030da95a1d0f95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show more