clean project

This commit is contained in:
Helar Jaadla
2022-03-07 17:52:41 +02:00
parent a174b45bd2
commit cbeb10ec35
5100 changed files with 837159 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using System;
using UnityEngine;
namespace Oculus.Interaction.Input
{
public class Controller :
DataModifier<ControllerDataAsset, ControllerDataSourceConfig>,
IController
{
public Handedness Handedness => Config.Handedness;
public bool IsConnected
{
get
{
var currentData = GetData();
return currentData.IsDataValid && currentData.IsConnected;
}
}
public bool IsPoseValid
{
get
{
var currentData = GetData();
return currentData.IsDataValid &&
currentData.RootPoseOrigin != PoseOrigin.None;
}
}
public bool IsPointerPoseValid
{
get
{
var currentData = GetData();
return currentData.IsDataValid &&
currentData.PointerPoseOrigin != PoseOrigin.None;
}
}
public event Action ControllerUpdated = delegate { };
public bool IsButtonUsageAnyActive(ControllerButtonUsage buttonUsage)
{
var currentData = GetData();
return
currentData.IsDataValid &&
(buttonUsage & currentData.ButtonUsageMask) != 0;
}
public bool IsButtonUsageAllActive(ControllerButtonUsage buttonUsage)
{
var currentData = GetData();
return currentData.IsDataValid &&
(buttonUsage & currentData.ButtonUsageMask) == buttonUsage;
}
/// <summary>
/// Retrieves the current controller pose, in world space.
/// </summary>
/// <param name="pose">Set to current pose if `IsPoseValid`; Pose.identity otherwise</param>
/// <returns>Value of `IsPoseValid`</returns>
public bool TryGetPose(out Pose pose)
{
if (!IsPoseValid)
{
pose = Pose.identity;
return false;
}
pose = Config.TrackingToWorldTransformer.ToWorldPose(GetData().RootPose);
return true;
}
/// <summary>
/// Retrieves the current controller pointer pose, in world space.
/// </summary>
/// <param name="pose">Set to current pose if `IsPoseValid`; Pose.identity otherwise</param>
/// <returns>Value of `IsPoseValid`</returns>
public bool TryGetPointerPose(out Pose pose)
{
if (!IsPointerPoseValid)
{
pose = Pose.identity;
return false;
}
pose = Config.TrackingToWorldTransformer.ToWorldPose(GetData().PointerPose);
return true;
}
public override void MarkInputDataRequiresUpdate()
{
base.MarkInputDataRequiresUpdate();
if (Started)
{
ControllerUpdated();
}
}
protected override void Apply(ControllerDataAsset data)
{
// Default implementation does nothing, to allow instantiation of this modifier directly
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4ae60cfa43388e449a7518f36418f81c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using System;
using UnityEngine;
namespace Oculus.Interaction.Input
{
[Serializable]
public class ControllerDataAsset : ICopyFrom<ControllerDataAsset>
{
public bool IsDataValid;
public bool IsConnected;
public bool IsTracked;
public ControllerButtonUsage ButtonUsageMask;
public Pose RootPose;
public PoseOrigin RootPoseOrigin;
public Pose PointerPose;
public PoseOrigin PointerPoseOrigin;
public void CopyFrom(ControllerDataAsset source)
{
IsDataValid = source.IsDataValid;
IsConnected = source.IsConnected;
IsTracked = source.IsTracked;
CopyPosesAndStateFrom(source);
}
public void CopyPosesAndStateFrom(ControllerDataAsset source)
{
ButtonUsageMask = source.ButtonUsageMask;
RootPose = source.RootPose;
RootPoseOrigin = source.RootPoseOrigin;
PointerPose = source.PointerPose;
PointerPoseOrigin = source.PointerPoseOrigin;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe4ca944e80140841985b0f273793641
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
namespace Oculus.Interaction.Input
{
/// <summary>
/// A set of constants that are passed to each child of a Controller modifier tree from the root DataSource.
/// </summary>
public class ControllerDataSourceConfig
{
public Handedness Handedness { get; set; }
public ITrackingToWorldTransformer TrackingToWorldTransformer { get; set; }
public IDataSource<HmdDataAsset, HmdDataSourceConfig> HmdData { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a1675de914d203a4a910d701ade05ce3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using System;
namespace Oculus.Interaction.Input
{
// Enum containing all values of Unity.XR.CommonUsage.
[Flags]
public enum ControllerButtonUsage
{
None = 0,
PrimaryButton = 1 << 0,
PrimaryTouch = 1 << 1,
SecondaryButton = 1 << 2,
SecondaryTouch = 1 << 3,
GripButton = 1 << 4,
TriggerButton = 1 << 5,
MenuButton = 1 << 6,
Primary2DAxisClick = 1 << 7,
Primary2DAxisTouch = 1 << 8,
Thumbrest = 1 << 9,
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8489868b0a7582e43890f869877224e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,86 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using System;
using UnityEngine;
using UnityEngine.Assertions;
namespace Oculus.Interaction.Input
{
/// <summary>
/// ControllerRef is a utility component that delegates all of its IController implementation
/// to the provided Controller object.
/// </summary>
public class ControllerRef : MonoBehaviour, IController, IActiveState
{
[SerializeField, Interface(typeof(IController))]
private MonoBehaviour _controller;
private IController Controller;
protected virtual void Awake()
{
Controller = _controller as IController;
}
protected virtual void Start()
{
Assert.IsNotNull(Controller);
}
public Handedness Handedness => Controller.Handedness;
public bool IsConnected => Controller.IsConnected;
public bool IsPoseValid => Controller.IsPoseValid;
public event Action ControllerUpdated
{
add => Controller.ControllerUpdated += value;
remove => Controller.ControllerUpdated -= value;
}
public bool Active => IsConnected;
public bool TryGetPose(out Pose pose)
{
return Controller.TryGetPose(out pose);
}
public bool TryGetPointerPose(out Pose pose)
{
return Controller.TryGetPointerPose(out pose);
}
public bool IsButtonUsageAnyActive(ControllerButtonUsage buttonUsage)
{
return Controller.IsButtonUsageAnyActive(buttonUsage);
}
public bool IsButtonUsageAllActive(ControllerButtonUsage buttonUsage)
{
return Controller.IsButtonUsageAllActive(buttonUsage);
}
#region Inject
public void InjectAllControllerRef(IController controller)
{
InjectController(controller);
}
public void InjectController(IController controller)
{
_controller = controller as MonoBehaviour;
Controller = controller;
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3673df66324d8f34d9433049c54de631
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,29 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using System;
using UnityEngine;
namespace Oculus.Interaction.Input
{
public interface IController
{
Handedness Handedness { get; }
bool IsConnected { get; }
bool IsPoseValid { get; }
bool TryGetPose(out Pose pose);
bool TryGetPointerPose(out Pose pose);
bool IsButtonUsageAnyActive(ControllerButtonUsage buttonUsage);
bool IsButtonUsageAllActive(ControllerButtonUsage buttonUsage);
event Action ControllerUpdated;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 77db11dffd48abd4cb96a6076a2a2545
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
namespace Oculus.Interaction.Input
{
public interface IControllerDataModifier
{
void Apply(ControllerDataAsset controllerDataAsset, Handedness handedness);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b392af6b92984f2887f80975b07141ba
timeCreated: 1629344165