public override bool Initialize() { #if UNITY_EDITOR if (!MagicLeapRemoteManager.Initialize()) { return(false); } #endif // UNITY_EDITOR MagicLeapPrivileges.Initialize(); ApplySettings(); // Display Subsystem depends on Input Subsystem, so initialize that first. CheckForInputRelatedPermissions(); CreateSubsystem <XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "MagicLeap-Input"); CreateSubsystem <XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(s_DisplaySubsystemDescriptors, "MagicLeap-Display"); if (MagicLeapSettings.currentSettings != null && MagicLeapSettings.currentSettings.enableGestures) { CreateSubsystem <XRGestureSubsystemDescriptor, XRGestureSubsystem>(s_GestureSubsystemDescriptors, "MagicLeap-Gesture"); } if (CanCreateMeshSubsystem()) { CreateSubsystem <XRMeshSubsystemDescriptor, XRMeshSubsystem>(s_MeshSubsystemDescriptor, "MagicLeap-Mesh"); if (meshSubsystem != null) { MeshingSettings.meshingSettings = MLSpatialMapper.GetDefaultMeshingSettings(); MeshingSettings.batchSize = MLSpatialMapper.Defaults.batchSize; MeshingSettings.density = MLSpatialMapper.Defaults.density; MeshingSettings.SetBounds(Vector3.zero, Quaternion.identity, MLSpatialMapper.Defaults.boundsExtents); } } return(true); }
public override bool Initialize() { #if UNITY_EDITOR if (SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore) { Debug.LogWarning( "To use Magic Leap Zero Iteration mode, the editor must be running under OpenGL.\n" + " 1) Go to Edit -> Project Settings -> Player, and select the first tab there (Standalone Settings)...\n" + " 2) Open the 'Other Settings' section, and uncheck 'Auto Graphics API for Windows' An API list will appear.\n" + " 3) Use the + button to add 'OpenGLCore' to the API list.\n" + " 4) Drag it to the top of the list. The editor will now switch to using OpenGL.\n"); } if (!MagicLeapRemoteManager.Initialize()) { return(false); } #endif // UNITY_EDITOR #if UNITY_INPUT_SYSTEM InputLayoutLoader.RegisterInputLayouts(); #endif MagicLeapPrivileges.Initialize(); ApplySettings(); // Display Subsystem depends on Input Subsystem, so initialize that first. CheckForInputRelatedPermissions(); CreateSubsystem <XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "MagicLeap-Input"); CreateSubsystem <XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(s_DisplaySubsystemDescriptors, "MagicLeap-Display"); CreateSubsystem <XRGestureSubsystemDescriptor, XRGestureSubsystem>(s_GestureSubsystemDescriptors, "MagicLeap-Gesture"); if (CanCreateMeshSubsystem()) { CreateSubsystem <XRMeshSubsystemDescriptor, XRMeshSubsystem>(s_MeshSubsystemDescriptor, "MagicLeap-Mesh"); if (meshSubsystem != null) { // Register native callbacks for feature API meshSubsystem.RegisterNativeSubsystemCallbacks(); MeshingSettings.meshingSettings = MLSpatialMapper.GetDefaultMeshingSettings(); MeshingSettings.batchSize = MLSpatialMapper.Defaults.batchSize; MeshingSettings.density = MLSpatialMapper.Defaults.density; MeshingSettings.SetBounds(Vector3.zero, Quaternion.identity, MLSpatialMapper.Defaults.boundsExtents); } } // Now that subsystem creation is strictly handled by the loaders we must create the following subsystems // that live in ARSubsystems CreateSubsystem <XRSessionSubsystemDescriptor, XRSessionSubsystem>(s_SessionSubsystemDescriptors, "MagicLeap-Session"); CreateSubsystem <XRPlaneSubsystemDescriptor, XRPlaneSubsystem>(s_PlaneSubsystemDescriptors, "MagicLeap-Planes"); CreateSubsystem <XRAnchorSubsystemDescriptor, XRAnchorSubsystem>(s_AnchorSubsystemDescriptors, "MagicLeap-Anchor"); CreateSubsystem <XRRaycastSubsystemDescriptor, XRRaycastSubsystem>(s_RaycastSubsystemDescriptors, "MagicLeap-Raycast"); CreateSubsystem <XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem>(s_ImageTrackingSubsystemDescriptors, "MagicLeap-ImageTracking"); return(true); }
/// <summary> /// Applies the configured observation extents. /// </summary> protected override void ConfigureObserverVolume() { base.ConfigureObserverVolume(); using (ConfigureObserverVolumePerfMarker.Auto()) { // Update the observer MeshingSettings.SetBounds(ObserverOrigin, ObserverRotation, ObservationExtents); } }
public override bool Initialize() { #if UNITY_EDITOR if (SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore) { Debug.LogWarning( "To use Magic Leap Zero Iteration mode, the editor must be running under OpenGL.\n" + " 1) Go to Edit -> Project Settings -> Player, and select the first tab there (Standalone Settings)...\n" + " 2) Open the 'Other Settings' section, and uncheck 'Auto Graphics API for Windows' An API list will appear.\n" + " 3) Use the + button to add 'OpenGLCore' to the API list.\n" + " 4) Drag it to the top of the list. The editor will now switch to using OpenGL.\n"); } if (!MagicLeapRemoteManager.Initialize()) { return(false); } #endif // UNITY_EDITOR #if UNITY_INPUT_SYSTEM InputLayoutLoader.RegisterInputLayouts(); #endif MagicLeapPrivileges.Initialize(); ApplySettings(); // Display Subsystem depends on Input Subsystem, so initialize that first. CheckForInputRelatedPermissions(); CreateSubsystem <XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "MagicLeap-Input"); CreateSubsystem <XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(s_DisplaySubsystemDescriptors, "MagicLeap-Display"); if (MagicLeapSettings.currentSettings != null && MagicLeapSettings.currentSettings.enableGestures) { CreateSubsystem <XRGestureSubsystemDescriptor, XRGestureSubsystem>(s_GestureSubsystemDescriptors, "MagicLeap-Gesture"); } if (CanCreateMeshSubsystem()) { CreateSubsystem <XRMeshSubsystemDescriptor, XRMeshSubsystem>(s_MeshSubsystemDescriptor, "MagicLeap-Mesh"); if (meshSubsystem != null) { MeshingSettings.meshingSettings = MLSpatialMapper.GetDefaultMeshingSettings(); MeshingSettings.batchSize = MLSpatialMapper.Defaults.batchSize; MeshingSettings.density = MLSpatialMapper.Defaults.density; MeshingSettings.SetBounds(Vector3.zero, Quaternion.identity, MLSpatialMapper.Defaults.boundsExtents); } } return(true); }
void UpdateBounds() { MeshingSettings.SetBounds(transform, boundsExtents); transform.hasChanged = false; }