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

AR Toolkit - fixes for iOS, MAUI iOS #466

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

nCastle1
Copy link
Contributor

@nCastle1 nCastle1 commented Nov 18, 2022

  • Fixes issues with sample content
  • Improves error reporting in samples
  • Removes some unnecessary iOS designed code
  • Fixes the camera equality comparison
  • Fixes the MAUI handler implementation
  • Fixes threading crash on iOS
  • Fixes for changed ARKit API/behavior
  • Select nullability fixes

I didn't fix all nullability warnings. There are quite a few nullability warnings on iOS that aren't likely to cause problems in practice and VS for Mac isn't giving any editor support (something wrong with multitargeting). It didn't seem worth the time to fix given we won't be releasing AR Toolkit at 200.

@nCastle1 nCastle1 requested a review from dotMorten November 18, 2022 23:38
Base automatically changed from v200 to main December 14, 2022 18:05
@mstefarov mstefarov force-pushed the ncastle/v200-ios-ar branch from 424bb37 to 2233a0f Compare February 2, 2023 22:02
Copy link
Member

@dotMorten dotMorten left a comment

Choose a reason for hiding this comment

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

Lots of good changes here with cleanup, but also a lot of changes that are hard to review. I suggest we go back and roll back some changes and investigate what is really needed.

Comment on lines -289 to +291
camera1.Heading == camera2.Heading &&
camera1.Pitch == camera2.Pitch &&
camera1.Roll == camera2.Roll;
Math.Abs(camera1.Heading - camera2.Heading) < 0.01 &&
Math.Abs(camera1.Pitch - camera2.Pitch) < 0.01 &&
Math.Abs(camera1.Roll - camera2.Roll) < 0.01;
Copy link
Member

Choose a reason for hiding this comment

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

Undo, or of really needed, reduce tolerance to around Epsilon.

return Encoding.UTF8.GetString(ms.ToArray());
}
}

Copy link
Member

Choose a reason for hiding this comment

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

Bring back. Not sure why we don't want to use it any longer? Commit jsut says "Fix download manager to work with .net6-ios", but I only see removed code, no fix

task = previousTask;
tempFile = task.Filename;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Also bring back.

@@ -77,7 +93,7 @@ private async Task InitializeAsync()

private void MoveVertical(double offset)
{
ARView.SetInitialTransformation(ARView.InitialTransformation + TransformationMatrix.Create(0, 0, 0, 1, 0, -offset, 0));
ARView?.SetInitialTransformation(ARView.InitialTransformation + TransformationMatrix.Create(0, 0, 0, 1, 0, -offset * 10, 0));
Copy link
Member

Choose a reason for hiding this comment

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

Why this change? We should undo

ARView.Scene = scene;
//await scene.LoadAsync();

ARView!.TranslationFactor = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Why didn't we need to set this before? Probably undo

Comment on lines -22 to +27
#if WINDOWS || __IOS__ || __ANDROID__
: ViewHandler<IARSceneView, Esri.ArcGISRuntime.ARToolkit.ARSceneView>
#else
#if WINDOWS || __IOS__ || __ANDROID__
: ArcGISRuntime.Maui.Handlers.SceneViewHandler
#else
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't feel quite right. We need IARSceneView in the viewhandler interface.

Comment on lines -59 to +63
protected override void ConnectHandler(ARToolkit.ARSceneView platformView)
protected override void ConnectHandler(Esri.ArcGISRuntime.UI.Controls.SceneView platformView)
Copy link
Member

Choose a reason for hiding this comment

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

This is another artifact of inheriting from the wrong thing.

Comment on lines +188 to +197
if (arSceneView.RenderVideoFeed)
{
arSceneView.SpaceEffect = arview.SpaceEffect = SpaceEffect.None;
arSceneView.AtmosphereEffect = arview.AtmosphereEffect = AtmosphereEffect.None;
}
else
{
arSceneView.SpaceEffect = arview.SpaceEffect = SpaceEffect.Stars;
arSceneView.AtmosphereEffect = arview.AtmosphereEffect = AtmosphereEffect.HorizonOnly;
}
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the native control do this? If it's to sync up with native control, can we get a property change to react to, or just grab the value from arview instead of assigning both?

@@ -141,37 +141,41 @@ private void OnCameraDidChangeTrackingState(ARSession session, ARCamera camera)

private void OnWillRenderScene(ISCNSceneRenderer renderer, SCNScene scene, double timeInSeconds)
{
if (_tracking && ARSCNView != null)
CoreFoundation.DispatchQueue.MainQueue.DispatchAsync(() =>
Copy link
Member

Choose a reason for hiding this comment

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

I don't have context why this change is now required. This shouldn't be necessary. Commit comment is "Fix crash AR sceneview ios" with no reference to issue.

Comment on lines +155 to +157
var t = pov.WorldPosition;
if (_controller != null)
_controller.TransformationMatrix = InitialTransformation + TransformationMatrix.Create(q.X, q.Y, q.Z, q.W, t.X, t.Y, t.Z);
Copy link
Member

Choose a reason for hiding this comment

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

All this says "Fix issue with AR position on iOS" in commit. I'm not quite following why this change is needed. See commit f24a385

@dotMorten dotMorten self-assigned this Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants