Skip to content

Commit

Permalink
Merge pull request Unity-Technologies#10 from unity/mars-volume-queries
Browse files Browse the repository at this point in the history
MARS Volume Queries
  • Loading branch information
mtschoen-unity authored and GitHub Enterprise committed Feb 12, 2020
2 parents adf557e + 06e1bc4 commit abe47dc
Show file tree
Hide file tree
Showing 42 changed files with 181 additions and 680 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
path = Runtime/libs/input-prototype
url=https://github.com/Unity-Technologies/input-prototype.git
branch = editorvr/main
[submodule "Runtime/libs/UnityOctree"]
path = Runtime/libs/UnityOctree
url=https://github.com/Unity-Technologies/UnityOctree.git
23 changes: 0 additions & 23 deletions Interfaces/Providers/IProvidesSpatialHash.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Interfaces/Providers/IProvidesSpatialHash.cs.meta

This file was deleted.

42 changes: 0 additions & 42 deletions Interfaces/Subscribers/IUsesSpatialHash.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Interfaces/Subscribers/IUsesSpatialHash.cs.meta

This file was deleted.

1 change: 1 addition & 0 deletions Runtime/Actions/Duplicate.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Unity.Labs.EditorXR.Interfaces;
using Unity.Labs.EditorXR.Utilities;
using Unity.Labs.ModuleLoader;
using Unity.Labs.SpatialHash;
using Unity.Labs.Utils;
using UnityEditor;
using UnityEngine;
Expand Down
1 change: 1 addition & 0 deletions Runtime/Actions/Paste.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Unity.Labs.EditorXR.Interfaces;
using Unity.Labs.EditorXR.Utilities;
using Unity.Labs.ModuleLoader;
using Unity.Labs.SpatialHash;
using Unity.Labs.Utils;
using UnityEditor;
using UnityEngine;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/Core/EditorXRDirectSelectionModule.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Unity.Labs.EditorXR.Extensions;
using Unity.Labs.EditorXR.Interfaces;
using Unity.Labs.EditorXR.Modules;
using Unity.Labs.EditorXR.Proxies;
using Unity.Labs.ModuleLoader;
using Unity.Labs.Utils;
using UnityEngine;

namespace Unity.Labs.EditorXR.Core
Expand Down
20 changes: 7 additions & 13 deletions Runtime/Scripts/Core/EditorXRMiniWorldModule.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using System.Collections.Generic;
using System.Linq;
using Unity.Labs.EditorXR.Extensions;
using Unity.Labs.EditorXR.Interfaces;
using Unity.Labs.EditorXR.Modules;
using Unity.Labs.EditorXR.Proxies;
using Unity.Labs.EditorXR.Utilities;
using Unity.Labs.EditorXR.Workspaces;
using Unity.Labs.ModuleLoader;
using Unity.Labs.SpatialHash;
using Unity.Labs.Utils;
using UnityEditor;
using UnityEngine;

