t1 / TFDContents / Assets / Standard Assets / KinectFaceSpecialCases.cs @ 10
이력 | 보기 | 이력해설 | 다운로드 (19.1 KB)
| 1 |
#if !(UNITY_WSA_10_0 && NETFX_CORE) |
|---|---|
| 2 |
using RootSystem = System; |
| 3 |
using System; |
| 4 |
using System.Collections.Generic; |
| 5 |
using System.Runtime.InteropServices; |
| 6 |
|
| 7 |
namespace Microsoft.Kinect.Face |
| 8 |
{
|
| 9 |
// |
| 10 |
// Microsoft.Kinect.Face.Point |
| 11 |
// |
| 12 |
[RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)] |
| 13 |
public struct Point |
| 14 |
{
|
| 15 |
public float X { get; set; }
|
| 16 |
public float Y { get; set; }
|
| 17 |
|
| 18 |
public override int GetHashCode() |
| 19 |
{
|
| 20 |
return X.GetHashCode() ^ Y.GetHashCode(); |
| 21 |
} |
| 22 |
|
| 23 |
public override bool Equals(object obj) |
| 24 |
{
|
| 25 |
if (!(obj is Point)) |
| 26 |
{
|
| 27 |
return false; |
| 28 |
} |
| 29 |
|
| 30 |
return this.Equals((Point)obj); |
| 31 |
} |
| 32 |
|
| 33 |
public bool Equals(Point obj) |
| 34 |
{
|
| 35 |
return X.Equals(obj.X) && Y.Equals(obj.Y); |
| 36 |
} |
| 37 |
|
| 38 |
public static bool operator ==(Point a, Point b) |
| 39 |
{
|
| 40 |
return a.Equals(b); |
| 41 |
} |
| 42 |
|
| 43 |
public static bool operator !=(Point a, Point b) |
| 44 |
{
|
| 45 |
return !(a.Equals(b)); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
// |
| 50 |
// Microsoft.Kinect.Face.Color |
| 51 |
// |
| 52 |
[RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)] |
| 53 |
public struct Color |
| 54 |
{
|
| 55 |
public byte A { get; set; }
|
| 56 |
public byte R { get; set; }
|
| 57 |
public byte G { get; set; }
|
| 58 |
public byte B { get; set; }
|
| 59 |
|
| 60 |
public override int GetHashCode() |
| 61 |
{
|
| 62 |
return A.GetHashCode() ^ R.GetHashCode() ^ G.GetHashCode() ^ B.GetHashCode(); |
| 63 |
} |
| 64 |
|
| 65 |
public override bool Equals(object obj) |
| 66 |
{
|
| 67 |
if (!(obj is Color)) |
| 68 |
{
|
| 69 |
return false; |
| 70 |
} |
| 71 |
|
| 72 |
return this.Equals((Color)obj); |
| 73 |
} |
| 74 |
|
| 75 |
public bool Equals(Color obj) |
| 76 |
{
|
| 77 |
return A.Equals(obj.A) && R.Equals(obj.R) && G.Equals(obj.G) && B.Equals(obj.B); |
| 78 |
} |
| 79 |
|
| 80 |
public static bool operator ==(Color a, Color b) |
| 81 |
{
|
| 82 |
return a.Equals(b); |
| 83 |
} |
| 84 |
|
| 85 |
public static bool operator !=(Color a, Color b) |
| 86 |
{
|
| 87 |
return !(a.Equals(b)); |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
// |
| 92 |
// Microsoft.Kinect.Face.FaceModel |
| 93 |
// |
| 94 |
public sealed partial class FaceModel |
| 95 |
{
|
| 96 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 97 |
private static extern RootSystem.IntPtr Microsoft_Kinect_Face_FaceModel_ctor(float scale, Microsoft.Kinect.Face.FaceShapeDeformations[] faceShapeDeformationsKeys, float[] faceShapeDeformationsValues, int faceShapeDeformationsSize); |
| 98 |
public static FaceModel Create(float scale, RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FaceShapeDeformations, float> faceShapeDeformations) |
| 99 |
{
|
| 100 |
int _faceShapeDeformationsKeys_idx=0; |
| 101 |
var _faceShapeDeformationsKeys = new Microsoft.Kinect.Face.FaceShapeDeformations[faceShapeDeformations.Keys.Count]; |
| 102 |
foreach(var key in faceShapeDeformations.Keys) |
| 103 |
{
|
| 104 |
_faceShapeDeformationsKeys[_faceShapeDeformationsKeys_idx] = (Microsoft.Kinect.Face.FaceShapeDeformations)key; |
| 105 |
_faceShapeDeformationsKeys_idx++; |
| 106 |
} |
| 107 |
int _faceShapeDeformationsValues_idx=0; |
| 108 |
var _faceShapeDeformationsValues = new float[faceShapeDeformations.Values.Count]; |
| 109 |
foreach(var value in faceShapeDeformations.Values) |
| 110 |
{
|
| 111 |
_faceShapeDeformationsValues[_faceShapeDeformationsValues_idx] = (float)value; |
| 112 |
_faceShapeDeformationsValues_idx++; |
| 113 |
} |
| 114 |
|
| 115 |
RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_FaceModel_ctor(scale, _faceShapeDeformationsKeys, _faceShapeDeformationsValues, faceShapeDeformations.Count); |
| 116 |
Helper.ExceptionHelper.CheckLastError(); |
| 117 |
if (objectPointer == RootSystem.IntPtr.Zero) |
| 118 |
{
|
| 119 |
return null; |
| 120 |
} |
| 121 |
|
| 122 |
return Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.FaceModel>( |
| 123 |
objectPointer, n => new Microsoft.Kinect.Face.FaceModel(n)); |
| 124 |
} |
| 125 |
|
| 126 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 127 |
private static extern RootSystem.IntPtr Microsoft_Kinect_Face_FaceModel_ctor1(); |
| 128 |
public static FaceModel Create() |
| 129 |
{
|
| 130 |
RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_FaceModel_ctor1(); |
| 131 |
Helper.ExceptionHelper.CheckLastError(); |
| 132 |
if (objectPointer == RootSystem.IntPtr.Zero) |
| 133 |
{
|
| 134 |
return null; |
| 135 |
} |
| 136 |
|
| 137 |
return Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.FaceModel>( |
| 138 |
objectPointer, n => new Microsoft.Kinect.Face.FaceModel(n)); |
| 139 |
} |
| 140 |
|
| 141 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 142 |
private static extern RootSystem.IntPtr Microsoft_Kinect_Face_FaceModel_get_HairColor(RootSystem.IntPtr pNative); |
| 143 |
public Microsoft.Kinect.Face.Color HairColor |
| 144 |
{
|
| 145 |
get |
| 146 |
{
|
| 147 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 148 |
{
|
| 149 |
throw new RootSystem.ObjectDisposedException("FaceModel");
|
| 150 |
} |
| 151 |
|
| 152 |
var objectPointer = Microsoft_Kinect_Face_FaceModel_get_HairColor(_pNative); |
| 153 |
Helper.ExceptionHelper.CheckLastError(); |
| 154 |
var obj = (Microsoft.Kinect.Face.Color)RootSystem.Runtime.InteropServices.Marshal.PtrToStructure(objectPointer, typeof(Microsoft.Kinect.Face.Color)); |
| 155 |
Microsoft.Kinect.Face.KinectFaceUnityAddinUtils.FreeMemory(objectPointer); |
| 156 |
return obj; |
| 157 |
} |
| 158 |
} |
| 159 |
|
| 160 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 161 |
private static extern RootSystem.IntPtr Microsoft_Kinect_Face_FaceModel_get_SkinColor(RootSystem.IntPtr pNative); |
| 162 |
public Microsoft.Kinect.Face.Color SkinColor |
| 163 |
{
|
| 164 |
get |
| 165 |
{
|
| 166 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 167 |
{
|
| 168 |
throw new RootSystem.ObjectDisposedException("FaceModel");
|
| 169 |
} |
| 170 |
|
| 171 |
var objectPointer = Microsoft_Kinect_Face_FaceModel_get_SkinColor(_pNative); |
| 172 |
Helper.ExceptionHelper.CheckLastError(); |
| 173 |
var obj = (Microsoft.Kinect.Face.Color)RootSystem.Runtime.InteropServices.Marshal.PtrToStructure(objectPointer, typeof(Microsoft.Kinect.Face.Color)); |
| 174 |
Microsoft.Kinect.Face.KinectFaceUnityAddinUtils.FreeMemory(objectPointer); |
| 175 |
return obj; |
| 176 |
} |
| 177 |
} |
| 178 |
} |
| 179 |
|
| 180 |
// |
| 181 |
// Microsoft.Kinect.Face.FaceFrameResult |
| 182 |
// |
| 183 |
public sealed partial class FaceFrameResult |
| 184 |
{
|
| 185 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 186 |
private static extern int Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInColorSpace(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] Microsoft.Kinect.Face.FacePointType[] outKeys, [RootSystem.Runtime.InteropServices.Out] Microsoft.Kinect.Face.Point[] outValues, int outCollectionSize); |
| 187 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 188 |
private static extern int Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInColorSpace_Length(RootSystem.IntPtr pNative); |
| 189 |
public RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FacePointType, Microsoft.Kinect.Face.Point> FacePointsInColorSpace |
| 190 |
{
|
| 191 |
get |
| 192 |
{
|
| 193 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 194 |
{
|
| 195 |
throw new RootSystem.ObjectDisposedException("FaceFrameResult");
|
| 196 |
} |
| 197 |
|
| 198 |
int outCollectionSize = Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInColorSpace_Length(_pNative); |
| 199 |
var outKeys = new Microsoft.Kinect.Face.FacePointType[outCollectionSize]; |
| 200 |
var outValues = new Microsoft.Kinect.Face.Point[outCollectionSize]; |
| 201 |
var managedDictionary = new RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FacePointType, Microsoft.Kinect.Face.Point>(); |
| 202 |
|
| 203 |
outCollectionSize = Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInColorSpace(_pNative, outKeys, outValues, outCollectionSize); |
| 204 |
Helper.ExceptionHelper.CheckLastError(); |
| 205 |
for(int i=0;i<outCollectionSize;i++) |
| 206 |
{
|
| 207 |
managedDictionary.Add(outKeys[i], outValues[i]); |
| 208 |
} |
| 209 |
return managedDictionary; |
| 210 |
} |
| 211 |
} |
| 212 |
|
| 213 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 214 |
private static extern int Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInInfraredSpace(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] Microsoft.Kinect.Face.FacePointType[] outKeys, [RootSystem.Runtime.InteropServices.Out] Microsoft.Kinect.Face.Point[] outValues, int outCollectionSize); |
| 215 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 216 |
private static extern int Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInInfraredSpace_Length(RootSystem.IntPtr pNative); |
| 217 |
public RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FacePointType, Microsoft.Kinect.Face.Point> FacePointsInInfraredSpace |
| 218 |
{
|
| 219 |
get |
| 220 |
{
|
| 221 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 222 |
{
|
| 223 |
throw new RootSystem.ObjectDisposedException("FaceFrameResult");
|
| 224 |
} |
| 225 |
|
| 226 |
int outCollectionSize = Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInInfraredSpace_Length(_pNative); |
| 227 |
var outKeys = new Microsoft.Kinect.Face.FacePointType[outCollectionSize]; |
| 228 |
var outValues = new Microsoft.Kinect.Face.Point[outCollectionSize]; |
| 229 |
var managedDictionary = new RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FacePointType, Microsoft.Kinect.Face.Point>(); |
| 230 |
|
| 231 |
outCollectionSize = Microsoft_Kinect_Face_FaceFrameResult_get_FacePointsInInfraredSpace(_pNative, outKeys, outValues, outCollectionSize); |
| 232 |
Helper.ExceptionHelper.CheckLastError(); |
| 233 |
for(int i=0;i<outCollectionSize;i++) |
| 234 |
{
|
| 235 |
managedDictionary.Add(outKeys[i], outValues[i]); |
| 236 |
} |
| 237 |
return managedDictionary; |
| 238 |
} |
| 239 |
} |
| 240 |
} |
| 241 |
|
| 242 |
// |
| 243 |
// Microsoft.Kinect.Face.FaceAlignment |
| 244 |
// |
| 245 |
public sealed partial class FaceAlignment |
| 246 |
{
|
| 247 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 248 |
private static extern RootSystem.IntPtr Microsoft_Kinect_Face_FaceAlignment_ctor(); |
| 249 |
public static FaceAlignment Create() |
| 250 |
{
|
| 251 |
RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_FaceAlignment_ctor(); |
| 252 |
Helper.ExceptionHelper.CheckLastError(); |
| 253 |
if (objectPointer == RootSystem.IntPtr.Zero) |
| 254 |
{
|
| 255 |
return null; |
| 256 |
} |
| 257 |
|
| 258 |
return Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.FaceAlignment>( |
| 259 |
objectPointer, n => new Microsoft.Kinect.Face.FaceAlignment(n)); |
| 260 |
} |
| 261 |
} |
| 262 |
|
| 263 |
// |
| 264 |
// Microsoft.Kinect.Face.FaceFrameSource |
| 265 |
// |
| 266 |
public sealed partial class FaceFrameSource |
| 267 |
{
|
| 268 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 269 |
private static extern RootSystem.IntPtr Microsoft_Kinect_Face_FaceFrameSource_ctor(RootSystem.IntPtr sensor, ulong initialTrackingId, Microsoft.Kinect.Face.FaceFrameFeatures initialFaceFrameFeatures); |
| 270 |
public static FaceFrameSource Create(Windows.Kinect.KinectSensor sensor, ulong initialTrackingId, Microsoft.Kinect.Face.FaceFrameFeatures initialFaceFrameFeatures) |
| 271 |
{
|
| 272 |
RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_FaceFrameSource_ctor(Helper.NativeWrapper.GetNativePtr(sensor), initialTrackingId, initialFaceFrameFeatures); |
| 273 |
Helper.ExceptionHelper.CheckLastError(); |
| 274 |
if (objectPointer == RootSystem.IntPtr.Zero) |
| 275 |
{
|
| 276 |
return null; |
| 277 |
} |
| 278 |
|
| 279 |
return Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.FaceFrameSource>( |
| 280 |
objectPointer, n => new Microsoft.Kinect.Face.FaceFrameSource(n)); |
| 281 |
} |
| 282 |
} |
| 283 |
|
| 284 |
// |
| 285 |
// Microsoft.Kinect.Face.HighDefinitionFaceFrameSource |
| 286 |
// |
| 287 |
public sealed partial class HighDefinitionFaceFrameSource |
| 288 |
{
|
| 289 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
|
| 290 |
private static extern RootSystem.IntPtr Microsoft_Kinect_Face_HighDefinitionFaceFrameSource_ctor(RootSystem.IntPtr sensor); |
| 291 |
public static HighDefinitionFaceFrameSource Create(Windows.Kinect.KinectSensor sensor) |
| 292 |
{
|
| 293 |
RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_HighDefinitionFaceFrameSource_ctor(Helper.NativeWrapper.GetNativePtr(sensor)); |
| 294 |
Helper.ExceptionHelper.CheckLastError(); |
| 295 |
if (objectPointer == RootSystem.IntPtr.Zero) |
| 296 |
{
|
| 297 |
return null; |
| 298 |
} |
| 299 |
|
| 300 |
return Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.HighDefinitionFaceFrameSource>( |
| 301 |
objectPointer, n => new Microsoft.Kinect.Face.HighDefinitionFaceFrameSource(n)); |
| 302 |
} |
| 303 |
} |
| 304 |
|
| 305 |
// |
| 306 |
// Microsoft.Kinect.Face.FaceModelBuilder |
| 307 |
// |
| 308 |
public sealed partial class FaceModelBuilder |
| 309 |
{
|
| 310 |
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] |
| 311 |
private delegate void Microsoft_Kinect_Face_FaceModelData_Delegate_Indexed(RootSystem.IntPtr result, [RootSystem.Runtime.InteropServices.MarshalAs(RootSystem.Runtime.InteropServices.UnmanagedType.LPWStr)] string guid); |
| 312 |
private static Helper.ThreadSafeDictionary<string, RootSystem.Action<Microsoft.Kinect.Face.FaceModelData>> Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks = new Helper.ThreadSafeDictionary<string, RootSystem.Action<Microsoft.Kinect.Face.FaceModelData>>(); |
| 313 |
[AOT.MonoPInvokeCallback(typeof(Microsoft_Kinect_Face_FaceModelData_Delegate_Indexed))] |
| 314 |
private static void Microsoft_Kinect_Face_FaceModelData_Delegate_Success(RootSystem.IntPtr result, string guid) |
| 315 |
{
|
| 316 |
List<Helper.SmartGCHandle> pins; |
| 317 |
if(PinnedObjects.TryGetValue(guid, out pins)) |
| 318 |
{
|
| 319 |
foreach(var pin in pins) |
| 320 |
{
|
| 321 |
pin.Dispose(); |
| 322 |
} |
| 323 |
PinnedObjects.Remove(guid); |
| 324 |
} |
| 325 |
RootSystem.Action<Microsoft.Kinect.Face.FaceModelData> callback = null; |
| 326 |
if(Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks.TryGetValue(guid, out callback)) |
| 327 |
{
|
| 328 |
var faceModelData = Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.FaceModelData>(result, n => new Microsoft.Kinect.Face.FaceModelData(n)); |
| 329 |
Helper.EventPump.Instance.Enqueue(() => callback(faceModelData)); |
| 330 |
} |
| 331 |
ErrorCallbacks.Remove(guid); |
| 332 |
Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks.Remove(guid); |
| 333 |
} |
| 334 |
[RootSystem.Runtime.InteropServices.UnmanagedFunctionPointer(RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] |
| 335 |
private delegate void Error_Delegate_Indexed(int err, [RootSystem.Runtime.InteropServices.MarshalAs(RootSystem.Runtime.InteropServices.UnmanagedType.LPWStr)] string guid); |
| 336 |
private static Helper.ThreadSafeDictionary<string, RootSystem.Action<int>> ErrorCallbacks = new Helper.ThreadSafeDictionary<string, RootSystem.Action<int>>(); |
| 337 |
private static Helper.CollectionMap<string, RootSystem.Collections.Generic.List<Helper.SmartGCHandle>> PinnedObjects = new Helper.CollectionMap<string, RootSystem.Collections.Generic.List<Helper.SmartGCHandle>>(); |
| 338 |
[AOT.MonoPInvokeCallback(typeof(Error_Delegate_Indexed))] |
| 339 |
private static void Error_Delegate_Failure(int err, [RootSystem.Runtime.InteropServices.MarshalAs(RootSystem.Runtime.InteropServices.UnmanagedType.LPWStr)] string guid) |
| 340 |
{
|
| 341 |
RootSystem.Action<int> callback = null; |
| 342 |
if(ErrorCallbacks.TryGetValue(guid, out callback)) |
| 343 |
{
|
| 344 |
Helper.EventPump.Instance.Enqueue(() => callback(err)); |
| 345 |
} |
| 346 |
ErrorCallbacks.Remove(guid); |
| 347 |
Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks.Remove(guid); |
| 348 |
} |
| 349 |
|
| 350 |
private static Microsoft_Kinect_Face_FaceModelData_Delegate_Indexed CollectAsyncSuccessDelegate = Microsoft_Kinect_Face_FaceModelData_Delegate_Success; |
| 351 |
private static Error_Delegate_Indexed CollectAsyncFailureDelegate = Error_Delegate_Failure; |
| 352 |
|
| 353 |
[RootSystem.Runtime.InteropServices.DllImport("KinectFaceUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
| 354 |
private static extern void Microsoft_Kinect_Face_FaceModelBuilder_CollectFaceDataAsync_Indexed(RootSystem.IntPtr pNative, Microsoft_Kinect_Face_FaceModelData_Delegate_Indexed success, Error_Delegate_Indexed failure, [RootSystem.Runtime.InteropServices.MarshalAs(RootSystem.Runtime.InteropServices.UnmanagedType.LPWStr)] string guid); |
| 355 |
public void CollectFaceDataAsync(RootSystem.Action<Microsoft.Kinect.Face.FaceModelData> success, RootSystem.Action<int> failure) |
| 356 |
{
|
| 357 |
if (_pNative == RootSystem.IntPtr.Zero) |
| 358 |
{
|
| 359 |
throw new RootSystem.ObjectDisposedException("FaceModelBuilder");
|
| 360 |
} |
| 361 |
|
| 362 |
RootSystem.Guid g = RootSystem.Guid.NewGuid(); |
| 363 |
if(success != null) |
| 364 |
{
|
| 365 |
Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks.Add(g.ToString(), success); |
| 366 |
} |
| 367 |
if(failure != null) |
| 368 |
{
|
| 369 |
ErrorCallbacks.Add(g.ToString(), failure); |
| 370 |
} |
| 371 |
Microsoft_Kinect_Face_FaceModelBuilder_CollectFaceDataAsync_Indexed(_pNative, CollectAsyncSuccessDelegate, CollectAsyncFailureDelegate, g.ToString()); |
| 372 |
Helper.ExceptionHelper.CheckLastError(); |
| 373 |
} |
| 374 |
} |
| 375 |
} |
| 376 |
#endif |