Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Camera System Refactor #517

Merged
merged 106 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
bd7e898
removed profile references from outside constructor
StephenHodgson Apr 11, 2020
a676d8e
First pass at camera system refactor
StephenHodgson Apr 11, 2020
7839c97
put some files in their proper place
StephenHodgson Apr 11, 2020
f885b64
Added camera data provider
StephenHodgson Apr 11, 2020
deea211
updated how we applied the head height
StephenHodgson Apr 11, 2020
b67173d
Fixed a race condition after we've reset the profile and started re-i…
StephenHodgson Apr 11, 2020
2559320
Merge branch 'fix/platforms' into fix/camera-system
StephenHodgson Apr 11, 2020
afb7eec
reverted some changes
StephenHodgson Apr 11, 2020
7cad6b8
added GameObject reference to camera rig
StephenHodgson Apr 11, 2020
6ac60b1
Merge branch 'fix/platforms' into fix/camera-system
StephenHodgson Apr 11, 2020
70cfdff
updated sdk
StephenHodgson Apr 11, 2020
6be4816
reverted quality settings change
StephenHodgson Apr 11, 2020
b0faadc
updated sdk
StephenHodgson Apr 12, 2020
2d586e3
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 12, 2020
8bc489c
updated lumin checkout
StephenHodgson Apr 12, 2020
1b429b0
removed extra line
StephenHodgson Apr 12, 2020
561efd3
Added a reference to the camera system since the toolkit static acces…
StephenHodgson Apr 12, 2020
6325305
Added an optional flag to set the head height on all registered provi…
StephenHodgson Apr 12, 2020
d8d1a53
moved logic about how we get main camera rig into the getter property…
StephenHodgson Apr 12, 2020
5fa43a6
removed the Enable call searching for main camera. Not lives in prope…
StephenHodgson Apr 12, 2020
c5147ca
updated wmr checkout
StephenHodgson Apr 12, 2020
f5ddf30
updated boundary system to utilize enable and disable properly
StephenHodgson Apr 12, 2020
829d83a
Merge branch 'fix/boundary-system' into fix/camera-system
StephenHodgson Apr 12, 2020
6991dfe
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 12, 2020
9af4944
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 12, 2020
65f62a3
updated base camera provider
StephenHodgson Apr 13, 2020
f5babab
Merge branch 'fix/camera-system' of https://github.com/XRTK/XRTK-Core…
StephenHodgson Apr 13, 2020
7d2c446
refactored the platforms to include IsBuildTargetAvailible and IsBuil…
StephenHodgson Apr 13, 2020
31c2a09
Better inspector
StephenHodgson Apr 13, 2020
1b67aea
Merge branch 'dev/platform-refactor' into fix/camera-system
StephenHodgson Apr 13, 2020
fde9cfe
reverted single service per platform
StephenHodgson Apr 13, 2020
188fcb6
Merge branch 'development' into dev/platform-refactor
StephenHodgson Apr 13, 2020
f286ad6
updated Icon
StephenHodgson Apr 13, 2020
533eea1
Merge branch 'dev/platform-refactor' of https://github.com/XRTK/XRTK-…
StephenHodgson Apr 13, 2020
c5d248b
Merge branch 'dev/platform-refactor' into fix/camera-system
StephenHodgson Apr 13, 2020
e48fda0
updated submodules
StephenHodgson Apr 13, 2020
2dd6926
reverted inspector changes
StephenHodgson Apr 13, 2020
5afc829
fixed sdk checkout
StephenHodgson Apr 13, 2020
78784e9
Merge branch 'development' into dev/platform-refactor
StephenHodgson Apr 13, 2020
324a9ae
Merge branch 'dev/platform-refactor' into fix/camera-system
StephenHodgson Apr 13, 2020
5c63922
updated submodules
StephenHodgson Apr 13, 2020
24aca02
better dropdown menu
StephenHodgson Apr 13, 2020
465baf4
optimized and made sure we call gui changed correctly
StephenHodgson Apr 13, 2020
974be9f
Merge branch 'dev/platform-refactor' into fix/camera-system
StephenHodgson Apr 13, 2020
b2692b0
updated sdk checkout
StephenHodgson Apr 13, 2020
7c76a46
reverted name change
StephenHodgson Apr 13, 2020
ca588bf
Merge branch 'dev/platform-refactor' into fix/camera-system
StephenHodgson Apr 13, 2020
069eca5
Updated Service Locator
StephenHodgson Apr 14, 2020
b0a9be6
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 14, 2020
4c0caa5
Merge branch 'development' into dev/service-locator-data-provider-ref…
StephenHodgson Apr 14, 2020
091866b
Merge branch 'dev/service-locator-data-provider-refactor' into fix/ca…
StephenHodgson Apr 14, 2020
3990850
updated sdk checkout
StephenHodgson Apr 14, 2020
e46a0c9
updated usage for TryRegisterServiceConfigurations
StephenHodgson Apr 14, 2020
1d31e78
removed unused reference
StephenHodgson Apr 14, 2020
4d0655d
Updated TryUnregisterService to also unregister any data providers it…
StephenHodgson Apr 14, 2020
472335a
Merge branch 'dev/service-locator-data-provider-refactor' into fix/ca…
StephenHodgson Apr 14, 2020
9fbcb26
fixed head height for services that start at the origin
StephenHodgson Apr 14, 2020
8aafc23
Added priority override to camera system
StephenHodgson Apr 14, 2020
884a2c5
Merge branch 'development' into dev/service-locator-data-provider-ref…
StephenHodgson Apr 14, 2020
cc11357
Merge branch 'dev/service-locator-data-provider-refactor' into fix/ca…
StephenHodgson Apr 14, 2020
231ad26
optimized Check Service Match
StephenHodgson Apr 15, 2020
639dee7
removed redundant type arg
StephenHodgson Apr 15, 2020
3b8596e
Merge branch 'dev/service-locator-data-provider-refactor' into fix/ca…
StephenHodgson Apr 15, 2020
b05452a
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 16, 2020
9e2ef67
updated wmr checkout
StephenHodgson Apr 16, 2020
ce3b404
Apply the default head height settings if the camera's opacity flag c…
StephenHodgson Apr 18, 2020
5786b42
Made sure we're resetting the transforms of the visualizations for ea…
StephenHodgson Apr 19, 2020
b2256c7
updated some documentation
StephenHodgson Apr 19, 2020
fe7fc09
updated wmr and sdk checkouts
StephenHodgson Apr 19, 2020
3286383
removed oculus head height getting set in the controllers
StephenHodgson Apr 19, 2020
16fc559
removed adjustment of plays pace transform in ApplySettingsForDefault…
StephenHodgson Apr 19, 2020
2abe090
updated lumin checkout
StephenHodgson Apr 19, 2020
8844030
updated lumin checkout
StephenHodgson Apr 19, 2020
6061141
updated sdk checkout
StephenHodgson Apr 19, 2020
9ce115a
removed comment
StephenHodgson Apr 19, 2020
9b348f9
updated sdk checkout
StephenHodgson Apr 19, 2020
9f74f8f
updated oculus checkout
StephenHodgson Apr 19, 2020
10d1509
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 19, 2020
5cbf736
updated submodule checkouts
StephenHodgson Apr 19, 2020
e8ba554
Removed duplicated serialized fields for the camera data provider glo…
StephenHodgson Apr 19, 2020
09ff3d9
added configuration foldout
StephenHodgson Apr 19, 2020
1f2951e
updated foldout label content to include the interface type this conf…
StephenHodgson Apr 19, 2020
c9e0225
updated sdk checkout
StephenHodgson Apr 19, 2020
69bb793
Merge branch 'dev/configuration-foldouts' into fix/camera-system
StephenHodgson Apr 19, 2020
37aaaa5
updated usage with configuration foldout
StephenHodgson Apr 19, 2020
5d0f864
updated oculus checkout
StephenHodgson Apr 20, 2020
2ee12b9
updated oculus and sdk checkouts
StephenHodgson Apr 20, 2020
e407b59
Added platform overrides
StephenHodgson Apr 20, 2020
2912fd4
removed debug
StephenHodgson Apr 20, 2020
d72356b
Merge branch 'dev/platform-overrides' into fix/camera-system
StephenHodgson Apr 20, 2020
189ba64
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 20, 2020
f96b760
updated oculus checkout
StephenHodgson Apr 20, 2020
4220cec
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 22, 2020
4372398
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 22, 2020
9e5f796
updated sdk checkout
StephenHodgson Apr 23, 2020
f5cc4f7
updated oculus checkout and fixed platform definitions for all config…
StephenHodgson Apr 23, 2020
fe26013
Merge branch 'fix/platform-definitions' into fix/camera-system
StephenHodgson Apr 23, 2020
5f5538e
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 23, 2020
67d6fac
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 23, 2020
70a5317
Merge branch 'development' into fix/camera-system
StephenHodgson Apr 23, 2020
d5bd383
used camera parent transform instead of querying for camera system pl…
StephenHodgson Apr 23, 2020
dd3260f
updated submodules
StephenHodgson Apr 23, 2020
f87bf0d
cleaned up docs
StephenHodgson Apr 23, 2020
82befc5
Changed from input system refactor
StephenHodgson Apr 23, 2020
bad525f
Update XRTK-Core/Packages/com.xrtk.core/Inspectors/Profiles/BaseMixed…
StephenHodgson Apr 23, 2020
83612ed
added camera cache fallbacks
StephenHodgson Apr 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Submodules/Lumin
Submodule Lumin updated from 241477 to 982009
2 changes: 1 addition & 1 deletion Submodules/Oculus
2 changes: 1 addition & 1 deletion Submodules/SDK
Submodule SDK updated from 740a34 to b8c90b

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using XRTK.Attributes;
using XRTK.Definitions.Utilities;
using XRTK.Interfaces;
using XRTK.Interfaces.CameraSystem;
using XRTK.Services.CameraSystem;

