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,175 @@
/************************************************************************************
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 System.Collections.Generic;
namespace Oculus.Interaction
{
/// <summary>
/// Non-allocating HashSet extension methods mirroring MS implementation
/// https://referencesource.microsoft.com/#system.core/system/Collections/Generic/HashSet.cs
/// </summary>
public static class HashSetExtensions
{
/// <summary>
/// Take the union of this HashSet with other. Modifies this set.
/// </summary>
/// <param name="other">HashSet with items to add</param>
public static void UnionWithNonAlloc<T>(this HashSet<T> hashSetToModify, HashSet<T> other)
{
if (hashSetToModify == null)
{
throw new ArgumentNullException(nameof(hashSetToModify));
}
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
foreach (T item in other)
{
hashSetToModify.Add(item);
}
}
/// <summary>
/// Take the union of this HashSet with other. Modifies this set.
/// </summary>
/// <param name="other">IList with items to add</param>
public static void UnionWithNonAlloc<T>(this HashSet<T> hashSetToModify, IList<T> other)
{
if (hashSetToModify == null)
{
throw new ArgumentNullException(nameof(hashSetToModify));
}
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
for (int i = 0; i < other.Count; ++i)
{
hashSetToModify.Add(other[i]);
}
}
/// <summary>
/// Remove items in other from this set. Modifies this set
/// </summary>
/// <param name="other">HashSet with items to remove</param>
public static void ExceptWithNonAlloc<T>(this HashSet<T> hashSetToModify, HashSet<T> other)
{
if (hashSetToModify == null)
{
throw new ArgumentNullException(nameof(hashSetToModify));
}
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
if (hashSetToModify.Count == 0)
{
return;
}
if (other == hashSetToModify)
{
hashSetToModify.Clear();
return;
}
foreach (T element in other)
{
hashSetToModify.Remove(element);
}
}
/// <summary>
/// Remove items in other from this set. Modifies this set
/// </summary>
/// <param name="other">IList with items to remove</param>
public static void ExceptWithNonAlloc<T>(this HashSet<T> hashSetToModify, IList<T> other)
{
if (hashSetToModify == null)
{
throw new ArgumentNullException(nameof(hashSetToModify));
}
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
if (hashSetToModify.Count == 0)
{
return;
}
for (int i = 0; i < other.Count; ++i)
{
hashSetToModify.Remove(other[i]);
}
}
/// <summary>
/// Checks if this set overlaps other (i.e. they share at least one item)
/// </summary>
/// <param name="other">HashSet to check overlap against</param>
/// <returns>true if these have at least one common element; false if disjoint</returns>
public static bool OverlapsNonAlloc<T>(this HashSet<T> hashSetToCheck, HashSet<T> other)
{
if (hashSetToCheck == null)
{
throw new ArgumentNullException(nameof(hashSetToCheck));
}
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
if (hashSetToCheck.Count == 0)
{
return false;
}
foreach (T element in other)
{
if (hashSetToCheck.Contains(element))
{
return true;
}
}
return false;
}
/// <summary>
/// Checks if this set overlaps other (i.e. they share at least one item)
/// </summary>
/// <param name="other">IList to check overlap against</param>
/// <returns>true if these have at least one common element; false if disjoint</returns>
public static bool OverlapsNonAlloc<T>(this HashSet<T> hashSetToCheck, IList<T> other)
{
if (hashSetToCheck == null)
{
throw new ArgumentNullException(nameof(hashSetToCheck));
}
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
if (hashSetToCheck.Count == 0)
{
return false;
}
for (int i = 0; i < other.Count; ++i)
{
if (hashSetToCheck.Contains(other[i]))
{
return true;
}
}
return false;
}
}
}

View File

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

View File

@@ -0,0 +1,53 @@
/************************************************************************************
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
{
/// <summary>
/// By adding BeginStart and EndStart at the beginning and end of Start, MonoBehaviours with
/// OnEnable and OnDisable logic can wrap their contents within a _started flag and effectively
/// skip over logic in those methods until after Start has been invoked.
///
/// To not bypass the Unity Lifecycle, the enabled property is used to disable the most derived
/// MonoBehaviour, invoke Start up the hierarchy chain, and finally re-enable the MonoBehaviour.
/// </summary>
public static class MonoBehaviourStartExtensions
{
public static void BeginStart(this MonoBehaviour monoBehaviour, ref bool started,
Action baseStart = null)
{
if (!started)
{
monoBehaviour.enabled = false;
started = true;
baseStart?.Invoke();
started = false;
}
else
{
baseStart?.Invoke();
}
}
public static void EndStart(this MonoBehaviour monoBehaviour, ref bool started)
{
if (!started)
{
started = true;
monoBehaviour.enabled = true;
}
}
}
}

View File

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