Using AR (Augmented Reality) in Xamarin.Forms processing ... (on)

AR (Augmented Reality) technology since Pokemon Go! AR series of games widely welcomed and loved later, the general public can also turn out to be simple to understand a technology, while its mobile phone App, AR technology will from then on, has always been a very hot topic of discussion.

So, today lead you to learn how to accomplish basic use of AR (Augmented Reality) in Xamarin.Forms them.


In Xamarin.Forms UI design itself, of course, it is no way to directly reach a deal AR (Augmented Reality) is. But do not forget there is a call DependencyService Xamarin.Forms special techniques to allow the program to call Xamarin.Forms execution Native Code for each platform.

So, we use technology (augmented reality) of AR in Xamarin.Forms, in fact, use DependencyService implementation Xamarin.Forms, so if you do not know so much about friends DependencyService concepts, please refer to the relevant sections of Microsoft's document presentation, and if you still do not understand this is what friends are welcome to enroll in education and training related to Xamairn.Forms basic course.

Good, then let's get started!
(In this article we first discuss how to use DependencyService from Xamarin.Forms, AR to complete the deal iOS platform.)



Start by establishing a Xamarn.Forms good program, there will be three internal projects Xamarin.Forms (.NET Standard), Xamarin.Android, Xamarin.iOS, and data related to the establishment and put in Xamarin.Forms with Xamarin.iOS folders and files, the results as shown below:

Here we explain DependencyService not much to do in the whole set of programs and projects, but pay attention to the place on the map is a 3-D model of the file in our project which will Xamarin.iOS to the use of data on Resources art.scnassets data folder created under the folder.

Again we open MainPage.xaml Xamarin.Forms project among the XAML editor and settings related to the screen, this screen is currently only put a basic button, and registration of the case handler method button events.
(In the XAML editor to preview the results to see how, if necessary, please see the related article on LiveXAML)

The handler method for the button click event, write to perform with DependencyService LaunchAR method in the interface design calls.

Here is DependencyService of interface design:

Because we want to test AR iOS platform, so we open the file under the Xamarin.iOS ArDependencyService.cs project, practice IArDependencyService this interface in ArDependencyService of this file class. Which method to use to practice LaunchAR ArViewControllerHelper this really practice-related iOS AR treatment on the iOS platform category.

ArViewControllerHelper in this class, the most important thing to use is nothing more than two framework iOS platform, which itself provides the (iOS development is so called) to handle AR, one ARKit, and the other is SceneKit.

When finished, it performs this App, and click on the execute screen button "AR Start!".

再来就会看到该 AR 的效果画面。
(注意在 iOS 模拟器当中是无法执行出 AR 效果的,你只会得到黑压压一片的画面效果。)

(上图执行结果取自 Xamarin - Augmented Reality in Xamarin.Forms 文章中的执行画面)

以上就完成了 Xamarin.Forms 在 iOS 平台的设计,下回我们将开始挑战 Android 平台。

以下参考连结欢迎参考:

1. Xamarin - Augmented Reality in Xamarin.Forms:
https://msdn.microsoft.com/en-us/magazine/mt830360.aspx

2. Xamarin.iOS ARKit example project
https://github.com/windperson/Xamarin_ARKit_PlacingObject

原文:大专栏  在 Xamarin.Forms 中使用 AR (扩增实境) 的处理...(上)


Guess you like

Origin www.cnblogs.com/chinatrump/p/11505416.html
Recommended