Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Camera System Refactor (#66)
Browse files Browse the repository at this point in the history
* updated reference

* added WMR Camera Data Provider

* updated WMR Camera Data Provider

* updated camera rig reference

* updated icon

* moved WMR Camera data provider into correct file location

* updated data provider constructors

* added service parent reference

* Added rig reset override

* reverted changes

* removed unused reference

* added camera profile
  • Loading branch information
StephenHodgson authored Apr 23, 2020
1 parent 556f179 commit 2f89d88
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private void UpdateGripData(InteractionSourceState interactionSourceState, Mixed
interactionSourceState.sourcePose.TryGetPosition(out currentGripPosition, InteractionSourceNode.Grip);
interactionSourceState.sourcePose.TryGetRotation(out currentGripRotation, InteractionSourceNode.Grip);

var cameraRig = MixedRealityToolkit.CameraSystem?.CameraRig;
var cameraRig = MixedRealityToolkit.CameraSystem?.MainCameraRig;

if (cameraRig != null &&
cameraRig.PlayspaceTransform != null)
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,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 00d813fd5a164e19a160f322b2926006, type: 3}
m_Name: WindowsMixedRealityCameraProviderProfile
m_EditorClassIdentifier:
isCameraPersistent: 1
nearClipPlaneOpaqueDisplay: 0.1
cameraClearFlagsOpaqueDisplay: 1
backgroundColorOpaqueDisplay: {r: 0, g: 0, b: 0, a: 1}
opaqueQualityLevel: 0
nearClipPlaneTransparentDisplay: 0.85
cameraClearFlagsTransparentDisplay: 2
backgroundColorTransparentDisplay: {r: 0, g: 0, b: 0, a: 0}
transparentQualityLevel: 0
cameraRigType:
reference: XRTK.Services.CameraSystem.DefaultCameraRig, XRTK
defaultHeadHeight: 0
bodyAdjustmentAngle: 60
bodyAdjustmentSpeed: 1

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

8 changes: 8 additions & 0 deletions XRTK.WindowsMixedReality/Packages/com.xrtk.wmr/Runtime.meta

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

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

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,31 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using XRTK.Definitions.CameraSystem;
using XRTK.Interfaces.CameraSystem;
using XRTK.Providers.CameraSystem;

namespace XRTK.WindowsMixedReality.Providers.CameraSystem
{
public class WindowsMixedRealityCameraDataProvider : BaseCameraDataProvider
{
/// <inheritdoc />
public WindowsMixedRealityCameraDataProvider(string name, uint priority, BaseMixedRealityCameraDataProviderProfile profile, IMixedRealityCameraSystem parentService)
: base(name, priority, profile, parentService)
{
}

/// <inheritdoc />
public override bool IsOpaque
{
get
{
#if UNITY_WSA
return UnityEngine.XR.WSA.HolographicSettings.IsDisplayOpaque;
#else
return base.IsOpaque;
#endif
}
}
}
}

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
Expand Up @@ -171,8 +171,8 @@ public HandData GetHandData(SpatialInteractionSourceState spatialInteractionSour

// We want the controller to follow the Playspace, so fold in the playspace transform here to
// put the controller pose into world space.
unityJointPositions[i] = MixedRealityToolkit.CameraSystem.CameraRig.PlayspaceTransform.TransformPoint(unityJointPositions[i]);
unityJointOrientations[i] = MixedRealityToolkit.CameraSystem.CameraRig.PlayspaceTransform.rotation * unityJointOrientations[i];
unityJointPositions[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.TransformPoint(unityJointPositions[i]);
unityJointOrientations[i] = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.rotation * unityJointOrientations[i];

TrackedHandJoint handJoint = jointIndices[i].ToTrackedHandJoint();
updatedHandData.Joints[(int)handJoint] = new MixedRealityPose(unityJointPositions[i], unityJointOrientations[i]);
Expand Down

0 comments on commit 2f89d88

Please sign in to comment.