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 for Xcode 9 GM #2681

Merged
merged 3 commits into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions src/arkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@

using System;
using System.ComponentModel;
using XamCore.AVFoundation;
using XamCore.CoreFoundation;
using XamCore.CoreGraphics;
using XamCore.CoreMedia;
using XamCore.CoreVideo;
using XamCore.Foundation;
using XamCore.ObjCRuntime;
using XamCore.Metal;
using XamCore.SpriteKit;
using XamCore.SceneKit;
using XamCore.UIKit;

using Vector2 = global::OpenTK.Vector2;
using Vector3 = global::OpenTK.NVector3;
using Matrix3 = global::OpenTK.NMatrix3;
using Matrix4 = global::OpenTK.NMatrix4;
Expand Down Expand Up @@ -187,6 +190,12 @@ interface ARFrame : NSCopying {
[Export ("capturedImage")]
CVPixelBuffer CapturedImage { get; }

[NullAllowed, Export ("capturedDepthData", ArgumentSemantic.Strong)]
AVDepthData CapturedDepthData { get; }

[Export ("capturedDepthDataTimestamp")]
double CapturedDepthDataTimestamp { get; }

[Export ("camera", ArgumentSemantic.Copy)]
ARCamera Camera { get; }

Expand Down Expand Up @@ -509,6 +518,106 @@ interface ARSCNDebugOptions {
[Field ("ARSCNDebugOptionShowFeaturePoints")]
SCNDebugOptions ShowFeaturePoints { get; }
}

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[Protocol]
interface ARTrackable {
[Abstract]
[Export ("isTracked")]
bool IsTracked { get; }
}

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[BaseType (typeof(ARConfiguration))]
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a [DisableDefaultCtor] on the base type
but in this case it might be valid but...
The abstract base class for AR session configurations. https://developer.apple.com/documentation/arkit/arconfiguration

so there's an [Abstract] missing from ARConfiguration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ARConfiguration should indeed be [Abstract] and [DisableDefaultCtor] is right here (:

/** Unavailable */
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

interface ARFaceTrackingConfiguration {}

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[BaseType (typeof(ARAnchor))]
interface ARFaceAnchor : ARTrackable {
[Export ("geometry")]
ARFaceGeometry Geometry { get; }

/* Will come in next PR
// @property (readonly, nonatomic) NSDictionary<ARBlendShapeLocation,NSNumber *> * _Nonnull blendShapes;
[Export ("blendShapes")]
NSDictionary<NSString, NSNumber> BlendShapes { get; }
*/
}

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface ARFaceGeometry : NSCopying {
/* Will come in next PR
[Export ("initWithBlendShapes:")]
IntPtr Constructor (NSDictionary<NSString, NSNumber> blendShapes);
*/

[Export ("vertexCount")]
nuint VertexCount { get; }

// @property (readonly, nonatomic) const vector_float3 * _Nonnull vertices;
Copy link
Member

Choose a reason for hiding this comment

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

This comment can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup missed. I'll remove in next PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rolfbjarne that's minor though, not PR blocking, I'll fix in next PR.

[Export ("vertices")]
Vector3 Vertices {
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
get;
}

[Export ("textureCoordinateCount")]
nuint TextureCoordinateCount { get; }

[Export ("textureCoordinates")]
Vector2 TextureCoordinates {
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
get;
}

[Export ("triangleCount")]
nuint TriangleCount { get; }

[Export ("triangleIndices")]
short TriangleIndices { get; }
}

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[BaseType (typeof(SCNGeometry))]
[DisableDefaultCtor]
interface ARSCNFaceGeometry {
[Static]
[Export ("faceGeometryWithDevice:")]
[return: NullAllowed]
ARSCNFaceGeometry CreateFaceGeometry (IMTLDevice device);

[Static]
[Export ("faceGeometryWithDevice:fillMesh:")]
[return: NullAllowed]
ARSCNFaceGeometry CreateFaceGeometry (IMTLDevice device, bool fillMesh);

[Export ("updateFromFaceGeometry:")]
void Update (ARFaceGeometry faceGeometry);
}

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[BaseType (typeof(ARLightEstimate))]
Copy link
Contributor

Choose a reason for hiding this comment

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

base type has a [DisableDefaultCtor] so the subclass should too

Copy link
Contributor Author

@VincentDondain VincentDondain Sep 13, 2017

Choose a reason for hiding this comment

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

You're right ARDirectionalLightEstimate subclass doesn't have init

interface ARDirectionalLightEstimate {
[Export ("sphericalHarmonicsCoefficients", ArgumentSemantic.Copy)]
NSData SphericalHarmonicsCoefficients { get; }

[Export ("primaryLightDirection")]
Vector3 PrimaryLightDirection {
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
get;
}

[Export ("primaryLightIntensity")]
nfloat PrimaryLightIntensity { get; }
}
}

#endif // XAMCORE_2_0
11 changes: 0 additions & 11 deletions tests/xtro-sharpie/ios.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,9 @@

# ARKit

## API_DEPRECATED_WITH_REPLACEMENT("projectionMatrixForOrientation:viewportSize:zNear:zFar:", ios(11.0, 11.0));
!missing-selector! ARCamera::projectionMatrixWithViewportSize:orientation:zNear:zFar: not bound
## API_DEPRECATED_WITH_REPLACEMENT("displayTransformForOrientation:viewportSize:", ios(11.0, 11.0));
!missing-selector! ARFrame::displayTransformWithViewportSize:orientation: not bound
## NS_SWIFT_UNAVAILABLE("Use run(_:options:) instead")
!missing-selector! ARSession::runWithConfiguration: not bound

#ARKit

## new, but deprecated (in beta 5), types - but still in headers
!missing-type! ARSessionConfiguration not bound
!missing-type! ARWorldTrackingSessionConfiguration not bound


# AssetLibrary

## typedef is used + untyped enum in ALAssetsLibrary.h: typedef NSUInteger ALAssetsGroupType;
Expand Down