namespace Unity.Labs.EditorXR.Core
{
class EditorXRMiniWorldModule : IModuleDependency<EditorXRToolModule>, IModuleDependency<EditorXRDirectSelectionModule>,
IModuleDependency<SpatialHashModule>, IModuleDependency<HighlightModule>, IModuleDependency<IntersectionModule>,
IModuleDependency<WorkspaceModule>, IModuleDependency<EditorXRRayModule>, IUsesPlaceSceneObjects, IUsesViewerScale,
IUsesSpatialHash, IUsesRayVisibilitySettings, IProvidesIsInMiniWorld
IModuleDependency<HighlightModule>, IModuleDependency<IntersectionModule>, IModuleDependency<WorkspaceModule>,
IModuleDependency<EditorXRRayModule>, IUsesPlaceSceneObjects, IUsesViewerScale, IUsesSpatialHash,
IUsesRayVisibilitySettings, IProvidesIsInMiniWorld
{
internal class MiniWorldRay
{
Expand Down Expand Up @@ -177,7 +177,6 @@ public void UpdatePreview()
EditorXRToolModule m_ToolModule;
EditorXRDirectSelectionModule m_DirectSelectionModule;
EditorXRRayModule m_RayModule;
SpatialHashModule m_SpatialHashModule;
HighlightModule m_HighlightModule;
IntersectionModule m_IntersectionModule;

Expand Down Expand Up @@ -216,11 +215,6 @@ public void ConnectDependency(EditorXRRayModule dependency)
m_RayModule = dependency;
}

public void ConnectDependency(SpatialHashModule dependency)
{
m_SpatialHashModule = dependency;
}

public void ConnectDependency(HighlightModule dependency)
{
m_HighlightModule = dependency;
Expand Down Expand Up @@ -559,11 +553,11 @@ void UpdateRayContainment(DeviceData data)
internal void OnWorkspaceCreated(IWorkspace workspace)
{
var miniWorldWorkspace = workspace as MiniWorldWorkspace;
if (!miniWorldWorkspace)
if (miniWorldWorkspace == null)
return;

miniWorldWorkspace.zoomSliderMax = m_SpatialHashModule.GetMaxBounds().size.MaxComponent()
/ miniWorldWorkspace.contentBounds.size.MaxComponent();
var maxBounds = this.HasProvider<IProvidesSpatialHash>() ? this.GetAggregateBounds().size.MaxComponent() : 10f;
miniWorldWorkspace.zoomSliderMax = maxBounds / miniWorldWorkspace.contentBounds.size.MaxComponent();

var miniWorld = miniWorldWorkspace.miniWorld;
var worldID = m_Worlds.Count;
Expand Down
7 changes: 5 additions & 2 deletions Runtime/Scripts/Core/EditorXRRayModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Unity.Labs.EditorXR.Proxies;
using Unity.Labs.EditorXR.Utilities;
using Unity.Labs.ModuleLoader;
using Unity.Labs.SpatialHash;
using Unity.Labs.Utils;
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -92,8 +93,10 @@ public void LoadModule()
m_DirectSelectionModule = moduleLoaderCore.GetModule<EditorXRDirectSelectionModule>();
m_SerializedPreferences = moduleLoaderCore.GetModule<SerializedPreferencesModule>();
m_IntersectionModule = moduleLoaderCore.GetModule<IntersectionModule>();
if (m_IntersectionModule != null)
ignoreList = m_IntersectionModule.standardIgnoreList;

var selectionModule = moduleLoaderCore.GetModule<SelectionModule>();
if (selectionModule != null)
ignoreList = selectionModule.standardIgnoreList;

m_ModuleParent = moduleLoaderCore.GetModuleParent().transform;
}
Expand Down
18 changes: 9 additions & 9 deletions Runtime/Scripts/Core/EditorXRViewerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
using Unity.Labs.EditorXR.Interfaces;
using Unity.Labs.EditorXR.Modules;
using Unity.Labs.EditorXR.Utilities;
using Unity.Labs.ModuleLoader;
using Unity.Labs.SpatialHash;
using Unity.Labs.Utils;
using UnityEngine;
using UnityEngine.XR;
using Unity.Labs.ModuleLoader;

namespace Unity.Labs.EditorXR.Core
{
class EditorXRViewerModule : ScriptableSettings<EditorXRViewerModule>,
IModuleDependency<EditorXRDirectSelectionModule>, IInterfaceConnector,
ISerializePreferences, IUsesConnectInterfaces, IDelayedInitializationModule, IModuleBehaviorCallbacks,
IUsesFunctionalityInjection, IProvidesViewerScale, IProvidesViewerBody, IProvidesMoveCameraRig,
IProvidesGetVRPlayerObjects
IProvidesGetVRPlayerObjects, IUsesSpatialHash
{
[Serializable]
class Preferences
Expand Down Expand Up @@ -100,6 +101,7 @@ public float cameraRigScale
#if !FI_AUTOFILL
IProvidesFunctionalityInjection IFunctionalitySubscriber<IProvidesFunctionalityInjection>.provider { get; set; }
IProvidesConnectInterfaces IFunctionalitySubscriber<IProvidesConnectInterfaces>.provider { get; set; }
IProvidesSpatialHash IFunctionalitySubscriber<IProvidesSpatialHash>.provider { get; set; }
#endif

public void ConnectDependency(EditorXRDirectSelectionModule dependency)
Expand Down Expand Up @@ -241,20 +243,18 @@ void AddPlayerModel()
{
m_PlayerBody = EditorXRUtils.Instantiate(m_PlayerModelPrefab, CameraUtils.GetMainCamera().transform, false).GetComponent<PlayerBody>();
this.InjectFunctionalitySingle(m_PlayerBody);
var renderer = m_PlayerBody.GetComponent<Renderer>();
var spatialHashModule = ModuleLoaderCore.instance.GetModule<SpatialHashModule>();
if (spatialHashModule != null)
spatialHashModule.spatialHash.AddObject(renderer, renderer.bounds);
if (this.HasProvider<IProvidesSpatialHash>())
this.AddRendererToSpatialHash(m_PlayerBody.GetComponent<Renderer>());

var playerObjects = m_PlayerBody.GetComponentsInChildren<Renderer>(true);
foreach (var playerObject in playerObjects)
{
m_VRPlayerObjects.Add(playerObject.gameObject);
}

var intersectionModule = ModuleLoaderCore.instance.GetModule<IntersectionModule>();
if (intersectionModule != null)
intersectionModule.standardIgnoreList.AddRange(m_VRPlayerObjects);
var selectionModule = ModuleLoaderCore.instance.GetModule<SelectionModule>();
if (selectionModule != null)
selectionModule.standardIgnoreList.AddRange(m_VRPlayerObjects);
}

public bool IsOverShoulder(Transform rayOrigin)
Expand Down
45 changes: 0 additions & 45 deletions Runtime/Scripts/Data/SpatialHash.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Runtime/Scripts/Data/SpatialHash.cs.meta

This file was deleted.

21 changes: 0 additions & 21 deletions Runtime/Scripts/Extensions/BoundsExtensions.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Runtime/Scripts/Extensions/BoundsExtensions.cs.meta

This file was deleted.

Loading

0 comments on commit abe47dc

Please sign in to comment.