Skip to content

Commit

Permalink
[ARKit] Update framework to Xcode 12 beta 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel-macaque committed Aug 20, 2020
1 parent 236936c commit ee3777e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 7 deletions.
24 changes: 24 additions & 0 deletions src/ARKit/ARSkeleton.cs
@@ -0,0 +1,24 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

using Foundation;
using ObjCRuntime;

namespace ARKit {
public partial class ARSkeleton {

[iOS (14,0)]
[DllImport (Constants.ARKitLibrary)]
static extern IntPtr /* NSString */ ARSkeletonJointNameForRecognizedPointKey (/* NSString */ IntPtr recognizedPointKey);

[EditorBrowsable (EditorBrowsableState.Advanced)]
[iOS (14,0)]
public static NSString CreateJointName (NSString recognizedPointKey) {
if (recognizedPointKey == null)
throw new ArgumentNullException (nameof (recognizedPointKey));
var newNamePtr = ARSkeletonJointNameForRecognizedPointKey (recognizedPointKey.Handle);
return (newNamePtr == IntPtr.Zero) ? null : new NSString (newNamePtr);
}
}
}
31 changes: 26 additions & 5 deletions src/arkit.cs
Expand Up @@ -196,7 +196,7 @@ public enum ARFrameSemantics : long {
PersonSegmentationWithDepth = (1 << 1) | (1 << 0),
BodyDetection = 1 << 2,
[iOS (14,0)]
SceneDepth = (1 << 3),
SceneDepth = (1 << 4),
}

[iOS (13,0)]
Expand Down Expand Up @@ -475,6 +475,11 @@ interface ARFrame : NSCopying {
[iOS (14, 0)]
[NullAllowed, Export ("sceneDepth", ArgumentSemantic.Strong)]
ARDepthData SceneDepth { get; }

[iOS (14, 0)]
[NullAllowed]
[Export ("smoothedSceneDepth", ArgumentSemantic.Strong)]
ARDepthData SmoothedSceneDepth { get; }
}

[iOS (11,0)]
Expand Down Expand Up @@ -1986,13 +1991,21 @@ interface ARSkeleton3D {
[Protected, Export ("jointLocalTransforms")]
IntPtr RawJointLocalTransforms { get; }

[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("modelTransformForJointName:")]
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
Matrix4 GetModelTransform ([BindAs (typeof (ARSkeletonJointName))] NSString jointName);
Matrix4 GetModelTransform (NSString jointName);

[Wrap ("GetModelTransform (jointName.GetConstant()!)")]
Matrix4 GetModelTransform (ARSkeletonJointName jointName);

[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("localTransformForJointName:")]
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
Matrix4 GetLocalTransform ([BindAs (typeof (ARSkeletonJointName))] NSString jointName);
Matrix4 GetLocalTransform (NSString jointName);

[Wrap ("GetLocalTransform (jointName.GetConstant()!)")]
Matrix4 GetLocalTransform (ARSkeletonJointName jointName);
}

[iOS (13,0)]
Expand All @@ -2004,9 +2017,13 @@ interface ARSkeleton2D {
[Protected, Export ("jointLandmarks")]
IntPtr RawJointLandmarks { get; }

[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("landmarkForJointNamed:")]
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
Vector2 GetLandmarkPoint ([BindAs (typeof (ARSkeletonJointName))] NSString jointName);
Vector2 GetLandmarkPoint (NSString jointName);

[Wrap ("GetLandmarkPoint (jointName.GetConstant()!)")]
Vector2 GetLandmarkPoint (ARSkeletonJointName jointName);
}

[iOS (13,0)]
Expand Down Expand Up @@ -2034,8 +2051,12 @@ interface ARSkeletonDefinition {
[NullAllowed, Export ("neutralBodySkeleton3D")]
ARSkeleton3D NeutralBodySkeleton3D { get; }

[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("indexForJointName:")]
nuint GetJointIndex ([BindAs (typeof (ARSkeletonJointName))] NSString jointName);
nuint GetJointIndex (NSString? jointName);

[Wrap ("GetJointIndex (jointName.GetConstant()!)")]
nuint GetJointIndex (ARSkeletonJointName jointName);
}

[iOS (13,0)]
Expand Down
1 change: 1 addition & 0 deletions src/frameworks.sources
Expand Up @@ -153,6 +153,7 @@ ARKIT_SOURCES = \
ARKit/ARFaceGeometry.cs \
ARKit/ARPlaneGeometry.cs \
ARKit/ARPointCloud.cs \
ARKit/ARSkeleton.cs \
ARKit/ARSkeleton3D.cs \
ARKit/ARSkeleton2D.cs \

Expand Down
24 changes: 24 additions & 0 deletions tests/monotouch-test/ARKit/ARSkeletonTest.cs
@@ -0,0 +1,24 @@
#if __IOS__

using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using ARKit;
using Foundation;
using NUnit.Framework;
using ObjCRuntime;

namespace monotouchtest.ARKit {
[TestFixture]
[Preserve (AllMembers = true)]
public class ARSkeletonTest {
[Test]
public void UnknonwPointTest ()
{
using (var notKnownPoint = new NSString ("nariz"))
Assert.IsNull (ARSkeleton.CreateJointName (notKnownPoint));
}

}
}
#endif
2 changes: 0 additions & 2 deletions tests/xtro-sharpie/iOS-ARKit.todo

This file was deleted.

0 comments on commit ee3777e

Please sign in to comment.