diff --git a/.idea/.idea.hankun_unity_packages/.idea/inspectionProfiles/Project_Default.xml b/.idea/.idea.hankun_unity_packages/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..c7fba85
--- /dev/null
+++ b/.idea/.idea.hankun_unity_packages/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/Packages/Extensions/Editor/com.hankun.utilis.editor.asmdef b/Assets/Packages/Extensions/Editor/com.hankun.extension.editor.asmdef
similarity index 100%
rename from Assets/Packages/Extensions/Editor/com.hankun.utilis.editor.asmdef
rename to Assets/Packages/Extensions/Editor/com.hankun.extension.editor.asmdef
diff --git a/Assets/Packages/Extensions/Editor/com.hankun.utilis.editor.asmdef.meta b/Assets/Packages/Extensions/Editor/com.hankun.extension.editor.asmdef.meta
similarity index 100%
rename from Assets/Packages/Extensions/Editor/com.hankun.utilis.editor.asmdef.meta
rename to Assets/Packages/Extensions/Editor/com.hankun.extension.editor.asmdef.meta
diff --git a/Assets/Packages/Extensions/Runtime/com.hankun.utilis.asmdef b/Assets/Packages/Extensions/Runtime/com.hankun.extensions.asmdef
similarity index 100%
rename from Assets/Packages/Extensions/Runtime/com.hankun.utilis.asmdef
rename to Assets/Packages/Extensions/Runtime/com.hankun.extensions.asmdef
diff --git a/Assets/Packages/Extensions/Runtime/com.hankun.utilis.asmdef.meta b/Assets/Packages/Extensions/Runtime/com.hankun.extensions.asmdef.meta
similarity index 100%
rename from Assets/Packages/Extensions/Runtime/com.hankun.utilis.asmdef.meta
rename to Assets/Packages/Extensions/Runtime/com.hankun.extensions.asmdef.meta
diff --git a/Assets/Packages/Utilis/Editor/com.hankun.utilis.editor.asmdef b/Assets/Packages/Utilis/Editor/com.hankun.utilis.editor.asmdef
index e77c285..2ffcb2c 100644
--- a/Assets/Packages/Utilis/Editor/com.hankun.utilis.editor.asmdef
+++ b/Assets/Packages/Utilis/Editor/com.hankun.utilis.editor.asmdef
@@ -1,7 +1,9 @@
{
"name": "com.hankun.utilis.editor",
"rootNamespace": "",
- "references": [],
+ "references": [
+ "GUID:e8b70daea7d4844a1b9bf7448c1d0af9"
+ ],
"includePlatforms": [
"Editor"
],
diff --git a/Assets/Packages/Utilis/Editor/GizmosHelper b/Assets/Packages/Utilis/Runtime/GizmosHelper.cs
similarity index 100%
rename from Assets/Packages/Utilis/Editor/GizmosHelper
rename to Assets/Packages/Utilis/Runtime/GizmosHelper.cs
diff --git a/Assets/Packages/Utilis/Runtime/GizmosHelper.cs.meta b/Assets/Packages/Utilis/Runtime/GizmosHelper.cs.meta
new file mode 100644
index 0000000..383e22b
--- /dev/null
+++ b/Assets/Packages/Utilis/Runtime/GizmosHelper.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 73e7c4a3487ea2d48b37b17dcc855506
\ No newline at end of file
diff --git a/Assets/Packages/Utilis/Runtime/Utilis.cs b/Assets/Packages/Utilis/Runtime/Utilis.cs
new file mode 100644
index 0000000..ad77658
--- /dev/null
+++ b/Assets/Packages/Utilis/Runtime/Utilis.cs
@@ -0,0 +1,266 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+///
+/// Functions from Hurricane Plugin
+///
+public static class Utilis
+{
+ public static float GetSign(this Axis axis)
+ {
+ return axis switch
+ {
+ Axis.X => 1f,
+ Axis.Y => 1f,
+ Axis.Z => 1f,
+ Axis.NegX => -1f,
+ Axis.NegY => -1f,
+ Axis.NegZ => -1f,
+ _ => throw new ArgumentOutOfRangeException($"Cannot get sign from axis, no case for axis={axis}")
+ };
+ }
+
+ public static Vector3 GetVector(this Axis axis)
+ {
+ return axis switch
+ {
+ Axis.X => Vector3.right,
+ Axis.Y => Vector3.up,
+ Axis.Z => Vector3.forward,
+ Axis.NegX => -Vector3.right,
+ Axis.NegY => -Vector3.up,
+ Axis.NegZ => -Vector3.forward,
+ _ => throw new ArgumentOutOfRangeException($"Cannot get vector from axis - no case for axis={axis}")
+ };
+ }
+
+ public static float GetVectorDimension(this Axis axis, Vector3 vector)
+ {
+ return axis switch
+ {
+ Axis.X => vector.x,
+ Axis.Y => vector.y,
+ Axis.Z => vector.z,
+ Axis.NegX => -vector.x,
+ Axis.NegY => -vector.y,
+ Axis.NegZ => -vector.z,
+ _ => throw new ArgumentOutOfRangeException(nameof(axis), axis, null)
+ };
+ }
+
+ public static Vector3 OrthogonalVector(this Vector3 v)
+ {
+ //////https://math.stackexchange.com/questions/137362/how-to-find-perpendicular-vector-to-another-vector
+ v.Normalize();
+
+ float x = v.x;
+ float y = v.y;
+ float z = v.z;
+
+ Vector3 v1 = new(0f, z, -y);
+ Vector3 v2 = new(-z, 0f, x);
+ Vector3 v3 = new(-y, x, 0f);
+ Vector3 largest = v1;
+
+ if (v2.sqrMagnitude > largest.sqrMagnitude)
+ {
+ largest = v2;
+ }
+
+ if (v3.sqrMagnitude > largest.sqrMagnitude)
+ {
+ largest = v3;
+ }
+
+ return largest;
+ }
+ ///
+ /// Returns the angle between two quaternions around a specified axis. Range is 0 to 360.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static float GetAngleDifference(Quaternion qA, Quaternion qB, Vector3 axis)
+ {
+ Vector3 directionA = qA * axis.OrthogonalVector();
+ Vector3 directionB = qB * axis.OrthogonalVector();
+
+ Vector3 projectedA = Vector3.ProjectOnPlane(directionA, axis);
+ Vector3 projectedB = Vector3.ProjectOnPlane(directionB, axis);
+
+ float angle = Vector3.Angle(projectedA, projectedB);
+
+ Vector3 crossProduct = Vector3.Cross(projectedA, projectedB);
+ // convert -180 to 180 to 0 to 360
+ if (Vector3.Dot(crossProduct, axis) < 0)
+ {
+ angle = 360 - angle;
+ }
+
+ return angle;
+ }
+ public static Vector3 FindNearestPointOnLine(Vector3 origin, Vector3 end, Vector3 point)
+ {
+ //Get heading
+ Vector3 heading = (end - origin);
+ float magnitudeMax = heading.magnitude;
+ heading.Normalize();
+
+ //Do projection from the point but clamp it
+ Vector3 lhs = point - origin;
+ float dotP = Vector3.Dot(lhs, heading);
+ dotP = Mathf.Clamp(dotP, 0f, magnitudeMax);
+ return origin + heading * dotP;
+ }
+
+ public static List GetColliders(this GameObject go, bool includedTriggers = false)
+ {
+ return go.GetComponentsInChildren().Where(e => !e.isTrigger || includedTriggers).ToList();
+ }
+
+ public static IEnumerable GetColliders(this Rigidbody rigidbody, bool includeTriggers = false)
+ {
+ return GetColliders(rigidbody, rigidbody.transform, includeTriggers);
+ }
+ private static IEnumerable GetColliders(this Rigidbody rigidbody, Transform transform, bool includeTriggers = false)
+ {
+ Rigidbody rb = transform.GetComponent();
+ if (rb && rb != rigidbody)
+ yield break;
+
+ foreach (Collider c in transform.GetComponents())
+ {
+ if (!c.enabled) continue;
+ if (!c.isTrigger || (c.isTrigger && includeTriggers))
+ yield return c;
+ }
+
+ foreach (Transform child in transform)
+ {
+ foreach (Collider c in GetColliders(rigidbody, child))
+ {
+ yield return c;
+ }
+ }
+ }
+
+ public static Bounds GetColliderBounds(this Rigidbody rb)
+ {
+ var bounds = new Bounds();
+ var first = true;
+ foreach (var collider in rb.GetColliders())
+ {
+ if (first)
+ {
+ first = false;
+ bounds = collider.bounds;
+ }
+ else
+ {
+ bounds.Encapsulate(collider.bounds);
+ }
+ }
+
+ return bounds;
+ }
+
+ public static Bounds GetColliderBounds(this Transform transform)
+ {
+ Collider[] colliders = transform.GetComponents();
+ return colliders.GetColliderBounds();
+ }
+
+ public static Bounds GetColliderBounds(this GameObject go)
+ {
+ Collider[] colliders = go.GetComponents();
+ return colliders.GetColliderBounds();
+ }
+
+ public static Bounds GetColliderBounds(this List colliders)
+ {
+ Bounds bounds = new Bounds();
+ for (int i = 0; i < colliders.Count; i++)
+ {
+ Collider collider = colliders[i];
+ if (i == 0)
+ {
+ bounds = collider.bounds;
+ }
+ else
+ {
+ bounds.Encapsulate(collider.bounds);
+ }
+ }
+
+ return bounds;
+ }
+
+ public static Bounds GetColliderBounds(this Collider[] colliders)
+ {
+ Bounds bounds = new Bounds();
+ bool first = true;
+ for (int i = 0; i < colliders.Length; i++)
+ {
+ Collider collider = colliders[i];
+
+ if (!collider.enabled) continue;
+
+ if (first)
+ {
+ first = false;
+ bounds = collider.bounds;
+ }
+ else
+ {
+ bounds.Encapsulate(collider.bounds);
+ }
+ }
+
+ return bounds;
+ }
+
+ public static void DrawBounds(this Bounds bounds)
+ {
+ Vector3 v3Center = bounds.center;
+ Vector3 v3Extents = bounds.extents;
+
+ var v3FrontTopLeft = new Vector3(v3Center.x - v3Extents.x, v3Center.y + v3Extents.y, v3Center.z - v3Extents.z); // Front top left corner
+ var v3FrontTopRight = new Vector3(v3Center.x + v3Extents.x, v3Center.y + v3Extents.y, v3Center.z - v3Extents.z); // Front top right corner
+ var v3FrontBottomLeft = new Vector3(v3Center.x - v3Extents.x, v3Center.y - v3Extents.y, v3Center.z - v3Extents.z); // Front bottom left corner
+ var v3FrontBottomRight = new Vector3(v3Center.x + v3Extents.x, v3Center.y - v3Extents.y, v3Center.z - v3Extents.z); // Front bottom right corner
+ var v3BackTopLeft = new Vector3(v3Center.x - v3Extents.x, v3Center.y + v3Extents.y, v3Center.z + v3Extents.z); // Back top left corner
+ var v3BackTopRight = new Vector3(v3Center.x + v3Extents.x, v3Center.y + v3Extents.y, v3Center.z + v3Extents.z); // Back top right corner
+ var v3BackBottomLeft = new Vector3(v3Center.x - v3Extents.x, v3Center.y - v3Extents.y, v3Center.z + v3Extents.z); // Back bottom left corner
+ var v3BackBottomRight = new Vector3(v3Center.x + v3Extents.x, v3Center.y - v3Extents.y, v3Center.z + v3Extents.z); // Back bottom right corner
+
+
+ var color = Color.magenta;
+ Debug.DrawLine(v3FrontTopLeft, v3FrontTopRight, color);
+ Debug.DrawLine(v3FrontTopRight, v3FrontBottomRight, color);
+ Debug.DrawLine(v3FrontBottomRight, v3FrontBottomLeft, color);
+ Debug.DrawLine(v3FrontBottomLeft, v3FrontTopLeft, color);
+
+ Debug.DrawLine(v3BackTopLeft, v3BackTopRight, color);
+ Debug.DrawLine(v3BackTopRight, v3BackBottomRight, color);
+ Debug.DrawLine(v3BackBottomRight, v3BackBottomLeft, color);
+ Debug.DrawLine(v3BackBottomLeft, v3BackTopLeft, color);
+
+ Debug.DrawLine(v3FrontTopLeft, v3BackTopLeft, color);
+ Debug.DrawLine(v3FrontTopRight, v3BackTopRight, color);
+ Debug.DrawLine(v3FrontBottomRight, v3BackBottomRight, color);
+ Debug.DrawLine(v3FrontBottomLeft, v3BackBottomLeft, color);
+ }
+}
+
+public enum Axis
+{
+ X,
+ Y,
+ Z,
+ NegX,
+ NegY,
+ NegZ
+}
\ No newline at end of file
diff --git a/Assets/Packages/Utilis/Runtime/Utilis.cs.meta b/Assets/Packages/Utilis/Runtime/Utilis.cs.meta
new file mode 100644
index 0000000..4092497
--- /dev/null
+++ b/Assets/Packages/Utilis/Runtime/Utilis.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: bf2c13ca0cb5676488b29c3dac92f196
\ No newline at end of file
diff --git a/Assets/Packages/Utilis/Runtime/com.hankun.utilis.asmdef b/Assets/Packages/Utilis/Runtime/com.hankun.utilis.asmdef
index 5bccde1..41fe963 100644
--- a/Assets/Packages/Utilis/Runtime/com.hankun.utilis.asmdef
+++ b/Assets/Packages/Utilis/Runtime/com.hankun.utilis.asmdef
@@ -1,3 +1,16 @@
{
- "name": "com.hankun.utilis"
-}
+ "name": "com.hankun.utilis",
+ "rootNamespace": "",
+ "references": [
+ "GUID:e8b70daea7d4844a1b9bf7448c1d0af9"
+ ],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": [],
+ "versionDefines": [],
+ "noEngineReferences": false
+}
\ No newline at end of file
diff --git a/Assets/Packages/Utilis/package.json b/Assets/Packages/Utilis/package.json
index 111aeab..cdcbdac 100644
--- a/Assets/Packages/Utilis/package.json
+++ b/Assets/Packages/Utilis/package.json
@@ -1,11 +1,13 @@
{
"name": "com.hankun.utilis",
- "version": "1.0.3",
+ "version": "1.0.4",
"displayName": "Utilis",
"description": "A collection of useful utilities for Unity development.",
"unity": "2020.3",
"author": {
"name": "hankun",
"email": "kmcyd1@gmail.com"
+ },
+ "dependencies": {
}
}
\ No newline at end of file
diff --git a/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset b/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset
index 36a4c3b..9781b1d 100644
--- a/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset
+++ b/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset
@@ -147,6 +147,7 @@ MonoBehaviour:
m_GeometryUnshadowShader: {fileID: 4800000, guid: 77774d9009bb81447b048c907d4c6273, type: 3}
m_FallOffLookup: {fileID: 2800000, guid: 5688ab254e4c0634f8d6c8e0792331ca, type: 3}
m_CopyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3}
+ m_DefaultCustomMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_DefaultLitMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_DefaultUnlitMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
m_DefaultMaskMaterial: {fileID: 2100000, guid: 15d0c3709176029428a0da2f8cecf0b5, type: 2}
@@ -194,12 +195,12 @@ MonoBehaviour:
dilationShader: {fileID: 7200000, guid: 6bb382f7de370af41b775f54182e491d, type: 3}
subdivideSceneCS: {fileID: 7200000, guid: bb86f1f0af829fd45b2ebddda1245c22, type: 3}
voxelizeSceneShader: {fileID: 4800000, guid: c8b6a681c7b4e2e4785ffab093907f9e, type: 3}
- traceVirtualOffsetCS: {fileID: -6772857160820960102, guid: ff2cbab5da58bf04d82c5f34037ed123, type: 3}
- traceVirtualOffsetRT: {fileID: -5126288278712620388, guid: ff2cbab5da58bf04d82c5f34037ed123, type: 3}
- skyOcclusionCS: {fileID: -6772857160820960102, guid: 5a2a534753fbdb44e96c3c78b5a6999d, type: 3}
- skyOcclusionRT: {fileID: -5126288278712620388, guid: 5a2a534753fbdb44e96c3c78b5a6999d, type: 3}
- renderingLayerCS: {fileID: -6772857160820960102, guid: 94a070d33e408384bafc1dea4a565df9, type: 3}
- renderingLayerRT: {fileID: -5126288278712620388, guid: 94a070d33e408384bafc1dea4a565df9, type: 3}
+ traceVirtualOffsetCS: {fileID: 7200000, guid: 805f10d263aac4b4098c0279cd37a4f3, type: 3}
+ traceVirtualOffsetRT: {fileID: 4807578003741378534, guid: b60511f4aa1443f4d8c0b18f4fec92f4, type: 3}
+ skyOcclusionCS: {fileID: 7200000, guid: 798f52ec82fa04048a12826bbbbcf7b4, type: 3}
+ skyOcclusionRT: {fileID: 4807578003741378534, guid: dfaf42b38dd001f49a72d8102b709f29, type: 3}
+ renderingLayerCS: {fileID: 7200000, guid: a63c9cf933e3d8f41ae680a372784ebf, type: 3}
+ renderingLayerRT: {fileID: 4807578003741378534, guid: c2be09c936362eb49a58f08aeb30627a, type: 3}
- rid: 6852985685364965389
type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
data:
diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json
index 2417962..6a16c47 100644
--- a/Packages/packages-lock.json
+++ b/Packages/packages-lock.json
@@ -10,7 +10,7 @@
"url": "https://packages.unity.com"
},
"com.unity.burst": {
- "version": "1.8.18",
+ "version": "1.8.16",
"depth": 2,
"source": "registry",
"dependencies": {
@@ -27,12 +27,12 @@
"url": "https://packages.unity.com"
},
"com.unity.collections": {
- "version": "2.5.1",
+ "version": "2.4.1",
"depth": 2,
"source": "registry",
"dependencies": {
- "com.unity.burst": "1.8.17",
- "com.unity.test-framework": "1.4.5",
+ "com.unity.burst": "1.8.13",
+ "com.unity.test-framework": "1.4.3",
"com.unity.nuget.mono-cecil": "1.11.4",
"com.unity.test-framework.performance": "3.0.3"
},
@@ -102,7 +102,7 @@
"com.unity.burst": "1.8.14",
"com.unity.mathematics": "1.3.2",
"com.unity.ugui": "2.0.0",
- "com.unity.collections": "2.4.3",
+ "com.unity.collections": "2.4.1",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt
index 4f951fb..1af070b 100644
--- a/ProjectSettings/ProjectVersion.txt
+++ b/ProjectSettings/ProjectVersion.txt
@@ -1,2 +1,2 @@
-m_EditorVersion: 6000.0.25f1
-m_EditorVersionWithRevision: 6000.0.25f1 (4859ab7b5a49)
+m_EditorVersion: 6000.0.9f1
+m_EditorVersionWithRevision: 6000.0.9f1 (1490908003ac)