namespace XRTK.Definitions
namespace XRTK.Definitions.CameraSystem
{
/// <summary>
/// This <see cref="ScriptableObject"/> tells you if your head mounted display (HMD)
/// is a transparent device or an occluded device.
/// Based on those values, you can customize your camera and quality settings.
/// Provides additional configuration options for camera data providers.
/// </summary>
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Camera Profile", fileName = "MixedRealityCameraProfile", order = (int)CreateProfileMenuItemIndices.Camera)]
public class MixedRealityCameraProfile : BaseMixedRealityProfile
public class BaseMixedRealityCameraDataProviderProfile : BaseMixedRealityProfile
{
[SerializeField]
private bool isCameraPersistent = false;
private bool isCameraPersistent = true;

/// <summary>
/// Should the camera be reused in each scene?
/// If so, then the camera's root will be flagged so it is not destroyed when the scene is unloaded.
/// </summary>
public bool IsCameraPersistent => isCameraPersistent;


[SerializeField]
[Tooltip("The near clipping plane distance for an opaque display.")]
private float nearClipPlaneOpaqueDisplay = 0.1f;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using XRTK.Definitions.Utilities;
using XRTK.Interfaces.CameraSystem;

namespace XRTK.Definitions.CameraSystem
{
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Camera System/Data Providers Profile", fileName = "MixedRealityCameraDataProvidersProfile", order = (int)CreateProfileMenuItemIndices.Camera)]
public class MixedRealityCameraDataProvidersProfile : BaseMixedRealityServiceProfile<IMixedRealityCameraDataProvider>
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using XRTK.Attributes;
using XRTK.Definitions.Utilities;
using XRTK.Services.CameraSystem;
using XRTK.Interfaces.CameraSystem;

namespace XRTK.Definitions.CameraSystem
{
/// <summary>
/// This <see cref="BaseMixedRealityProfile"/> tells you if your head mounted display (HMD)
/// is a transparent device or an occluded device.
/// Based on those values, you can customize your camera and quality settings.
/// </summary>
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Camera System Profile", fileName = "MixedRealityCameraSystemProfile", order = (int)CreateProfileMenuItemIndices.Camera)]
public class MixedRealityCameraSystemProfile : BaseMixedRealityProfile
{
[SerializeField]
[Tooltip("The list of registered Camera Data Providers for each platform.")]
private MixedRealityCameraDataProvidersProfile cameraDataProvidersProfile = null;

/// <summary>
/// The The list of registered <see cref="IMixedRealityCameraDataProvider"/>s for each platform.
/// </summary>
public MixedRealityCameraDataProvidersProfile CameraDataProvidersProfile => cameraDataProvidersProfile;

[SerializeField]
private bool isCameraPersistent = false;

/// <summary>
/// Should the camera be reused in each scene?
/// If so, then the camera's root will be flagged so it is not destroyed when the scene is unloaded.
/// </summary>
public bool IsCameraPersistent => isCameraPersistent;

[SerializeField]
[Tooltip("The near clipping plane distance for an opaque display.")]
private float nearClipPlaneOpaqueDisplay = 0.1f;

/// <summary>
/// The near clipping plane distance for an opaque display.
/// </summary>
public float NearClipPlaneOpaqueDisplay
{
get => nearClipPlaneOpaqueDisplay;
internal set => nearClipPlaneOpaqueDisplay = value;
}

[SerializeField]
[Tooltip("Values for Camera.clearFlags, determining what to clear when rendering a Camera for an opaque display.")]
private CameraClearFlags cameraClearFlagsOpaqueDisplay = CameraClearFlags.Skybox;

/// <summary>
/// Values for Camera.clearFlags, determining what to clear when rendering a Camera for an opaque display.
/// </summary>
public CameraClearFlags CameraClearFlagsOpaqueDisplay => cameraClearFlagsOpaqueDisplay;

[SerializeField]
[Tooltip("Background color for a transparent display.")]
private Color backgroundColorOpaqueDisplay = Color.black;

/// <summary>
/// Background color for a transparent display.
/// </summary>
public Color BackgroundColorOpaqueDisplay => backgroundColorOpaqueDisplay;

[SerializeField]
[Tooltip("Set the desired quality for your application for opaque display.")]
private int opaqueQualityLevel = 0;

/// <summary>
/// Set the desired quality for your application for opaque display.
/// </summary>
public int OpaqueQualityLevel => opaqueQualityLevel;

[SerializeField]
[Tooltip("The near clipping plane distance for a transparent display.")]
private float nearClipPlaneTransparentDisplay = 0.85f;

/// <summary>
/// The near clipping plane distance for a transparent display.
/// </summary>
public float NearClipPlaneTransparentDisplay => nearClipPlaneTransparentDisplay;

[SerializeField]
[Tooltip("Values for Camera.clearFlags, determining what to clear when rendering a Camera for an opaque display.")]
private CameraClearFlags cameraClearFlagsTransparentDisplay = CameraClearFlags.SolidColor;

/// <summary>
/// Values for Camera.clearFlags, determining what to clear when rendering a Camera for an opaque display.
/// </summary>
public CameraClearFlags CameraClearFlagsTransparentDisplay => cameraClearFlagsTransparentDisplay;

[SerializeField]
[Tooltip("Background color for a transparent display.")]
private Color backgroundColorTransparentDisplay = Color.clear;

/// <summary>
/// Background color for a transparent display.
/// </summary>
public Color BackgroundColorTransparentDisplay => backgroundColorTransparentDisplay;

[SerializeField]
[Tooltip("Set the desired quality for your application for transparent display.")]
private int transparentQualityLevel = 0;

/// <summary>
/// Set the desired quality for your application for transparent display.
/// </summary>
public int TransparentQualityLevel => transparentQualityLevel;

[SerializeField]
[Tooltip("The concrete type to use for the camera rig.")]
[Implements(typeof(IMixedRealityCameraRig), TypeGrouping.ByNamespaceFlat)]
private SystemType cameraRigType = new SystemType(typeof(DefaultCameraRig));

/// <summary>
/// The concrete type to use for the camera rig.
/// </summary>
public SystemType CameraRigType
{
get => cameraRigType;
internal set => cameraRigType = value;
}

[SerializeField]
[Tooltip("The default head height the rig will start at if a platform doesn't automatically adjust the height for you.")]
private float defaultHeadHeight = 1.6f;

/// <summary>
/// The default head height the rig will start at if a platform doesn't automatically adjust the height for you.
/// </summary>
public float DefaultHeadHeight => defaultHeadHeight;

[SerializeField]
[UnityEngine.Range(0f, 180f)]
[Tooltip("This is the angle that will be used to adjust the player's body rotation in relation to their head position.")]
private float bodyAdjustmentAngle = 60f;

/// <summary>
/// /// This is the angle that will be used to adjust the player's body rotation in relation to their head position.
/// </summary>
public float BodyAdjustmentAngle => bodyAdjustmentAngle;

[SerializeField]
[Tooltip("The speed at which the body transform will sync it's rotation with the head transform.")]
private float bodyAdjustmentSpeed = 1f;

/// <summary>
/// The speed at which the body transform will sync it's rotation with the head transform.
/// </summary>
public float BodyAdjustmentSpeed => bodyAdjustmentSpeed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private static void OffsetJointsRelativeToOpenPosePalmPosition(SimulatedHandCont
/// </summary>
public void ComputeJointPoses(Handedness handedness, Quaternion rotation, Vector3 position, MixedRealityPose[] jointsOut)
{
Quaternion cameraRotation = MixedRealityToolkit.CameraSystem.CameraRig.PlayerCamera.transform.rotation;
Quaternion cameraRotation = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayerCamera.transform.rotation;

for (int i = 0; i < HandData.JointCount; i++)
{
Expand Down Expand Up @@ -185,7 +185,7 @@ public void ComputeJointPoses(Handedness handedness, Quaternion rotation, Vector
public void ParseFromJointPoses(MixedRealityPose[] joints, Handedness handedness, Quaternion rotation, Vector3 position)
{
var invRotation = Quaternion.Inverse(rotation);
var invCameraRotation = Quaternion.Inverse(MixedRealityToolkit.CameraSystem.CameraRig.PlayerCamera.transform.rotation);
var invCameraRotation = Quaternion.Inverse(MixedRealityToolkit.CameraSystem.MainCameraRig.PlayerCamera.transform.rotation);

for (int i = 0; i < HandData.JointCount; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using UnityEngine.Serialization;
using XRTK.Attributes;
using XRTK.Definitions.BoundarySystem;
using XRTK.Definitions.CameraSystem;
using XRTK.Definitions.DiagnosticsSystem;
using XRTK.Definitions.InputSystem;
using XRTK.Definitions.NetworkingSystem;
Expand Down Expand Up @@ -38,7 +40,7 @@ public sealed class MixedRealityToolkitRootProfile : BaseMixedRealityProfile
/// </summary>
public bool IsCameraSystemEnabled
{
get => CameraProfile != null && cameraSystemType != null && cameraSystemType.Type != null && enableCameraSystem;
get => CameraSystemProfile != null && cameraSystemType != null && cameraSystemType.Type != null && enableCameraSystem;
internal set => enableCameraSystem = value;
}

Expand All @@ -57,17 +59,18 @@ public SystemType CameraSystemType
}

[SerializeField]
[Tooltip("Camera profile.")]
private MixedRealityCameraProfile cameraProfile;
[Tooltip("Camera system profile.")]
[FormerlySerializedAs("cameraProfile")]
private MixedRealityCameraSystemProfile cameraSystemProfile;

/// <summary>
/// Profile for customizing your camera and quality settings based on if your
/// head mounted display (HMD) is a transparent device or an occluded device.
/// </summary>
public MixedRealityCameraProfile CameraProfile
public MixedRealityCameraSystemProfile CameraSystemProfile
{
get => cameraProfile;
internal set => cameraProfile = value;
get => cameraSystemProfile;
internal set => cameraSystemProfile = value;
}

#endregion Camera System Properties
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using XRTK.Interfaces;
using XRTK.Interfaces.CameraSystem;

namespace XRTK.Definitions.Utilities
{
Expand Down
Loading