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,128 @@
/************************************************************************************
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 UnityEngine;
using UnityEngine.Assertions;
namespace Oculus.Interaction
{
[ExecuteAlways]
public class DotGridProperties : MonoBehaviour
{
[SerializeField]
private MaterialPropertyBlockEditor _materialPropertyBlockEditor;
[SerializeField]
private int _columns;
[SerializeField]
private int _rows;
[SerializeField]
private float _radius;
[SerializeField]
private Color _color;
public int Columns
{
get
{
return _columns;
}
set
{
_columns = value;
}
}
public int Rows
{
get
{
return _rows;
}
set
{
_rows = value;
}
}
public float Radius
{
get
{
return _radius;
}
set
{
_radius = value;
}
}
public Color Color
{
get
{
return _color;
}
set
{
_color = value;
}
}
private bool _change = false;
private readonly int _colorShaderID = Shader.PropertyToID("_Color");
private readonly int _dimensionsShaderID = Shader.PropertyToID("_Dimensions");
protected virtual void Start()
{
Assert.IsNotNull(_materialPropertyBlockEditor);
_change = true;
}
protected virtual void Update()
{
if (!_change || _materialPropertyBlockEditor == null)
{
return;
}
MaterialPropertyBlock block = _materialPropertyBlockEditor.MaterialPropertyBlock;
block.SetColor(_colorShaderID, _color);
block.SetVector(_dimensionsShaderID, new Vector4((float)_columns, (float)_rows, _radius, 0));
_materialPropertyBlockEditor.UpdateMaterialPropertyBlock();
_change = false;
}
protected virtual void OnValidate()
{
_change = true;
}
#region Inject
public void InjectAllDotGridProperties(MaterialPropertyBlockEditor editor)
{
InjectMaterialPropertyBlockEditor(editor);
}
public void InjectMaterialPropertyBlockEditor(MaterialPropertyBlockEditor editor)
{
_materialPropertyBlockEditor = editor;
}
#endregion
}
}

View File

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

View File

@@ -0,0 +1,139 @@
/************************************************************************************
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;
using UnityEditor;
using UnityEngine;
namespace Oculus.Interaction
{
[Serializable]
public struct MaterialPropertyVector
{
public string name;
public Vector4 value;
}
[Serializable]
public struct MaterialPropertyColor
{
public string name;
public Color value;
}
[Serializable]
public struct MaterialPropertyFloat
{
public string name;
public float value;
}
[ExecuteAlways]
public class MaterialPropertyBlockEditor : MonoBehaviour
{
[SerializeField]
private List<Renderer> _renderers;
[SerializeField]
private List<MaterialPropertyVector> _vectorProperties;
[SerializeField]
private List<MaterialPropertyColor> _colorProperties;
[SerializeField]
private List<MaterialPropertyFloat> _floatProperties;
public List<Renderer> Renderers => _renderers;
public List<MaterialPropertyVector> VectorProperties => _vectorProperties;
public List<MaterialPropertyColor> ColorProperties => _colorProperties;
public List<MaterialPropertyFloat> FloatProperties => _floatProperties;
private MaterialPropertyBlock _materialPropertyBlock = null;
protected virtual void Awake()
{
if (_renderers == null)
{
Renderer renderer = GetComponent<Renderer>();
if (renderer != null)
{
_renderers = new List<Renderer>()
{
renderer
};
}
}
UpdateMaterialPropertyBlock();
}
protected virtual void Start()
{
UpdateMaterialPropertyBlock();
}
public MaterialPropertyBlock MaterialPropertyBlock
{
get
{
if (_materialPropertyBlock == null)
{
_materialPropertyBlock = new MaterialPropertyBlock();
}
return _materialPropertyBlock;
}
}
public void UpdateMaterialPropertyBlock()
{
var materialPropertyBlock = MaterialPropertyBlock;
if (_vectorProperties != null)
{
foreach (var property in _vectorProperties)
{
_materialPropertyBlock.SetVector(property.name, property.value);
}
}
if (_colorProperties != null)
{
foreach (var property in _colorProperties)
{
_materialPropertyBlock.SetColor(property.name, property.value);
}
}
if (_floatProperties != null)
{
foreach (var property in _floatProperties)
{
_materialPropertyBlock.SetFloat(property.name, property.value);
}
}
if (_renderers != null)
{
foreach (Renderer renderer in _renderers)
{
renderer.SetPropertyBlock(materialPropertyBlock);
}
}
}
protected virtual void Update()
{
UpdateMaterialPropertyBlock();
}
}
}

View File

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

View File

@@ -0,0 +1,242 @@
/************************************************************************************
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 UnityEngine;
using UnityEngine.Assertions;
namespace Oculus.Interaction
{
[ExecuteAlways]
public class RoundedBoxProperties : MonoBehaviour
{
[SerializeField]
private MaterialPropertyBlockEditor _editor;
[SerializeField]
private float _width = 1.0f;
[SerializeField]
private float _height = 1.0f;
[SerializeField]
private Color _color = Color.white;
[SerializeField]
private Color _borderColor = Color.black;
[SerializeField]
private float _radiusTopLeft;
[SerializeField]
private float _radiusTopRight;
[SerializeField]
private float _radiusBottomLeft;
[SerializeField]
private float _radiusBottomRight;
[SerializeField]
private float _borderInnerRadius;
[SerializeField]
private float _borderOuterRadius;
#region Properties
public float Width
{
get
{
return _width;
}
set
{
_width = value;
}
}
public float Height
{
get
{
return _height;
}
set
{
_height = value;
}
}
public Color Color
{
get
{
return _color;
}
set
{
_color = value;
}
}
public Color BorderColor
{
get
{
return _borderColor;
}
set
{
_borderColor = value;
}
}
public float RadiusTopLeft
{
get
{
return _radiusTopLeft;
}
set
{
_radiusTopLeft = value;
}
}
public float RadiusTopRight
{
get
{
return _radiusTopRight;
}
set
{
_radiusTopRight = value;
}
}
public float RadiusBottomLeft
{
get
{
return _radiusBottomLeft;
}
set
{
_radiusBottomLeft = value;
}
}
public float RadiusBottomRight
{
get
{
return _radiusBottomRight;
}
set
{
_radiusBottomRight = value;
}
}
public float BorderInnerRadius
{
get
{
return _borderInnerRadius;
}
set
{
_borderInnerRadius = value;
}
}
public float BorderOuterRadius
{
get
{
return _borderOuterRadius;
}
set
{
_borderOuterRadius = value;
}
}
#endregion
private readonly int _colorShaderID = Shader.PropertyToID("_Color");
private readonly int _borderColorShaderID = Shader.PropertyToID("_BorderColor");
private readonly int _radiiShaderID = Shader.PropertyToID("_Radii");
private readonly int _dimensionsShaderID = Shader.PropertyToID("_Dimensions");
protected virtual void Awake()
{
UpdateSize();
UpdateMaterialPropertyBlock();
}
protected virtual void Start()
{
Assert.IsNotNull(_editor);
UpdateSize();
UpdateMaterialPropertyBlock();
}
private void UpdateSize()
{
transform.localScale = new Vector3(_width + _borderOuterRadius * 2,
_height + _borderOuterRadius * 2,
1.0f);
}
private void UpdateMaterialPropertyBlock()
{
if (_editor == null)
{
_editor = GetComponent<MaterialPropertyBlockEditor>();
if (_editor == null)
{
return;
}
}
MaterialPropertyBlock block = _editor.MaterialPropertyBlock;
block.SetColor(_colorShaderID, _color);
block.SetColor(_borderColorShaderID, _borderColor);
block.SetVector(_radiiShaderID,
new Vector4(
_radiusTopRight,
_radiusBottomRight,
_radiusTopLeft,
_radiusBottomLeft
));
block.SetVector(_dimensionsShaderID,
new Vector4(
transform.localScale.x,
transform.localScale.y,
_borderInnerRadius,
_borderOuterRadius
));
_editor.UpdateMaterialPropertyBlock();
}
protected virtual void OnValidate()
{
UpdateSize();
UpdateMaterialPropertyBlock();
}
}
}

View File

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