Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ARKit] Update framework to Xcode 12 beta 5. #9402

Merged
merged 5 commits into from Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/ARKit/ARSkeleton.cs
@@ -0,0 +1,23 @@
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);

[iOS (14,0)]
public static NSString CreateJointName (NSString recognizedPointKey)
{
if (recognizedPointKey == null)
throw new ArgumentNullException (nameof (recognizedPointKey));
return (NSString) Runtime.GetNSObject (ARSkeletonJointNameForRecognizedPointKey (recognizedPointKey.Handle));
}
}
}
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);
spouliot marked this conversation as resolved.
Show resolved Hide resolved

[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);
spouliot marked this conversation as resolved.
Show resolved Hide resolved
}

[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);
spouliot marked this conversation as resolved.
Show resolved Hide resolved
}

[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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was the reason to remove [BindAs] ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the new added C API allows to create new ARSkeletonJointName which are a typedef based on NSString, if we hide it then the new API makes so sense. The new binding exposes the NSString option as an advance option and then adds the wrap for our smart enum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, copy/paste that into the commit message before merging :)

}

[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 UnknownPointTest ()
{
using (var notKnownPoint = new NSString ("nariz"))
Assert.IsNull (ARSkeleton.CreateJointName (notKnownPoint));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't add the success until visio is done, tracked here: #9420

}

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

This file was deleted.