/// <para xml:lang="en"><see cref="MonoBehaviour"/> which controls <see cref="DenseSpatialMap"/> in the scene, providing a few extensions in the Unity environment. Use <see cref="Builder"/> directly when necessary.</para>
/// <para xml:lang="en">Strategy to control the <see cref="GameObject.active"/>. If you are willing to control <see cref="GameObject.active"/> or there are other components controlling <see cref="GameObject.active"/>, make sure to set it to <see cref="ActiveControlStrategy.None"/>.</para>
/// <para xml:lang="en">Map load finish event. The bool value indicates the load success or not. The string value is the error message when fail.</para>
/// <para xml:lang="en">Map unload finish event. The bool value indicates the unload success or not. The string value is the error message when fail.</para>
/// <para xml:lang="en">Map finish create and upload event. The bool value indicates success or not. The string value is the error message when fail.</para>
/// <para xml:lang="en">The <see cref="SparseSpatialMapWorkerFrameFilter"/> which loads the map after <see cref="MapInfoAvailable"/>. When set to null, the map will be unloaded from MapWorker previously set. Modify at any time and takes effect immediately.</para>
/// <para xml:lang="en">Perform hit test against the point cloud. The results are returned sorted by their distance to the camera in ascending order. <paramref name="pointInView"/> should be normalized to [0, 1]^2.</para>
/// <para xml:lang="en">Create and upload map. <paramref name="name"/> is the map name and <paramref name="preview"/> is the optional map preview image.</para>
/// <para xml:lang="en"><see cref="MonoBehaviour"/> which controls <see cref="SparseSpatialMap"/> in the scene, providing a few extensions in the Unity environment. Use <see cref="Builder"/>, <see cref="Localizer"/> or <see cref="Manager"/> directly when necessary.</para>
/// <para xml:lang="en">Use global service config or not. The global service config can be changed on the inspector after click Unity menu EasyAR -> Change Global Spatial Map Service Config.</para>
/// <para xml:lang="zh">是否使用全局服务器配置。全局配置可以点击Unity菜单EasyAR -> Change Global Spatial Map Service Config可以在属性面板里面进行填写。</para>
/// </summary>
publicboolUseGlobalServiceConfig=true;
/// <summary>
/// <para xml:lang="en">Service config when <see cref="UseGlobalServiceConfig"/> == false, only valid for this object.</para>
/// <para xml:lang="en">Map load finish event. The bool value indicates the load success or not. The string value is the error message when fail.</para>
/// <para xml:lang="en">Map unload finish event. The bool value indicates the unload success or not. The string value is the error message when fail.</para>
/// <para xml:lang="en">Map create and upload finish event. The bool value indicates the create and upload success or not. The string value is the error message when fail.</para>
/// <para xml:lang="en">Current working mode. The working mode start as <see cref="Mode.Build"/> and will change to <see cref="Mode.Localize"/> after a map load.</para>
/// <para xml:lang="en">The map controller for map building. To visualize the map building, <see cref="SparseSpatialMapController.SourceType"/> of one <see cref="SparseSpatialMapController"/> should be set to <see cref="SparseSpatialMapController.DataSource.MapBuilder"/> and the map should be loaded before building start.</para>
/// <para xml:lang="en"><see cref="MonoBehaviour"/> which controls <see cref="SurfaceTracker"/> in the scene, providing a few extensions in the Unity environment. Use <see cref="Tracker"/> directly when necessary.</para>
/// <para xml:lang="en"><see cref="MonoBehaviour"/> which controls VIO camera device (<see cref="MotionTrackerCameraDevice"/>, <see cref="ARKitCameraDevice"/> or <see cref="ARCoreCameraDevice"/>) in the scene, providing a few extensions in the Unity environment. Use <see cref="Device"/> directly when necessary.</para>
/// <para xml:lang="en">EasyAR Sense API (Union). Accessible between <see cref="DeviceCreated"/> and <see cref="DeviceClosed"/> event if available.</para>
/// <para xml:lang="zh">EasyAR Sense API (Union),如果功能可以使用,可以在<see cref="DeviceCreated"/>和<see cref="DeviceClosed"/>事件之间访问。</para>
/// </summary>
publicDeviceUnionDevice{get;privateset;}
/// <summary>
/// <para xml:lang="en">Strategy of choosing VIO device.</para>
/// <para xml:lang="zh">选择VIO设备的策略。</para>
/// </summary>
publicDeviceChooseStrategyDeviceStrategy;
/// <summary>
/// <para xml:lang="en">Desired motion tracker parameters, used only when <see cref="Device"/> start. Effective only when <see cref="MotionTrackerCameraDevice"/> is used.</para>
thrownewUIPopupException("System VIO not available");
}
break;
caseDeviceChooseStrategy.EasyARMotionTrackerOnly:
if(!MotionTrackerCameraDevice.isAvailable())
{
thrownewUIPopupException(typeof(MotionTrackerCameraDevice)+" not available");
}
break;
default:
break;
}
base.Start();
}
/// <summary>
/// MonoBehaviour OnDisable
/// </summary>
protectedoverridevoidOnDisable()
{
base.OnDisable();
if(deviceStop!=null)
{
deviceStop();
}
}
/// <summary>
/// <para xml:lang="en">Performs ray cast from the user's device in the direction of given screen point. Intersections with horizontal plane is detected in real time in the current field of view,and return the 3D point nearest to ray on horizontal plane. <paramref name="pointInView"/> should be normalized to [0, 1]^2.</para>
/// <para xml:lang="en">Perform hit test against the point cloud and return the nearest 3D point. <paramref name="pointInView"/> should be normalized to [0, 1]^2.</para>
if(_ProjectionParams.x<0)// check if the render target is a texture rather than the screen, https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
{
o.vertex.y=-o.vertex.y;
}
o.texcoord=float2(i.texcoord.x,1.0-i.texcoord.y);// Texture2D.LoadRawTextureData follows OpenGL convention and will invert Y-axis for uncompressed data on all platforms
if(_ProjectionParams.x<0)// check if the render target is a texture rather than the screen, https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
{
o.vertex.y=-o.vertex.y;
}
o.texcoord=float2(i.texcoord.x,1.0-i.texcoord.y);// Texture2D.LoadRawTextureData follows OpenGL convention and will invert Y-axis for uncompressed data on all platforms