diff --git a/.gitmodules b/.gitmodules index 2a638f1..3269321 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "CodeProject"] - path = CodeProject - url = git@github.com:mogoson/CodeProject.git +[submodule "MGS.CommonCode"] + path = MGS.CommonCode + url = git@github.com:mogoson/MGS.CommonCode.git diff --git a/Attachment/README_Image/CurveHose/BezierHoseEditor.gif b/Attachment/README_Image/CurveHose/BezierHoseEditor.gif deleted file mode 100644 index 5741a5c..0000000 Binary files a/Attachment/README_Image/CurveHose/BezierHoseEditor.gif and /dev/null differ diff --git a/Attachment/README_Image/CurveHose/CircleHose.gif b/Attachment/README_Image/CurveHose/CircleHose.gif deleted file mode 100644 index db89dad..0000000 Binary files a/Attachment/README_Image/CurveHose/CircleHose.gif and /dev/null differ diff --git a/Attachment/README_Image/CurveHose/EllipseHose.gif b/Attachment/README_Image/CurveHose/EllipseHose.gif deleted file mode 100644 index 55de70f..0000000 Binary files a/Attachment/README_Image/CurveHose/EllipseHose.gif and /dev/null differ diff --git a/Attachment/README_Image/CurveHose/HelixHose.gif b/Attachment/README_Image/CurveHose/HelixHose.gif deleted file mode 100644 index a477bc9..0000000 Binary files a/Attachment/README_Image/CurveHose/HelixHose.gif and /dev/null differ diff --git a/Attachment/README_Image/CurveHose/HermiteHoseEditor.gif b/Attachment/README_Image/CurveHose/HermiteHoseEditor.gif deleted file mode 100644 index 055237f..0000000 Binary files a/Attachment/README_Image/CurveHose/HermiteHoseEditor.gif and /dev/null differ diff --git a/Attachment/README_Image/CurveHose/MachineCable.gif b/Attachment/README_Image/CurveHose/MachineCable.gif deleted file mode 100644 index 12892fc..0000000 Binary files a/Attachment/README_Image/CurveHose/MachineCable.gif and /dev/null differ diff --git a/Attachment/README_Image/CurveHose/SinHose.gif b/Attachment/README_Image/CurveHose/SinHose.gif deleted file mode 100644 index 3a4044b..0000000 Binary files a/Attachment/README_Image/CurveHose/SinHose.gif and /dev/null differ diff --git a/Attachment/images/MonoBezierCurveHose.PNG b/Attachment/images/MonoBezierCurveHose.PNG new file mode 100644 index 0000000..394ebc2 Binary files /dev/null and b/Attachment/images/MonoBezierCurveHose.PNG differ diff --git a/Attachment/images/MonoEllipseCurveHose.PNG b/Attachment/images/MonoEllipseCurveHose.PNG new file mode 100644 index 0000000..cd7206f Binary files /dev/null and b/Attachment/images/MonoEllipseCurveHose.PNG differ diff --git a/Attachment/images/MonoHelixCurveHose.PNG b/Attachment/images/MonoHelixCurveHose.PNG new file mode 100644 index 0000000..c4c0e52 Binary files /dev/null and b/Attachment/images/MonoHelixCurveHose.PNG differ diff --git a/Attachment/images/MonoHermiteCurveHose.PNG b/Attachment/images/MonoHermiteCurveHose.PNG new file mode 100644 index 0000000..cf79436 Binary files /dev/null and b/Attachment/images/MonoHermiteCurveHose.PNG differ diff --git a/Attachment/images/MonoSinCurveHose.PNG b/Attachment/images/MonoSinCurveHose.PNG new file mode 100644 index 0000000..9d87c0b Binary files /dev/null and b/Attachment/images/MonoSinCurveHose.PNG differ diff --git a/Attachment/images/MonoSpringDemo.PNG b/Attachment/images/MonoSpringDemo.PNG new file mode 100644 index 0000000..9744ad3 Binary files /dev/null and b/Attachment/images/MonoSpringDemo.PNG differ diff --git a/CodeProject b/CodeProject deleted file mode 160000 index 950a41f..0000000 --- a/CodeProject +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 950a41f9cff1f23f340cf8f33fb161a4e8085a81 diff --git a/MGS.CommonCode b/MGS.CommonCode new file mode 160000 index 0000000..7b14192 --- /dev/null +++ b/MGS.CommonCode @@ -0,0 +1 @@ +Subproject commit 7b14192a811e4e9253b071e91536a996997994e5 diff --git a/README.md b/README.md index 3497ec6..f3f93e0 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,180 @@ -# MGS-SkinnedMesh +[TOC] -- [Alibaba Cloud](https://www.aliyun.com/minisite/goods?userCode=0fgf4qk9) +# MGS.SkinnedMesh ## Summary -- Unity plugin for create skinned mesh in scene. - -## Demand - -### CurveHose -- Create flexible hose base on bezier curve. -- Create flexible hose base on anchor curve. +- Unity plugin for create skinned mesh in scene. ## Environment -- Unity 5.0 or above. -- .Net Framework 3.5 or above. - -## Achieve - -### CurveHose - -- BezierCurve : Define bezier curve. - -- HermiteCurve : Hermite curve in three dimensional space. - -- EllipseCurve : Ellipse curve. -- HelixCurve : Helix curve. - -- SinCurve : Sin curve. - -- CurveHose : Define CurveHose to render dynamic hose mesh base on - center curve. - -- BezierHose : Render dynamic hose mesh base on cubic bezier curve. - -- HermiteHose : Render dynamic hose mesh base on anchor vector animation - curve. - -- CircleHose : Render dynamic hose mesh base on circle curve. - -- EllipseHose : Render dynamic hose mesh base on ellipse curve. - -- HelixHose : Render dynamic hose mesh base on helix curve. +- .Net Framework 3.5 or above. +- Unity 5.0 or above. -- SinHose : Render dynamic hose mesh base on sin curve. +## Platform + +- Windows + +## Implemented + +```C# +public abstract class MonoSkinnedMesh : MonoBehaviour, ISkinnedMesh{} +public abstract class MonoCurveHose : MonoSkinnedMesh, IMonoCurveHose{} +public class MonoCurveSkinnedHose : MonoCurveHose, IMonoCurveHose{} +public sealed class MeshUtility{} +``` + +## Technology + +### Build Vertices + +```C# +//Create polygon vertices. +var vertices = new List(); +var sector = 2 * Mathf.PI / edge; +var radian = 0f; +for (int i = 0; i <= edge; i++) +{ + radian = sector * i; + vertices.Add(center + rotation * new Vector3(Mathf.Cos(radian), Mathf.Sin(radian)) * radius); +} +return vertices; + +//Create polygon triangles index base on center vertice. +var triangles = new List(); +var offset = clockwise ? 0 : 1; +for (int i = 0; i < edge; i++) +{ + triangles.Add(start + i + offset); + triangles.Add(start + i - offset + 1); + triangles.Add(center); +} +return triangles; + +//Create prism triangles index. +var triangles = new List(); +var polygonVs = polygon + 1; +var currentSegment = 0; +var nextSegment = 0; +for (int s = 0; s < segment - 1; s++) +{ + // Calculate start index. + currentSegment = polygonVs * s; + nextSegment = polygonVs * (s + 1); + for (int p = 0; p < polygon; p++) + { + // Left-Bottom triangle. + triangles.Add(start + currentSegment + p); + triangles.Add(start + currentSegment + p + 1); + triangles.Add(start + nextSegment + p + 1); + + // Right-Top triangle. + triangles.Add(start + currentSegment + p); + triangles.Add(start + nextSegment + p + 1); + triangles.Add(start + nextSegment + p); + } +} +return triangles; + +//Create polygon uv. +var uv = new List(); +var sector = 2 * Mathf.PI / edge; +var radian = 0f; +var center = Vector2.one * 0.5f; +for (int i = 0; i <= edge; i++) +{ + radian = sector * i; + uv.Add(center + new Vector2(Mathf.Cos(radian), Mathf.Sin(radian)) * 0.5f); +} +return uv; + +//Create prism uv. +var uv = new List(); +var polygonVs = polygon + 1; +var vertices = polygonVs * segment; +var slice = 1.0f / polygon; +var u = 0f; +var v = 0f; +for (int i = 0; i < vertices; i++) +{ + u = slice * (i % polygonVs); + v = (i / polygonVs) % 2; + uv.Add(new Vector2(u, v)); +} +return uv; +``` + +### Build Mesh + +```C# +//Rebuild the mesh of hose. +mesh.vertices = CreateVertices(curve, segments, differ, isSeal); +mesh.triangles = CreateTriangles(segments, isSeal); +mesh.uv = CreateUV(segments, isSeal); +mesh.RecalculateNormals(); +mesh.RecalculateBounds(); +``` + +### Shared Mesh + +```C# +meshRenderer.sharedMesh = mesh; +meshRenderer.localBounds = mesh.bounds; +if (meshCollider) +{ + meshCollider.sharedMesh = null; + meshCollider.sharedMesh = mesh; +} +``` + +## Usage + +- Attach mono curve component to a game object. +- Attach mono skinned mesh component to a game object. +- Adjust the args of curve and skinned component or edit curve in scene editor. + +- Adjust the args of curve and Rebuild runtime, and MonoSkinnedMesh will auto Rebuild. + +```C# +var curve = GetComponent(); +curve.AddAnchor(new HermiteAnchor(point)); +curve..Rebuild();//The MonoSkinnedMesh will auto Rebuild. +``` ## Demo -- Demos in the path "MGS-SkinnedMesh/Scenes" provide reference to you. + +- Demos in the path "MGS.Packages/SkinnedMesh/Demo/" provide reference to you. ## Preview -### CurveHose +- MonoHermiteCurveHose -- Bezier Hose Editor +![](.\Attachment\images\MonoHermiteCurveHose.PNG) -![Bezier Hose Editor](./Attachment/README_Image/CurveHose/BezierHoseEditor.gif) +- MonoBezierCurveHose -- Hermite Hose Editor +![](.\Attachment\images\MonoBezierCurveHose.PNG) -![Hermite Hose Editor](./Attachment/README_Image/CurveHose/HermiteHoseEditor.gif) +- MonoHelixCurveHose -- Circle Hose +![](./Attachment/images/MonoHelixCurveHose.png) -![Circle Hose](./Attachment/README_Image/CurveHose/CircleHose.gif) +- MonoEllipseCurveHose -- Ellipse Hose +![](./Attachment/images/MonoEllipseCurveHose.png) -![Ellipse Hose](./Attachment/README_Image/CurveHose/EllipseHose.gif) +- MonoSinCurveHose -- Sin Hose +![](./Attachment/images/MonoSinCurveHose.png) -![Sin Hose](./Attachment/README_Image/CurveHose/SinHose.gif) +- MonoSpringDemo -- Helix Hose +![](./Attachment/images/MonoSpringDemo.png) -![Helix Hose](./Attachment/README_Image/CurveHose/HelixHose.gif) +------ -- Machine Cable +[Previous](../../README.md) -![Machine Cable](./Attachment/README_Image/CurveHose/MachineCable.gif) +------ -## Contact -- If you have any questions, feel free to contact me at mogoson@outlook.com. \ No newline at end of file +Copyright © 2021 Mogoson. mogoson@outlook.com \ No newline at end of file diff --git a/UnityProject/Assets/Editor/MGS/MGS.SkinnedMeshEditor.dll b/UnityProject/Assets/Editor/MGS/MGS.SkinnedMeshEditor.dll deleted file mode 100644 index 39c2a57..0000000 Binary files a/UnityProject/Assets/Editor/MGS/MGS.SkinnedMeshEditor.dll and /dev/null differ diff --git a/UnityProject/Assets/Editor/MGS/MGS.UCommonEditor.dll b/UnityProject/Assets/Editor/MGS/MGS.UCommonEditor.dll deleted file mode 100644 index d820f6d..0000000 Binary files a/UnityProject/Assets/Editor/MGS/MGS.UCommonEditor.dll and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/LICENSE.txt b/UnityProject/Assets/MGS-SkinnedMesh/LICENSE.txt deleted file mode 100644 index 382d00a..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018-2019 Mogoson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/UnityProject/Assets/MGS-SkinnedMesh/LICENSE.txt.meta b/UnityProject/Assets/MGS-SkinnedMesh/LICENSE.txt.meta deleted file mode 100644 index c1ce341..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/LICENSE.txt.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3e08f481f96f6bd419cb6cbfe81f64b9 -timeCreated: 1533323064 -licenseType: Pro -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Side.mat b/UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Side.mat deleted file mode 100644 index 96c33af..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Side.mat and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Yellow.mat.meta b/UnityProject/Assets/MGS-SkinnedMesh/Materials/Yellow.mat.meta deleted file mode 100644 index fb355a5..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Yellow.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: cbf32f1afd53cbb48989bc5ea38f3eb0 -timeCreated: 1521640886 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose.meta b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose.meta deleted file mode 100644 index ac23a0d..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 81d5ecc0082e67d4aaec2b6e6b13d828 -folderAsset: yes -timeCreated: 1585492542 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/BezierHose.prefab b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/BezierHose.prefab deleted file mode 100644 index 4b76620..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/BezierHose.prefab and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/BezierHose.prefab.meta b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/BezierHose.prefab.meta deleted file mode 100644 index 4a7bffe..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/BezierHose.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 97d6a8b7fa62b60498d6b52737a710f3 -timeCreated: 1585492567 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/CircleHose.prefab b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/CircleHose.prefab deleted file mode 100644 index dc2f1b4..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/CircleHose.prefab and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/CircleHose.prefab.meta b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/CircleHose.prefab.meta deleted file mode 100644 index 5e776d3..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/CircleHose.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 216cdfb0e5b3e254897ebc06079e2257 -timeCreated: 1585492582 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/EllipseHose.prefab b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/EllipseHose.prefab deleted file mode 100644 index 8b6d658..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/EllipseHose.prefab and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/EllipseHose.prefab.meta b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/EllipseHose.prefab.meta deleted file mode 100644 index c43e782..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/EllipseHose.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9f173fda0db382d4e8a7fe09917ed1fe -timeCreated: 1585492590 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HelixHose.prefab b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HelixHose.prefab deleted file mode 100644 index a6a9b9d..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HelixHose.prefab and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HelixHose.prefab.meta b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HelixHose.prefab.meta deleted file mode 100644 index 0e56b72..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HelixHose.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 90be16adde8875544818f98c1c1cb67f -timeCreated: 1585492602 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HermiteHose.prefab b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HermiteHose.prefab deleted file mode 100644 index 651b811..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HermiteHose.prefab and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HermiteHose.prefab.meta b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HermiteHose.prefab.meta deleted file mode 100644 index 4b0a982..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/HermiteHose.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d5fd417cb64bacf45b01526b2d7bc212 -timeCreated: 1585492610 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/SinHose.prefab b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/SinHose.prefab deleted file mode 100644 index 1c42790..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/SinHose.prefab and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/SinHose.prefab.meta b/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/SinHose.prefab.meta deleted file mode 100644 index c211aa4..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs/CurveHose/SinHose.prefab.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0d54e88d26d4df54b9f660a116001de0 -timeCreated: 1585492680 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/README.txt b/UnityProject/Assets/MGS-SkinnedMesh/README.txt deleted file mode 100644 index 3a17480..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/README.txt +++ /dev/null @@ -1,59 +0,0 @@ -========================================================================== - Copyright © 2020 Mogoson. All rights reserved. - Name: MGS-SkinnedMesh - Author: Mogoson Version: 1.0.0 Date: 12/27/2020 -========================================================================== - [Summary] - Unity plugin for create skinned mesh in scene. --------------------------------------------------------------------------- - [Environment] - Unity 5.0 or above. - .Net Framework 3.5 or above. --------------------------------------------------------------------------- - [Achieve] - BezierCurve : Define bezier curve. - - HermiteCurve : Hermite curve in three dimensional space. - - EllipseCurve : Ellipse curve. - - HelixCurve : Helix curve. - - SinCurve : Sin curve. - - CurveHose : Define CurveHose to render dynamic hose mesh base on - center curve. - - BezierHose : Render dynamic hose mesh base on cubic bezier curve. - - HermiteHose : Render dynamic hose mesh base on anchor vector animation - curve. - - CircleHose : Render dynamic hose mesh base on circle curve. - - EllipseHose : Render dynamic hose mesh base on ellipse curve. - - HelixHose : Render dynamic hose mesh base on helix curve. - - SinHose : Render dynamic hose mesh base on sin curve. --------------------------------------------------------------------------- - [Usage] - Create an empty gameobject and attach the hose component BezierHose - or HermiteHose to it. - - If BezierHose attached, drag the green sphere to change tangent and - drag the blue sphere to change it's position. - - if HermiteHose attached, drag the blue sphere to change it's position, - press the ALT key and click the green sphere to add anchor, press the - SHIFT key and click the red sphere to remove anchor if you want. --------------------------------------------------------------------------- - [Demo] - Demos in the path "MGS-SkinnedMesh/Scenes" provide reference to you. --------------------------------------------------------------------------- - [Resource] - https://github.com/mogoson/MGS-SkinnedMesh. --------------------------------------------------------------------------- - [Contact] - If you have any questions, feel free to contact me at mogoson@outlook.com. --------------------------------------------------------------------------- \ No newline at end of file diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/BezierHose.unity b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/BezierHose.unity deleted file mode 100644 index 01099b9..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/BezierHose.unity and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/BezierHose.unity.meta b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/BezierHose.unity.meta deleted file mode 100644 index 3f48c4a..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/BezierHose.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d7f01018d22b8104a8751bc74c886290 -timeCreated: 1523893240 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/CircleHose.unity b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/CircleHose.unity deleted file mode 100644 index cbe86d6..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/CircleHose.unity and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/EllipseHose.unity b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/EllipseHose.unity deleted file mode 100644 index a75523f..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/EllipseHose.unity and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HelixHose.unity b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HelixHose.unity deleted file mode 100644 index e2c05e5..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HelixHose.unity and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HermiteHose.unity b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HermiteHose.unity deleted file mode 100644 index 0b072a1..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HermiteHose.unity and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HermiteHose.unity.meta b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HermiteHose.unity.meta deleted file mode 100644 index b9d0c0e..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HermiteHose.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b5d633171cf6c0e49ae112300fc5c027 -timeCreated: 1523892920 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/MachineCable.unity b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/MachineCable.unity deleted file mode 100644 index 328f45d..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/MachineCable.unity and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/SinHose.unity b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/SinHose.unity deleted file mode 100644 index d31a7f6..0000000 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/SinHose.unity and /dev/null differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/SinHose.unity.meta b/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/SinHose.unity.meta deleted file mode 100644 index 8472d28..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/SinHose.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 476c0b3aa0e3ca64bb5c733e6e762725 -timeCreated: 1533323973 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scripts/TestCable.cs b/UnityProject/Assets/MGS-SkinnedMesh/Scripts/TestCable.cs deleted file mode 100644 index bdad00e..0000000 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scripts/TestCable.cs +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* - * Copyright © 2018 Mogoson. All rights reserved. - *------------------------------------------------------------------------ - * File : TestCable.cs - * Description : Test cable example. - *------------------------------------------------------------------------ - * Author : Mogoson - * Version : 0.1.0 - * Date : 3/21/2018 - * Description : Initial development version. - *************************************************************************/ - -using UnityEngine; - -namespace MGS.SkinnedMesh -{ - [AddComponentMenu("MGS/SkinnedMesh/TestCable")] - public class TestCable : MonoBehaviour - { - #region Field and Property - public Transform nozzle; - public float offset = 0.75f; - public float speed = 1.0f; - - public BezierHose cable; - public Transform joint; - public Transform tangent; - - private Vector3 startPoint; - private float currentOffset; - #endregion - - #region Private Method - private void Start() - { - startPoint = nozzle.localPosition; - } - - private void Update() - { - if (Input.GetKey(KeyCode.A)) - { - currentOffset -= speed * Time.deltaTime; - MoveNozzle(); - } - else if (Input.GetKey(KeyCode.D)) - { - currentOffset += speed * Time.deltaTime; - MoveNozzle(); - } - } - - private void MoveNozzle() - { - currentOffset = Mathf.Clamp(currentOffset, -offset, offset); - nozzle.localPosition = startPoint + Vector3.right * currentOffset; - - cable.EndPoint = joint.position; - cable.EndTangentPoint = tangent.position; - cable.Rebuild(); - } - #endregion - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Editor/MGS.meta b/UnityProject/Assets/MGS.Packages.meta similarity index 67% rename from UnityProject/Assets/Editor/MGS.meta rename to UnityProject/Assets/MGS.Packages.meta index 7b0cb82..05a85ab 100644 --- a/UnityProject/Assets/Editor/MGS.meta +++ b/UnityProject/Assets/MGS.Packages.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: edb6fd67a6c26554fa0c96243c1ebaa8 +guid: fadf86322d1680e4691e48d44327ed9f folderAsset: yes -timeCreated: 1558531592 +timeCreated: 1632106321 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/MGS-SkinnedMesh.meta b/UnityProject/Assets/MGS.Packages/Common.meta similarity index 67% rename from UnityProject/Assets/MGS-SkinnedMesh.meta rename to UnityProject/Assets/MGS.Packages/Common.meta index 4ffc5df..5ce4de0 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh.meta +++ b/UnityProject/Assets/MGS.Packages/Common.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 707436039f1d40348bf2e0fc9025ea83 +guid: b6c7b8ff2e922664db414a3e510e701f folderAsset: yes -timeCreated: 1585490832 +timeCreated: 1632228765 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/Editor.meta b/UnityProject/Assets/MGS.Packages/Common/Editor.meta similarity index 67% rename from UnityProject/Assets/Editor.meta rename to UnityProject/Assets/MGS.Packages/Common/Editor.meta index c575195..b47cab0 100644 --- a/UnityProject/Assets/Editor.meta +++ b/UnityProject/Assets/MGS.Packages/Common/Editor.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 2e33e1a11ed596b478e992d4329453f1 +guid: 205d5705b6f312f48b0b45109ada0327 folderAsset: yes -timeCreated: 1558531586 +timeCreated: 1632228766 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/Common/Editor/MGS.UCommonEditor.dll b/UnityProject/Assets/MGS.Packages/Common/Editor/MGS.UCommonEditor.dll new file mode 100644 index 0000000..a7039e5 Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/Common/Editor/MGS.UCommonEditor.dll differ diff --git a/UnityProject/Assets/Editor/MGS/MGS.UCommonEditor.dll.meta b/UnityProject/Assets/MGS.Packages/Common/Editor/MGS.UCommonEditor.dll.meta similarity index 83% rename from UnityProject/Assets/Editor/MGS/MGS.UCommonEditor.dll.meta rename to UnityProject/Assets/MGS.Packages/Common/Editor/MGS.UCommonEditor.dll.meta index 45cac38..dfac1b6 100644 --- a/UnityProject/Assets/Editor/MGS/MGS.UCommonEditor.dll.meta +++ b/UnityProject/Assets/MGS.Packages/Common/Editor/MGS.UCommonEditor.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 5afc97a82670e9b4aacb337c47a19b13 -timeCreated: 1585492039 +guid: 20102bb15cbd6894086dd68df88c5689 +timeCreated: 1632155489 licenseType: Pro PluginImporter: serializedVersion: 1 diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs.meta b/UnityProject/Assets/MGS.Packages/Curve.meta similarity index 67% rename from UnityProject/Assets/MGS-SkinnedMesh/Prefabs.meta rename to UnityProject/Assets/MGS.Packages/Curve.meta index 90c253f..36a03cb 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Prefabs.meta +++ b/UnityProject/Assets/MGS.Packages/Curve.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 2a9a30b86255142499712a2be582d7f4 +guid: 9d79f17456928dd4b9124e8669d30a19 folderAsset: yes -timeCreated: 1585492533 +timeCreated: 1632228765 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/Curve/Editor.meta b/UnityProject/Assets/MGS.Packages/Curve/Editor.meta new file mode 100644 index 0000000..91d1d84 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/Curve/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 33e73c9656412844fb77ecb39701418a +folderAsset: yes +timeCreated: 1632228766 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/Curve/Editor/MGS.MonoCurveEditor.dll b/UnityProject/Assets/MGS.Packages/Curve/Editor/MGS.MonoCurveEditor.dll new file mode 100644 index 0000000..0baf549 Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/Curve/Editor/MGS.MonoCurveEditor.dll differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.dll.meta b/UnityProject/Assets/MGS.Packages/Curve/Editor/MGS.MonoCurveEditor.dll.meta similarity index 83% rename from UnityProject/Assets/Plugins/MGS/MGS.UCurve.dll.meta rename to UnityProject/Assets/MGS.Packages/Curve/Editor/MGS.MonoCurveEditor.dll.meta index b29c26a..aa6aa73 100644 --- a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.dll.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Editor/MGS.MonoCurveEditor.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: f3b127ed4735a29439f2943808343b93 -timeCreated: 1609059740 +guid: 15842118b5b9c52428ea055b55a31398 +timeCreated: 1631368915 licenseType: Pro PluginImporter: serializedVersion: 1 @@ -9,10 +9,10 @@ PluginImporter: isPreloaded: 0 platformData: Any: - enabled: 1 + enabled: 0 settings: {} Editor: - enabled: 0 + enabled: 1 settings: DefaultValueInitialized: true userData: diff --git a/UnityProject/Assets/MGS.Packages/Curve/LICENSE b/UnityProject/Assets/MGS.Packages/Curve/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/Curve/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + 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. diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/CircleHose.unity.meta b/UnityProject/Assets/MGS.Packages/Curve/LICENSE.meta similarity index 63% rename from UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/CircleHose.unity.meta rename to UnityProject/Assets/MGS.Packages/Curve/LICENSE.meta index 3992a09..6fc08db 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/CircleHose.unity.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/LICENSE.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 968fe504535790a4eb502d46acf6ba87 -timeCreated: 1533323628 +guid: 0bde2da59f1ea2143b9f7cc1443160ac +timeCreated: 1630595934 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/Plugins.meta b/UnityProject/Assets/MGS.Packages/Curve/Plugins.meta similarity index 67% rename from UnityProject/Assets/Plugins.meta rename to UnityProject/Assets/MGS.Packages/Curve/Plugins.meta index 1995a72..c328a12 100644 --- a/UnityProject/Assets/Plugins.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: ca660ed3a3322f84d8043efce20ea522 +guid: 97d963061a0b86d43af128dd256f9a6a folderAsset: yes -timeCreated: 1558531600 +timeCreated: 1632228766 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.dll b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.dll new file mode 100644 index 0000000..20db41e Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.dll differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Common.dll.meta b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.dll.meta similarity index 83% rename from UnityProject/Assets/Plugins/MGS/MGS.Common.dll.meta rename to UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.dll.meta index c590dc2..9456227 100644 --- a/UnityProject/Assets/Plugins/MGS/MGS.Common.dll.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 6747296369d7ead4c8a5f7aafa13f431 -timeCreated: 1585491987 +guid: a8118212fc2e09444989c00cc5e4099a +timeCreated: 1631352591 licenseType: Pro PluginImporter: serializedVersion: 1 diff --git a/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.md b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.md new file mode 100644 index 0000000..ec91caf --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.md @@ -0,0 +1,157 @@ +[TOC] + +# MGS.Curve.dll + +## Summary + +- Smooth 3D curve for Unity project develop. + +## Environment + +- .Net Framework 3.5 or above. +- Unity 5.0 or above. + +## Platform + +- Windows + +## Implemented + +```C# +public class SinCurve : ITimeCurve{} +public class EllipseCurve : ITimeCurve{} +public class HelixCurve : ITimeCurve{} +public class BezierCurve : ITimeCurve{} +public class HermiteCurve : ITimeCurve{} +``` + +## Technology + +### Bezier Polynomial + +```C# +return Mathf.Pow(1 - t, 3) * anchor.from + 3 * t * Mathf.Pow(1 - t, 2) * anchor.frTangent +3 * (1 - t) * Mathf.Pow(t, 2) * anchor.toTangent + Mathf.Pow(t, 3) * anchor.to; +``` + +### Hermite Polynomial + +```C# +/* Designed By Mogoson. + * Hermite Polynomial Structure + * Base: H(t) = v0a0(t) + v1a1(t) + m0b0(t) + m1b1(t) + * + * t-t0 t-t1 2 + * a0(t) = (1+2------)(------) + * t1-t0 t0-t1 + * + * t-t1 t-t0 2 + * a1(t) = (1+2------)(------) + * t0-t1 t1-t0 + * + * t-t1 2 + * b0(t) = (t-t0)(------) + * t0-t1 + * + * t-t0 2 + * b1(t) = (t-t1)(------) + * t1-t0 + * + * Let: d0 = t-t0, d1 = t-t1, d = t0-t1 + * + * d0 d1 + * q0 = ---- , q1 = ---- + * d d + * + * t-t1 2 d1 2 2 t-t0 2 d0 2 2 + * p0 = (------) = (----) = q1 , p1 = (------) = (----) = q0 + * t0-t1 d t1-t0 -d + * + * Get: H(t) = (1-2q0)v0p0 + (1+2q1)v1p1 + mod0p0 + m1d1p1 + */ + +var d0 = t - t0; +var d1 = t - t1; +var d = t0 - t1; + +var q0 = d0 / d; +var q1 = d1 / d; + +var p0 = q1 * q1; +var p1 = q0 * q0; + +return (1 - 2 * q0) * v0 * p0 + (1 + 2 * q1) * v1 * p1 + m0 * d0 * p0 + m1 * d1 * p1; +``` + +### Tangent Smooth + +```C# +//Designed By Mogoson. +KeyFrame k0, k1, k2; +if (index == 0 || index == frames.Count - 1) +{ + if (frames[0].value != frames[frames.Count - 1].value) + { + var frame = frames[index]; + frame.inTangent = frame.outTangent = Vector3.zero; + frames[index] = frame; + return; + } + + k0 = frames[frames.Count - 2]; + k1 = frames[index]; + k2 = frames[1]; + + if (index == 0) + { + k0.time -= frames[frames.Count - 1].time; + } + else + { + k2.time += frames[frames.Count - 1].time; + } +} +else +{ + k0 = frames[index - 1]; + k1 = frames[index]; + k2 = frames[index + 1]; +} + +var weight01 = (1 + weight) / 2; +var weight12 = (1 - weight) / 2; +var t01 = (k1.value - k0.value) / (k1.time - k0.time); +var t12 = (k2.value - k1.value) / (k2.time - k1.time); +k1.inTangent = k1.outTangent = t01 * weight01 + t12 * weight12; +frames[index] = k1; +``` + +## Usage + +- New a Curve and Set Args. + +```C# +var curve = new HermiteCurve(); +curve.AddFrames(frames); +curve.SmoothTangents();//If need SmoothTangents Auto. +``` + +- Evaluate the curve at time. + +```C# +var p0 = curve.Evaluate(frames[0].time); +for (float t = frames[0].time; t < frames[frames.Length - 1].time; t += delta) +{ + var p1 = curve.Evaluate(t); + //Just for demo, you can use p0,p1 to do more things. + Gizmos.DrawLine(transform.TransformPoint(p0), transform.TransformPoint(p1)); + p0 = p1; +} +``` + +------ + +[Previous](../../README.md) + +------ + +Copyright © 2021 Mogoson. mogoson@outlook.com \ No newline at end of file diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/EllipseHose.unity.meta b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.md.meta similarity index 63% rename from UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/EllipseHose.unity.meta rename to UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.md.meta index e8c05ac..7085ff9 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/EllipseHose.unity.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.md.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: b6e103a9e6ce1614db6712ae211733cf -timeCreated: 1533323876 +guid: d61a53748171a0d4d84fc9f2d90bb4d2 +timeCreated: 1631550928 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.xml b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.xml new file mode 100644 index 0000000..3c02621 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.xml @@ -0,0 +1,450 @@ + + + + MGS.Curve + + + + + Cubic bezier curve. + + + + + Anchor settings of curve. + + + + + Constructor. + + + + + Constructor. + + Anchor settings of curve. + + + + Evaluate the curve at t. + + + + + + + Evaluate the curve at anchor and time. + + + + + + + + Anchor settings of cubic bezier curve. + + + + + From point of anchor. + + + + + To point of anchor. + + + + + From tangent point of anchor. + + + + + To tangent point of anchor. + + + + + Constructor. + + From point of anchor. + To point of anchor. + From tangent point of anchor. + To tangent point of anchor. + + + + Ellipse curve. + + + + + Args of curve. + + + + + Constructor. + + + + + Constructor. + + Args of ellipse curve. + + + + Evaluate the curve at radian. + + Around radian. + + + + + Evaluate the curve at radian. + + + Radian. + + + + + Evaluate the curve at radian. + + + + + + + + + Args of ellipse. + + + + + Semi minor axis of ellipse. + + + + + Semi major axis of ellipse. + + + + + Constructor. + + Semi minor axis of ellipse. + Semi major axis of ellipse. + + + + Helix curve. + + + + + Args of curve lerp from. + + + + + Args of curve lerp to. + + + + + Altitude from bottom to top. + + + + + Around radian. + + + + + Constructor. + + + + + Constructor. + + Args of curve lerp from. + Args of curve lerp to. + + + + Evaluate the curve at t. + + + + + + + Evaluate the curve at radian and t. + + + + + + + + + + Hermite curve + + + + + Indexer. + + Index of key frame. + The key frame at index. + + + + Key frames of curve. + + + + + Count of key frames. + + + + + Constructor. + + + + + Constructor. + + Key frames of curve. + + + + Add key frame to curve. + + Key frame to add. + + + + Add key frame to curve. + + Key of frame. + Point of frame. + + + + Add key frames to curve. + + + + + + Remove key frame. + + Key frame to remove. + + + + Remove key frame at index. + + Index of frame. + + + + Clear frames. + + + + + Smooth in and out tangents. + + + + + + Smooth in and out tangents. + + + + + + + Evaluate the curve at t. + + + + + + + Evaluate the value of hermite curve at time. + + Key frames of hermite curve. + + The value of hermite curve at time. + + + + Evaluate the value of hermite curve at time on the range from start key frame to end key frame. + + Start Key frame of hermite curve. + End Key frame of hermite curve. + Time of curve to evaluate value. + The value of hermite curve at time on the range from start key frame to end key frame. + + + + Hermite interpolate between t0 and t1 by t. + + Time of t0. + Value of t0. + Micro quotient value of t0. + Time of t1. + Value of t1. + Micro quotient value of t1. + t is between t0 and t1. + + + + + Key frame base on time and value. + + + + + Time of frame. + + + + + Point of frame. + + + + + In tangent vector based on point. + + + + + Out tangent vector based on point. + + + + + Constructor. + + Time of frame. + Point of frame. + + + + Constructor. + + Time of frame. + Point of frame. + In tangent of frame. + Out tangent of frame. + + + + Interface of curve. + + + + + Interface of time curve. + + + + + Evaluate the curve at time. + + The time within the curve you want to evaluate (the horizontal axis in the curve graph). + The value of the curve, at the point in time specified. + + + + Sin curve. + + + + + Args of curve. + + + + + Constructor. + + + + + Constructor. + + Args of curve. + + + + Evaluate the curve at x. + + + + + + + Evaluate the curve at x. + + + + + + + + Evaluate the curve at x. + + Amplitude. + Angular. + Initial phase. + + + + + + Args of sin. + + + + + Amplitude of sin. + + + + + Angular of sin. + + + + + Initial phase of sin. + + + + + Constructor. + + Amplitude of sin. + Angular of sin. + Initial phase of sin. + + + diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Common.xml.meta b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.xml.meta similarity index 64% rename from UnityProject/Assets/Plugins/MGS/MGS.Common.xml.meta rename to UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.xml.meta index 4ea8e50..787bf48 100644 --- a/UnityProject/Assets/Plugins/MGS/MGS.Common.xml.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.Curve.xml.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: d45a60bbd1879ac44943428f6a391ec8 -timeCreated: 1609059932 +guid: dc535460c63704248807ae2f130c7207 +timeCreated: 1631352591 licenseType: Pro TextScriptImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.dll b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.dll new file mode 100644 index 0000000..907d879 Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.dll differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Logger.dll.meta b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.dll.meta similarity index 83% rename from UnityProject/Assets/Plugins/MGS/MGS.Logger.dll.meta rename to UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.dll.meta index 09e57ac..2084079 100644 --- a/UnityProject/Assets/Plugins/MGS/MGS.Logger.dll.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: c64f37ca65772ed468fb7da5b37dc0a9 -timeCreated: 1609059737 +guid: 47e861afb54dd8e489947ee35caa3f72 +timeCreated: 1631368857 licenseType: Pro PluginImporter: serializedVersion: 1 diff --git a/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.md b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.md new file mode 100644 index 0000000..1075050 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.md @@ -0,0 +1,153 @@ +[TOC] + +# MGS.MonoCurve.dll + +## Summary + +- Smooth 3D curve component for Unity project develop. + +## Environment + +- .Net Framework 3.5 or above. +- Unity 5.0 or above. + +## Platform + +- Windows + +## Implemented + +```C# +public abstract class MonoCurve : MonoBehaviour, IMonoCurve +public class MonoSinCurve : MonoCurve{} +public class MonoEllipseCurve : MonoCurve{} +public class MonoHelixCurve : MonoCurve{} +public class MonoBezierCurve : MonoCurve{} +public class MonoHermiteCurve : MonoCurve{} + +public abstract class MonoCurveRenderer : MonoBehaviour, IMonoCurveRenderer{} +public class MonoCurveLineRenderer : MonoCurveRenderer{} +``` + +## Technology + +### Transform + +```C# +//World to local position. +return transform.TransformPoint(worldPos); +//Local to world position. +transform.InverseTransformPoint(localPos); + +//World to local vector. +return transform.TransformPoint(worldVector); +//Local to world vector. +transform.InverseTransformPoint(localVector); +``` + +### Differentiation + +```C# +//AwayFromZero means that 12.5 -> 13 +var units = (int)Math.Round(curve.Length * detail.unit, MidpointRounding.AwayFromZero); +var count = Mathf.Clamp(units, detail.min, detail.max); +differ = curve.Length / count; +return count; +``` + +### Calculus + +```C# +//Evaluate length of MonoSinCurve. +var halfPI = Mathf.PI * 0.5f; +var angularAbs = Mathf.Abs(args.angular); +var piece = Vector2.Distance(Vector2.zero, new Vector2(halfPI / angularAbs, args.amplitude)); +var pieces = piece * angularAbs; +var segments = Mathf.RoundToInt(radian / halfPI); +return pieces * segments; + +//Evaluate length of MonoEllipseCurve. +var ratio = Mathf.Abs(radian) / (Mathf.PI * 2); +if (args.semiMinorAxis == 0 || args.semiMajorAxis == 0) +{ + return 2 * Mathf.Abs(args.semiMinorAxis + args.semiMajorAxis) * ratio; +} +var minor = Mathf.Abs(args.semiMinorAxis); +var major = Mathf.Abs(args.semiMajorAxis); +var a = Mathf.Max(minor, major); +var b = Mathf.Min(minor, major); +return (2 * Mathf.PI * b + 4 * (a - b)) * ratio; + +//Evaluate length of MonoHelixCurve, MonoBezierCurve and MonoHermiteCurve. +var length = 0f; +var t = 0f; +var p0 = EvaluateNormalized(t); +while (t < 1.0f) +{ + t = Mathf.Min(t + differ, 1.0f); + var p1 = EvaluateNormalized(t); + length += Vector3.Distance(p0, p1); + p0 = p1; +} +return length; +``` + +## Usage + +- Attach mono curve component to a game object. +- Adjust the args of curve component or edit curve in scene editor. + +```tex +Select the MonoBezierCurve and drag the handle to adjust the anchor to see effect. +Press and hold the ALT into Tangent Edit mode, drag the handle to adjust the tangent of anchor. +If the start and end points are close, they will stick together. + +Select the MonoHermiteCurve and drag the handle to adjust the anchor to see effect. +Press and hold the CTRL, click the green handle to add a new anchor. +Press and hold the CTRL+SHIFT, click the red handle to remove a anchor. +If do not use Auto Smooth, +Press and hold the ALT, click the blue handle to open Tangent editor and drag the + cyan handle to adjust the tangent of anchor; on this mode, Press and hold the SHIFT + to open In and Out tangent editor, drag the cyan and green handle to adjust the + tangents of anchor. +Press and hold the ALT+COMMAND into All Tangents mode. +If the start and end points are close, they will stick together. +``` + +- Attach mono curve renderer component to the mono curve game object to renderer curve in scene. + +- Evaluate point on the mono curve. + +```C# +//Evaluate point on the mono curve at length. +var len = 0f; +var p0 = curve.Evaluate(len); +while (len < curve.Length) +{ + len = Mathf.Min(len + 0.01f, curve.Length); + var p1 = curve.Evaluate(len); + //Just for demo, you can use p0,p1 to do more things. + Gizmos.DrawLine(p0, p1); + p0 = p1; +} + +//Evaluate point on the mono curve at normalized time int the range[0,1]. +var t = 0f; +var p0 = curve.EvaluateNormalized(t); +while (t < 1.0f) +{ + t = Mathf.Min(t + differ, 1.0f); + var p1 = curve.EvaluateNormalized(t); + //Just for demo, you can use p0,p1 to do more things. + Gizmos.DrawLine(p0, p1); + p0 = p1; +} +``` + +------ + +[Previous](../../README.md) + +------ + +Copyright © 2021 Mogoson. mogoson@outlook.com \ No newline at end of file diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HelixHose.unity.meta b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.md.meta similarity index 63% rename from UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HelixHose.unity.meta rename to UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.md.meta index 9028104..419bcf5 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/HelixHose.unity.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.md.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: e58349b9917351a48a5d4a7eb8d401d7 -timeCreated: 1533324160 +guid: 282ad4bda6fc9a24bbaa0acf5547f465 +timeCreated: 1631550932 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.xml b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.xml new file mode 100644 index 0000000..f1f634e --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.xml @@ -0,0 +1,585 @@ + + + + MGS.MonoCurve + + + + + Mono curve base on cubic bezier curve. + + + + + Anchor points of mono curve. + + + + + From point of anchor. + + + + + To point of anchor. + + + + + From tangent vector based on point. + + + + + To tangent vector based on point. + + + + + Mono curve is close? + + + + + Length of mono curve. + + + + + Length of mono curve. + + + + + Curve for mono curve. + + + + + Curve of mono curve. + + + + + Rebuild mono curve. + + + + + Mono curve base on ellipse curve. + + + + + Args of ellipse mono curve. + + + + + radian of ellipse mono curve. + + + + + Length of mono curve. + + + + + Length of mono curve. + + + + + Curve for mono curve. + + + + + Curve of mono curve. + + + + + Rebuild mono curve. + + + + + Evaluate local point on mono curve at normalized time int the range[0,1]. + + The normalized time. + The value of the curve, at the point in time specified. + + + + Evaluate length of mono curve. + + + + + + Mono curve base on helix curve. + + + + + From ellipse args of curve. + + + + + To ellipse args of curve. + + + + + Altitude from bottom to top. + + + + + Around radian. + + + + + Length of mono curve. + + + + + Length of mono curve. + + + + + Curve for mono curve. + + + + + Curve of mono curve. + + + + + Rebuild mono curve. + + + + + Mono curve base on anchors. + + + + + Mono curve is auto smooth? + + + + + Anchors of mono curve. + + + + + Count of mono curve anchors. + + + + + Mono curve is close? + + + + + Length of mono curve. + + + + + Length of mono curve. + + + + + Curve for mono curve. + + + + + Curve of mono curve. + + + + + Rebuild mono curve. + + + + + Evaluate local point on mono curve at normalized time int the range[0,1]. + + The normalized time. + The value of the curve, at the point in time specified. + + + + Add anchor item. + + Anchor item. + + + + Insert Anchor item at index. + + Index of anchor. + Anchor item. + + + + Set the anchor item at index. + + Index of anchor. + Anchor item. + + + + Get the anchor item at index. + + Anchor index. + Anchor item. + + + + Remove the anchor item. + + Anchor item. + + + + Remove the anchor item at index. + + Anchor index. + + + + Clear all anchor items. + + + + + Inverse transform anchor. + + + + + + + Transform anchor. + + + + + + + Inverse anchor tangents from HermiteCurve. + (Require the anchors is already build to the curve) + + + + + Anchor settings of hermite curve. + + + + + Point of anchor. + + + + + In tangent vector based on point. + + + + + Out tangent vector based on point. + + + + + Constructor. + + Point of anchor. + + + + Constructor. + + Point of anchor. + In tangent vector based on anchor point. + Out tangent vector based on anchor point. + + + + Interface of mono curve. + + + + + Length of mono curve. + + + + + Rebuild mono curve. + + + + + Evaluate point on mono curve at length. + + + + + + + Evaluate point on mono curve at normalized time int the range[0,1]. + + The normalized time. + The value of the curve, at the point in time specified. + + + + Evaluate local point on mono curve at length. + + + + + + + Evaluate local point on mono curve at normalized time int the range[0,1]. + + The normalized time. + The value of the curve, at the point in time specified. + + + + Mono curve base on curve. + + + + + Length of mono curve. + + + + + Curve for mono curve. + + + + + Reset component. + + + + + Awake component. + + + + + Rebuild mono curve. + + + + + Evaluate point on mono curve at length. + + + + + + + Evaluate point on mono curve at normalized time int the range[0,1]. + + The normalized time. + The value of the curve, at the point in time specified. + + + + Evaluate local point on mono curve at length. + + + + + + + Evaluate local point on mono curve at normalized time int the range[0,1]. + + The normalized time. + The value of the curve, at the point in time specified. + + + + Evaluate length of mono curve. + + Differentiation. + + + + + Mono curve base on sin curve. + + + + + Args of sin mono curve. + + + + + radian of sin mono curve. + + + + + Length of mono curve. + + + + + Length of mono curve. + + + + + Curve for mono curve. + + + + + Curve of mono curve. + + + + + Rebuild mono curve. + + + + + Evaluate local point on mono curve at normalized time int the range[0,1]. + + The normalized time. + The value of the curve, at the point in time specified. + + + + Evaluate length of mono curve. + + + + + + Renderer for mono curve. + + + + + Detail length for renderer. + + + + + Segment length of mono curve. + + + + + Renderer component. + + + + + Reset component. + + + + + [MESSAGE] On mono curve rebuild. + + + + + + Rebuild renderer base curve. + + + + + + Interface of renderer that base on mono curve. + + + + + Renderer component. + + + + + Segment length of mono curve. + + + + + Rebuild renderer base mono curve. + + + + + + Line renderer for mono curve. + + + + + Renderer component. + + + + + Renderer component. + + + + + Reset component. + + + + + Rebuild renderer base curve. + + + + + + Utility for mono curve. + + + + + Get segment count of mono curve. + + + + Differentiation. + Detail count of mono curve. + + + diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Logger.xml.meta b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.xml.meta similarity index 64% rename from UnityProject/Assets/Plugins/MGS/MGS.Logger.xml.meta rename to UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.xml.meta index 0f9d276..5df911d 100644 --- a/UnityProject/Assets/Plugins/MGS/MGS.Logger.xml.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.xml.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: a3d023aafe9c67e4fb91f26be5527b77 -timeCreated: 1609059931 +guid: 2f4926ae088884541be76c42f4e0d120 +timeCreated: 1631368917 licenseType: Pro TextScriptImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/Curve/README.md b/UnityProject/Assets/MGS.Packages/Curve/README.md new file mode 100644 index 0000000..9be3116 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/Curve/README.md @@ -0,0 +1,157 @@ +[TOC] + +# MGS.MonoCurve + +## Summary + +- Smooth 3D curve component for Unity project develop. + +## Environment + +- .Net Framework 3.5 or above. +- Unity 5.0 or above. + +## Platform + +- Windows + +## Implemented + +```C# +public abstract class MonoCurve : MonoBehaviour, IMonoCurve +public class MonoSinCurve : MonoCurve{} +public class MonoEllipseCurve : MonoCurve{} +public class MonoHelixCurve : MonoCurve{} +public class MonoBezierCurve : MonoCurve{} +public class MonoHermiteCurve : MonoCurve{} + +public abstract class MonoCurveRenderer : MonoBehaviour, IMonoCurveRenderer{} +public class MonoCurveLineRenderer : MonoCurveRenderer{} +``` + +## Technology + +### Transform + +```C# +//World to local position. +return transform.TransformPoint(worldPos); +//Local to world position. +transform.InverseTransformPoint(localPos); + +//World to local vector. +return transform.TransformPoint(worldVector); +//Local to world vector. +transform.InverseTransformPoint(localVector); +``` + +### Differentiation + +```C# +//AwayFromZero means that 12.5 -> 13 +var units = (int)Math.Round(curve.Length * detail.unit, MidpointRounding.AwayFromZero); +var count = Mathf.Clamp(units, detail.min, detail.max); +differ = curve.Length / count; +return count; +``` + +### Calculus + +```C# +//Evaluate length of MonoSinCurve. +var halfPI = Mathf.PI * 0.5f; +var angularAbs = Mathf.Abs(args.angular); +var piece = Vector2.Distance(Vector2.zero, new Vector2(halfPI / angularAbs, args.amplitude)); +var pieces = piece * angularAbs; +var segments = Mathf.RoundToInt(radian / halfPI); +return pieces * segments; + +//Evaluate length of MonoEllipseCurve. +var ratio = Mathf.Abs(radian) / (Mathf.PI * 2); +if (args.semiMinorAxis == 0 || args.semiMajorAxis == 0) +{ + return 2 * Mathf.Abs(args.semiMinorAxis + args.semiMajorAxis) * ratio; +} +var minor = Mathf.Abs(args.semiMinorAxis); +var major = Mathf.Abs(args.semiMajorAxis); +var a = Mathf.Max(minor, major); +var b = Mathf.Min(minor, major); +return (2 * Mathf.PI * b + 4 * (a - b)) * ratio; + +//Evaluate length of MonoHelixCurve, MonoBezierCurve and MonoHermiteCurve. +var length = 0f; +var t = 0f; +var p0 = EvaluateNormalized(t); +while (t < 1.0f) +{ + t = Mathf.Min(t + differ, 1.0f); + var p1 = EvaluateNormalized(t); + length += Vector3.Distance(p0, p1); + p0 = p1; +} +return length; +``` + +## Usage + +- Attach mono curve component to a game object. +- Adjust the args of curve component or edit curve in scene editor. + +```tex +Select the MonoBezierCurve and drag the handle to adjust the anchor to see effect. +Press and hold the ALT into Tangent Edit mode, drag the handle to adjust the tangent of anchor. +If the start and end points are close, they will stick together. + +Select the MonoHermiteCurve and drag the handle to adjust the anchor to see effect. +Press and hold the CTRL, click the green handle to add a new anchor. +Press and hold the CTRL+SHIFT, click the red handle to remove a anchor. +If do not use Auto Smooth, +Press and hold the ALT, click the blue handle to open Tangent editor and drag the + cyan handle to adjust the tangent of anchor; on this mode, Press and hold the SHIFT + to open In and Out tangent editor, drag the cyan and green handle to adjust the + tangents of anchor. +Press and hold the ALT+COMMAND into All Tangents mode. +If the start and end points are close, they will stick together. +``` + +- Attach mono curve renderer component to the mono curve game object to renderer curve in scene. + +- Evaluate point on the mono curve. + +```C# +//Evaluate point on the mono curve at length. +var len = 0f; +var p0 = curve.Evaluate(len); +while (len < curve.Length) +{ + len = Mathf.Min(len + 0.01f, curve.Length); + var p1 = curve.Evaluate(len); + //Just for demo, you can use p0,p1 to do more things. + Gizmos.DrawLine(p0, p1); + p0 = p1; +} + +//Evaluate point on the mono curve at normalized time int the range[0,1]. +var t = 0f; +var p0 = curve.EvaluateNormalized(t); +while (t < 1.0f) +{ + t = Mathf.Min(t + differ, 1.0f); + var p1 = curve.EvaluateNormalized(t); + //Just for demo, you can use p0,p1 to do more things. + Gizmos.DrawLine(p0, p1); + p0 = p1; +} +``` + +## Demo + +- Demos in the path "MGS.Packages/Curve/Demo/" provide reference to you. + +## Source + +- https://github.com/mogoson/MGS.MonoCurve. + +------ + +Copyright © 2021 Mogoson. mogoson@outlook.com \ No newline at end of file diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/MachineCable.unity.meta b/UnityProject/Assets/MGS.Packages/Curve/README.md.meta similarity index 63% rename from UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/MachineCable.unity.meta rename to UnityProject/Assets/MGS.Packages/Curve/README.md.meta index b6d5c9c..e437ee6 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose/MachineCable.unity.meta +++ b/UnityProject/Assets/MGS.Packages/Curve/README.md.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 8998686cfa19fa2458534b6631ae7b6d -timeCreated: 1521639719 +guid: 00a13418308ab624f84b7bc0eca2c8be +timeCreated: 1631550986 licenseType: Pro DefaultImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/README.txt b/UnityProject/Assets/MGS.Packages/README.txt new file mode 100644 index 0000000..b022e7f --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/README.txt @@ -0,0 +1,2 @@ +The files in the Demo directory just for demo; +You can remove the Demo directory after you understand. \ No newline at end of file diff --git a/UnityProject/Assets/MGS-SkinnedMesh/README.txt.meta b/UnityProject/Assets/MGS.Packages/README.txt.meta similarity index 64% rename from UnityProject/Assets/MGS-SkinnedMesh/README.txt.meta rename to UnityProject/Assets/MGS.Packages/README.txt.meta index e4058f2..d3fcf85 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/README.txt.meta +++ b/UnityProject/Assets/MGS.Packages/README.txt.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: ce90582e85de6c4418076c7f0a436f0e -timeCreated: 1521989038 +guid: 04278f1beb7229f45a125280f70e696d +timeCreated: 1630596261 licenseType: Pro TextScriptImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh.meta new file mode 100644 index 0000000..47fde24 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 37337f3c050ac204fafffbcba822742f +folderAsset: yes +timeCreated: 1632106250 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo.meta new file mode 100644 index 0000000..a25f86c --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 69fd0853b6f52ef4f8aa5e029bcbb52a +folderAsset: yes +timeCreated: 1632106382 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials.meta diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Blue.mat b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Blue.mat similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Blue.mat rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Blue.mat diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Blue.mat.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Blue.mat.meta similarity index 64% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Blue.mat.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Blue.mat.meta index 0d607d3..b67d806 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Blue.mat.meta +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Blue.mat.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 5564f920180b4714c9b24ef238b10448 -timeCreated: 1521640882 +guid: 232e0c40a39f8c244b4d333c0e4c9e8c +timeCreated: 1632233434 licenseType: Pro NativeFormatImporter: userData: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Gray.mat b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Gray.mat similarity index 98% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Gray.mat rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Gray.mat index 820e5e0..0d87709 100644 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Gray.mat and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Gray.mat differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Gray.mat.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Gray.mat.meta similarity index 64% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Gray.mat.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Gray.mat.meta index 4cc6d1d..124d2e4 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Gray.mat.meta +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Gray.mat.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 4aa10623d390e59489c1d9385508f658 -timeCreated: 1521640110 +guid: 4931b940776f31642ad744908987f65b +timeCreated: 1632236313 licenseType: Pro NativeFormatImporter: userData: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Yellow.mat b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSide.mat similarity index 98% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Yellow.mat rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSide.mat index b02b173..1247b3d 100644 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Yellow.mat and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSide.mat differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Side.mat.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSide.mat.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Side.mat.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSide.mat.meta diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Surface.mat b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSurface.mat similarity index 96% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Surface.mat rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSurface.mat index bc3f511..1182fb1 100644 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Surface.mat and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSurface.mat differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Surface.mat.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSurface.mat.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Hose_Surface.mat.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/HoseSurface.mat.meta diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Green.mat b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Red.mat similarity index 84% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Green.mat rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Red.mat index 5af8995..1c60100 100644 Binary files a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Green.mat and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Red.mat differ diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Green.mat.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Red.mat.meta similarity index 64% rename from UnityProject/Assets/MGS-SkinnedMesh/Materials/Green.mat.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Red.mat.meta index 59b7a11..f68e252 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Materials/Green.mat.meta +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Materials/Red.mat.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 545b3aa737dee5046818485a74a13543 -timeCreated: 1521640966 +guid: 4a016c14b5c7b024c822c2c8bd47f6ae +timeCreated: 1632234468 licenseType: Pro NativeFormatImporter: userData: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Scenes.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes.meta diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Scenes/CurveHose.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose.meta diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoBezierCurveHose.unity b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoBezierCurveHose.unity new file mode 100644 index 0000000..7b5e2bb Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoBezierCurveHose.unity differ diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoBezierCurveHose.unity.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoBezierCurveHose.unity.meta new file mode 100644 index 0000000..548d719 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoBezierCurveHose.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2874d123a1dd41b4a8c8933ee593b61b +timeCreated: 1632163058 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoEllipseCurveHose.unity b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoEllipseCurveHose.unity new file mode 100644 index 0000000..902ef2a Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoEllipseCurveHose.unity differ diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoEllipseCurveHose.unity.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoEllipseCurveHose.unity.meta new file mode 100644 index 0000000..b2de28a --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoEllipseCurveHose.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91b4381aee7087f458e78a5210c4c064 +timeCreated: 1632163058 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHelixCurveHose.unity b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHelixCurveHose.unity new file mode 100644 index 0000000..291441b Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHelixCurveHose.unity differ diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHelixCurveHose.unity.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHelixCurveHose.unity.meta new file mode 100644 index 0000000..1009145 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHelixCurveHose.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a13386160975924294248669f8cb6ae +timeCreated: 1632163058 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHermiteCurveHose.unity b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHermiteCurveHose.unity new file mode 100644 index 0000000..20e6b31 Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHermiteCurveHose.unity differ diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHermiteCurveHose.unity.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHermiteCurveHose.unity.meta new file mode 100644 index 0000000..69ad5d4 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoHermiteCurveHose.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4fc85374b9515a34a83d5b7e0969bea8 +timeCreated: 1632163058 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSinCurveHose.unity b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSinCurveHose.unity new file mode 100644 index 0000000..f6d065e Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSinCurveHose.unity differ diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSinCurveHose.unity.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSinCurveHose.unity.meta new file mode 100644 index 0000000..e269537 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSinCurveHose.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 04662cbd732138c4ea5d97e891a20f35 +timeCreated: 1632163058 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSpringDemo.unity b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSpringDemo.unity new file mode 100644 index 0000000..40ef132 Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSpringDemo.unity differ diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSpringDemo.unity.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSpringDemo.unity.meta new file mode 100644 index 0000000..a325fc5 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scenes/CurveHose/MonoSpringDemo.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cfabbb6de5f6fc64cb61b210f242a053 +timeCreated: 1632233142 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scripts.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Scripts.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts.meta diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts/MonoSpringDemo.cs b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts/MonoSpringDemo.cs new file mode 100644 index 0000000..535d5ca --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts/MonoSpringDemo.cs @@ -0,0 +1,46 @@ +/************************************************************************* + * Copyright (c) 2021 Mogoson. All rights reserved. + *------------------------------------------------------------------------ + * File : MonoSpringDemo.cs + * Description : Null. + *------------------------------------------------------------------------ + * Author : Mogoson + * Version : 0.1.0 + * Date : 9/21/2021 + * Description : Initial development version. + *************************************************************************/ + +using MGS.Curve; +using UnityEngine; + +namespace MGS.SkinnedMesh +{ + public class MonoSpringDemo : MonoBehaviour + { + public Transform top; + public MonoHelixCurve spring; + public Transform buttom; + + void Update() + { + if (Input.GetKey(KeyCode.W)) + { + if (top.localPosition.y < 0.975f) + { + top.localPosition += Vector3.up * 0.5f * Time.deltaTime; + spring.altitude = Vector3.Distance(top.position, buttom.position); + spring.Rebuild(); + } + } + else if (Input.GetKey(KeyCode.S)) + { + if (top.localPosition.y > 0.6f) + { + top.localPosition -= Vector3.up * 0.5f * Time.deltaTime; + spring.altitude = Vector3.Distance(top.position, buttom.position); + spring.Rebuild(); + } + } + } + } +} \ No newline at end of file diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Scripts/TestCable.cs.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts/MonoSpringDemo.cs.meta similarity index 75% rename from UnityProject/Assets/MGS-SkinnedMesh/Scripts/TestCable.cs.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts/MonoSpringDemo.cs.meta index bc17282..9fe9641 100644 --- a/UnityProject/Assets/MGS-SkinnedMesh/Scripts/TestCable.cs.meta +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Scripts/MonoSpringDemo.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 5df1e31a6cc3db54bbac50af1fc59037 -timeCreated: 1521641725 +guid: a870c33560f4bec4c959f778157315af +timeCreated: 1632233195 licenseType: Pro MonoImporter: serializedVersion: 2 diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Shaders.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Shaders.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Shaders.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Shaders.meta diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Shaders/DoubleSurface.shader b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Shaders/DoubleSurface.shader similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Shaders/DoubleSurface.shader rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Shaders/DoubleSurface.shader diff --git a/UnityProject/Assets/MGS-SkinnedMesh/Shaders/DoubleSurface.shader.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Shaders/DoubleSurface.shader.meta similarity index 100% rename from UnityProject/Assets/MGS-SkinnedMesh/Shaders/DoubleSurface.shader.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Demo/Shaders/DoubleSurface.shader.meta diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor.meta new file mode 100644 index 0000000..26d0757 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a1f43e3216585024aa3a188a56049bd8 +folderAsset: yes +timeCreated: 1632106261 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor/MGS.SkinnedMeshEditor.dll b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor/MGS.SkinnedMeshEditor.dll new file mode 100644 index 0000000..c216ee3 Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor/MGS.SkinnedMeshEditor.dll differ diff --git a/UnityProject/Assets/Editor/MGS/MGS.SkinnedMeshEditor.dll.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor/MGS.SkinnedMeshEditor.dll.meta similarity index 83% rename from UnityProject/Assets/Editor/MGS/MGS.SkinnedMeshEditor.dll.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor/MGS.SkinnedMeshEditor.dll.meta index f0a6d55..2c3198c 100644 --- a/UnityProject/Assets/Editor/MGS/MGS.SkinnedMeshEditor.dll.meta +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Editor/MGS.SkinnedMeshEditor.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: dc3dc0690cb1fb244835380eea9aafbe -timeCreated: 1585492039 +guid: 618ba73bf4c899548b0c5d8cc55183a6 +timeCreated: 1632148545 licenseType: Pro PluginImporter: serializedVersion: 1 diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/LICENSE b/UnityProject/Assets/MGS.Packages/SkinnedMesh/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + 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. diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/LICENSE.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/LICENSE.meta new file mode 100644 index 0000000..e6c77e0 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/LICENSE.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d8c27e43881d56848b25315b9b772a60 +timeCreated: 1632106615 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins.meta new file mode 100644 index 0000000..08feb3f --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 12a1facbd9ea44047ae9c0a98fbb9b93 +folderAsset: yes +timeCreated: 1632106270 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.dll b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.dll new file mode 100644 index 0000000..0a73444 Binary files /dev/null and b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.dll differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.dll.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.dll.meta similarity index 83% rename from UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.dll.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.dll.meta index 4d97607..90ba77e 100644 --- a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.dll.meta +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 7ab36c035e473bd44b4f7bdfe6f5cb25 -timeCreated: 1585491988 +guid: a9ee45673960e9149ab41acfefb2c475 +timeCreated: 1632145625 licenseType: Pro PluginImporter: serializedVersion: 1 diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.md b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.md new file mode 100644 index 0000000..9b171fd --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.md @@ -0,0 +1,150 @@ +[TOC] + +# MGS.SkinnedMesh.dll + +## Summary + +- Unity plugin for create skinned mesh in scene. + +## Environment + +- .Net Framework 3.5 or above. +- Unity 5.0 or above. + +## Platform + +- Windows + +## Implemented + +```C# +public abstract class MonoSkinnedMesh : MonoBehaviour, ISkinnedMesh{} +public abstract class MonoCurveHose : MonoSkinnedMesh, IMonoCurveHose{} +public class MonoCurveSkinnedHose : MonoCurveHose, IMonoCurveHose{} +public sealed class MeshUtility{} +``` + +## Technology + +### Shared Mesh + +```C# +meshRenderer.sharedMesh = mesh; +meshRenderer.localBounds = mesh.bounds; +if (meshCollider) +{ + meshCollider.sharedMesh = null; + meshCollider.sharedMesh = mesh; +} +``` + +### Build Vertices + +```C# +//Create polygon vertices. +var vertices = new List(); +var sector = 2 * Mathf.PI / edge; +var radian = 0f; +for (int i = 0; i <= edge; i++) +{ + radian = sector * i; + vertices.Add(center + rotation * new Vector3(Mathf.Cos(radian), Mathf.Sin(radian)) * radius); +} +return vertices; + +//Create polygon triangles index base on center vertice. +var triangles = new List(); +var offset = clockwise ? 0 : 1; +for (int i = 0; i < edge; i++) +{ + triangles.Add(start + i + offset); + triangles.Add(start + i - offset + 1); + triangles.Add(center); +} +return triangles; + +//Create prism triangles index. +var triangles = new List(); +var polygonVs = polygon + 1; +var currentSegment = 0; +var nextSegment = 0; +for (int s = 0; s < segment - 1; s++) +{ + // Calculate start index. + currentSegment = polygonVs * s; + nextSegment = polygonVs * (s + 1); + for (int p = 0; p < polygon; p++) + { + // Left-Bottom triangle. + triangles.Add(start + currentSegment + p); + triangles.Add(start + currentSegment + p + 1); + triangles.Add(start + nextSegment + p + 1); + + // Right-Top triangle. + triangles.Add(start + currentSegment + p); + triangles.Add(start + nextSegment + p + 1); + triangles.Add(start + nextSegment + p); + } +} +return triangles; + +//Create polygon uv. +var uv = new List(); +var sector = 2 * Mathf.PI / edge; +var radian = 0f; +var center = Vector2.one * 0.5f; +for (int i = 0; i <= edge; i++) +{ + radian = sector * i; + uv.Add(center + new Vector2(Mathf.Cos(radian), Mathf.Sin(radian)) * 0.5f); +} +return uv; + +//Create prism uv. +var uv = new List(); +var polygonVs = polygon + 1; +var vertices = polygonVs * segment; +var slice = 1.0f / polygon; +var u = 0f; +var v = 0f; +for (int i = 0; i < vertices; i++) +{ + u = slice * (i % polygonVs); + v = (i / polygonVs) % 2; + uv.Add(new Vector2(u, v)); +} +return uv; +``` + +### Build Mesh + +```C# +//Rebuild the mesh of hose. +mesh.vertices = CreateVertices(curve, segments, differ, isSeal); +mesh.triangles = CreateTriangles(segments, isSeal); +mesh.uv = CreateUV(segments, isSeal); +mesh.RecalculateNormals(); +mesh.RecalculateBounds(); +``` + +## Usage + +- Attach mono curve component to a game object. +- Attach mono skinned mesh component to a game object. +- Adjust the args of curve and skinned component or edit curve in scene editor. + +- Adjust the args of curve and Rebuild runtime, and MonoSkinnedMesh will auto Rebuild. + +```C# +var curve = GetComponent(); +curve.AddAnchor(new HermiteAnchor(point)); +curve..Rebuild();//The MonoSkinnedMesh will auto Rebuild. +``` + +------ + +[Previous](../../README.md) + +------ + +Copyright © 2021 Mogoson. mogoson@outlook.com \ No newline at end of file diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.md.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.md.meta new file mode 100644 index 0000000..c493dac --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.md.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 11c8cc0bc6d024f44b6fb34e6b86f449 +timeCreated: 1632232373 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.xml b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.xml new file mode 100644 index 0000000..203895b --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.xml @@ -0,0 +1,279 @@ + + + + MGS.SkinnedMesh + + + + + Render dynamic skinned mesh. + + + + + Skinned mesh renderer of skin. + + + + + Mesh collider of skin. + + + + + Mesh of skin. + + + + + Skinned mesh renderer of skin. + + + + + Mesh collider of skin. + + + + + Reset component. + + + + + Rebuild the mesh of skin. + + Mesh of skin. + + + + Rebuild the mesh of skin. + + + + + Attach MeshCollider to skin. + + + + + Remove MeshCollider from skin. + + + + + Render dynamic hose mesh base on mono curve. + + + + + Segment length of mono curve. + + + + + Polygon of hose cross section. + + + + + Radius of hose mesh. + + + + + Is seal at both ends of hose? + + + + + Renderer component. + + + + + Segment length of mono curve. + + + + + Polygon of hose cross section. + + + + + Radius of hose mesh. + + + + + Is seal at both ends of hose? + + + + + [MESSAGE] On mono curve rebuild. + + + + + + Rebuild renderer base mono curve. + + + + + + Render dynamic hose mesh base on mono curve. + + + + + Mono curve for curve hose. + + + + + Rebuild renderer base curve. + + + + + + Rebuild the mesh of hose. + + + + + Create the vertices of hose mesh. + + + + + Is seal at both ends of hose? + Vertices array. + + + + Create triangles of hose mesh. + + + Is seal at both ends of hose? + Triangles array. + + + + Create triangles of hose side mesh. + + + + + + + Create uv of hose mesh. + + + Is seal at both ends of hose? + UV array. + + + + Interface of mono curve hose. + + + + + Polygon of hose cross section. + + + + + Radius of hose mesh. + + + + + Is seal at both ends of hose? + + + + + Interface of skinned mesh. + + + + + Skinned mesh renderer of skin. + + + + + Mesh collider of skin. + + + + + Rebuild the mesh of skin. + + + + + Attach collider to skin mesh. + + + + + Remove collider from skin mesh. + + + + + Utility for mesh. + + + + + Create polygon vertices. + + Edge count of polygon. + Radius of polygon. + Center of polygon. + Rotation of polygon. + Vertices base on polygon. + + + + Create polygon triangles index base on center vertice. + + Edge count of polygon. + Index of center vertice. + Index of start vertice. + Triangle indexs is clockwise. + Triangles base on polygon. + + + + Create prism triangles index. + + Edge count of prism polygon. + Segment count of prism vertices vertical division. + Start index of prism vertice. + Triangles index base on prism. + + + + Create polygon uv. + + Edge count of polygon. + UV base on polygon. + + + + Create prism uv. + + Edge count of prism polygon. + Segment count of prism vertices vertical division. + UV base on prism. + + + diff --git a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.xml.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.xml.meta similarity index 86% rename from UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.xml.meta rename to UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.xml.meta index 8df05db..a440031 100644 --- a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.xml.meta +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/Plugins/MGS.SkinnedMesh.xml.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 612a309f1e7bdcb47aa0ec421a172bd7 -timeCreated: 1609059931 +timeCreated: 1632148503 licenseType: Pro TextScriptImporter: userData: diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/README.md b/UnityProject/Assets/MGS.Packages/SkinnedMesh/README.md new file mode 100644 index 0000000..c5b83f0 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/README.md @@ -0,0 +1,158 @@ +[TOC] + +# MGS.SkinnedMesh + +## Summary + +- Unity plugin for create skinned mesh in scene. + +## Environment + +- .Net Framework 3.5 or above. +- Unity 5.0 or above. + +## Platform + +- Windows + +## Implemented + +```C# +public abstract class MonoSkinnedMesh : MonoBehaviour, ISkinnedMesh{} +public abstract class MonoCurveHose : MonoSkinnedMesh, IMonoCurveHose{} +public class MonoCurveSkinnedHose : MonoCurveHose, IMonoCurveHose{} +public sealed class MeshUtility{} +``` + +## Technology + +### Build Vertices + +```C# +//Create polygon vertices. +var vertices = new List(); +var sector = 2 * Mathf.PI / edge; +var radian = 0f; +for (int i = 0; i <= edge; i++) +{ + radian = sector * i; + vertices.Add(center + rotation * new Vector3(Mathf.Cos(radian), Mathf.Sin(radian)) * radius); +} +return vertices; + +//Create polygon triangles index base on center vertice. +var triangles = new List(); +var offset = clockwise ? 0 : 1; +for (int i = 0; i < edge; i++) +{ + triangles.Add(start + i + offset); + triangles.Add(start + i - offset + 1); + triangles.Add(center); +} +return triangles; + +//Create prism triangles index. +var triangles = new List(); +var polygonVs = polygon + 1; +var currentSegment = 0; +var nextSegment = 0; +for (int s = 0; s < segment - 1; s++) +{ + // Calculate start index. + currentSegment = polygonVs * s; + nextSegment = polygonVs * (s + 1); + for (int p = 0; p < polygon; p++) + { + // Left-Bottom triangle. + triangles.Add(start + currentSegment + p); + triangles.Add(start + currentSegment + p + 1); + triangles.Add(start + nextSegment + p + 1); + + // Right-Top triangle. + triangles.Add(start + currentSegment + p); + triangles.Add(start + nextSegment + p + 1); + triangles.Add(start + nextSegment + p); + } +} +return triangles; + +//Create polygon uv. +var uv = new List(); +var sector = 2 * Mathf.PI / edge; +var radian = 0f; +var center = Vector2.one * 0.5f; +for (int i = 0; i <= edge; i++) +{ + radian = sector * i; + uv.Add(center + new Vector2(Mathf.Cos(radian), Mathf.Sin(radian)) * 0.5f); +} +return uv; + +//Create prism uv. +var uv = new List(); +var polygonVs = polygon + 1; +var vertices = polygonVs * segment; +var slice = 1.0f / polygon; +var u = 0f; +var v = 0f; +for (int i = 0; i < vertices; i++) +{ + u = slice * (i % polygonVs); + v = (i / polygonVs) % 2; + uv.Add(new Vector2(u, v)); +} +return uv; +``` + +### Build Mesh + +```C# +//Rebuild the mesh of hose. +mesh.vertices = CreateVertices(curve, segments, differ, isSeal); +mesh.triangles = CreateTriangles(segments, isSeal); +mesh.uv = CreateUV(segments, isSeal); +mesh.RecalculateNormals(); +mesh.RecalculateBounds(); +``` + +### Shared Mesh + +```C# +meshRenderer.sharedMesh = mesh; +meshRenderer.localBounds = mesh.bounds; +if (meshCollider) +{ + meshCollider.sharedMesh = null; + meshCollider.sharedMesh = mesh; +} +``` + +## Usage + +- Attach mono curve component to a game object. +- Attach mono skinned mesh component to a game object. +- Adjust the args of curve and skinned component or edit curve in scene editor. + +- Adjust the args of curve and Rebuild runtime, and MonoSkinnedMesh will auto Rebuild. + +```C# +var curve = GetComponent(); +curve.AddAnchor(new HermiteAnchor(point)); +curve..Rebuild();//The MonoSkinnedMesh will auto Rebuild. +``` + +## Demo + +- Demos in the path "MGS.Packages/SkinnedMesh/Demo/" provide reference to you. + +## Source + +- https://github.com/mogoson/MGS.SkinnedMesh. + +------ + +[Previous](../../README.md) + +------ + +Copyright © 2021 Mogoson. mogoson@outlook.com \ No newline at end of file diff --git a/UnityProject/Assets/MGS.Packages/SkinnedMesh/README.md.meta b/UnityProject/Assets/MGS.Packages/SkinnedMesh/README.md.meta new file mode 100644 index 0000000..b7cd604 --- /dev/null +++ b/UnityProject/Assets/MGS.Packages/SkinnedMesh/README.md.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aec2c0823c48f41468406349d286513a +timeCreated: 1632235918 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Plugins/MGS.meta b/UnityProject/Assets/Plugins/MGS.meta deleted file mode 100644 index 432f0ad..0000000 --- a/UnityProject/Assets/Plugins/MGS.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 02c06db07c68f7741965a4b9571f7ccf -folderAsset: yes -timeCreated: 1558531607 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Common.dll b/UnityProject/Assets/Plugins/MGS/MGS.Common.dll deleted file mode 100644 index 73f95cb..0000000 Binary files a/UnityProject/Assets/Plugins/MGS/MGS.Common.dll and /dev/null differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Common.xml b/UnityProject/Assets/Plugins/MGS/MGS.Common.xml deleted file mode 100644 index 430a50c..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.Common.xml +++ /dev/null @@ -1,475 +0,0 @@ - - - - MGS.Common - - - - - Converter of array. - - - - - Convert one dimention array to two dimentions array. - - Element type. - Source array. - Two dimention array's row. - Two dimention array's column. - Two dimentions array. - - - - Convert one dimention array to three dimentions array. - - Element type. - Source array. - Three dimention array's layer. - Three dimention array's row. - Three dimention array's column. - Three dimentions array. - - - - Convert two dimention array to one dimentions array. - - Element type. - Source array. - One dimentions array. - - - - Convert three dimention array to one dimentions array. - - Element type. - Source array. - One dimentions array. - - - - Converter of byte array. - - - - - Convert byte array to boolean array. - - Bytes array. - Start index. - Convert Boolean count. - Boolean array. - - - - Convert byte array to Int16 array. - - Bytes array. - Start index. - Convert Int16 count. - Int16 array. - - - - Convert byte array to Int32 array. - - Bytes array. - Start index. - Convert Int32 count. - Int32 array. - - - - Convert byte array to Int64 array. - - Bytes array. - Start index. - Convert Int64 count. - Int64 array. - - - - Convert byte array to char array. - - Bytes array. - Start index. - Convert Char count. - Char array. - - - - Convert byte array to single array. - - Bytes array. - Start index. - Convert Single count. - Single array. - - - - Convert byte array to double array. - - Bytes array. - Start index. - Convert Double count. - Double array. - - - - Converter of structure. - - - - - Convert byte array to structure. - - Structure type. - Byte array. - Structure. - - - - Convert structure to byte array. - - Structure type. - Structure. - Byte array. - - - - Utility for process. - - - - - Start process from file. - - Path of process file. - Succeed? - - - - Kill process by name. - - Name of process. - Succeed? - - - - Kill processes by names. - - Names of processes. - Succeed? - - - - Generic event. - - - - - Event callback. - - - - - Add event listener. - - Event callback. - - - - Remove event listener. - - Event callback. - - - - Remove all event listeners. - - - - - Invoke event. - - - - - Generic event. - - Specified type of event arg. - - - - Event callback. - - - - - Add event listener. - - Event callback. - - - - Remove event listener. - - Event callback. - - - - Remove all event listeners. - - - - - Invoke event. - - Arg of event. - - - - Generic event. - - Specified type of event arg1. - Specified type of event arg2. - - - - Event callback. - - - - - Add event listener. - - Event callback. - - - - Remove event listener. - - Event callback. - - - - Remove all event listeners. - - - - - Invoke event. - - Arg1 of event. - Arg2 of event. - - - - Utility for directory. - - - - - Require the directory of path exist. - - Directory or file path. - Succeed? - - - - Copy the children entries of source to dest directory. - - Source dir. - Dest dir. - Ignore files or directories. - Progress callback. - Complete callback. - - - - Copy the children entries of source to dest directory async. - - Source dir. - Dest dir. - Ignore files or directories. - Guid of async threadGuid of async thread [System will automatically assign if it is null or empty]. - Progress callback. - Complete callback. - Guid of async thread. - - - - Delete the children entries of the directory. - - Dest dir. - Ignore files or directories. - Progress callback. - Complete callback. - - - - Delete the children entries of the directory async. - - Dest dir. - Ignore files or directories. - Guid of async threadGuid of async thread [System will automatically assign if it is null or empty]. - Progress callback. - Complete callback. - Guid of async thread. - - - - Abort Async thread. - - Guid of async thread. - - - - Utility for file. - - - - - Calculate page count of file. - - Path of target file. - Size of page. - Page count of file. - - - - Read the index page of file. - - Path of target file. - Size of page. - Index of page. - Index page bytes. - - - - Read all lines of file. - - Path of target file. - Encoding of target file. - All lines from file. - - - - Utility for MD5 crypto service provider. - - - - - Compute hash of byte array. - - Source byte array. - Hash code. - - - - Compute hash of string. - - Source string. - Hash code. - - - - Compute hash of file. - - Path of source file. - Hash code. - - - - Reflector for reflection. - - - - - Sets the value of the field supported by the given object. - - The object whose field value will be set. - The string containing the name of the data field to get. - The value to assign to the field. - A bitwise combination of the enumeration values that specify how the search is conducted. - - - - Sets the value of the property supported by the given object. - - The object whose property value will be set. - The string containing the name of the property to get. - The value to assign to the property. - A bitwise combination of the enumeration values that specify how the search is conducted. - Optional index values for indexed properties. - - - - Invokes the method or constructor represented by the given object, using the specified parameters. - - The object on which to invoke the method or constructor. - The string containing the name of the method to get. - An argument list for the invoked method or constructor. - A bitwise combination of the enumeration values that specify how the search is conducted. - - - - - Bridge for thread. - - - - - Queue for actions. - - - - - Enqueue an action. - - Register action. - - - - Dequeue all actions. - - - - - Dequeue the number of count actions. - - Count of dequeue actions once. - - - - Utility for thread. - - - - - Dictionary for asyncs. - - - - - Async run action in a thread. - - Run action. - Thread instance. - - - - Async run action in a thread. - - Run action. - Guid of async thread [System will automatically assign if it is null or empty]. - Thread instance. - - - - Abort Async thread. - - Guid of async thread. - - - diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Logger.dll b/UnityProject/Assets/Plugins/MGS/MGS.Logger.dll deleted file mode 100644 index f0d4dad..0000000 Binary files a/UnityProject/Assets/Plugins/MGS/MGS.Logger.dll and /dev/null differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.Logger.xml b/UnityProject/Assets/Plugins/MGS/MGS.Logger.xml deleted file mode 100644 index 1832a5e..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.Logger.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - MGS.Logger - - - - - Loggger for log to local file. - - - - - Root directory of log files. - - - - - Logs a formatted message to local file. - - Tag of log message. - A composite format string. - Format arguments. - - - - Require the directory of path exist. - - Directory or file path. - Succeed? - - - - Resolve the path of log file. - - Root directory of log files. - The path of log file. - - - - Resolve the log content. - - Tag of log message. - A composite format string. - Format arguments. - The log content. - - - - Constructor. - - Root directory of log files. - - - - Logs a formatted message to local file. - - A composite format string. - Format arguments. - - - - Logs a formatted error message to local file. - - A composite format string. - Format arguments. - - - - Logs a formatted warning message to local file. - - A composite format string. - Format arguments. - - - - Interface of logger. - - - - - Logs a formatted message. - - A composite format string. - Format arguments. - - - - Logs a formatted error message. - - A composite format string. - Format arguments. - - - - Logs a formatted warning message. - - A composite format string. - Format arguments. - - - - Utility for log output. - - - - - Loggers of utility. - - - - - Add logger to utility. - - Logger for output message. - - - - Remove logger from utility. - - Logger for output message. - - - - Clear the loggers of utility. - - - - - Logs a formatted message. - - A composite format string. - Format arguments. - - - - Logs a formatted error message. - - A composite format string. - Format arguments. - - - - Logs a formatted warning message. - - A composite format string. - Format arguments. - - - diff --git a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.dll b/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.dll deleted file mode 100644 index 28740fb..0000000 Binary files a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.dll and /dev/null differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.xml b/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.xml deleted file mode 100644 index e27d80a..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.SkinnedMesh.xml +++ /dev/null @@ -1,502 +0,0 @@ - - - - MGS.SkinnedMesh - - - - - Render dynamic skinned mesh. - - - - - Skinned mesh renderer of skin. - - - - - Mesh collider of skin. - - - - - Mesh of skin. - - - - - Skin is initialized? - - - - - Skinned mesh renderer of skin. - - - - - Mesh collider of skin. - - - - - Reset component. - - - - - Awake component. - - - - - Initialize mono skin. - - - - - Rebuild the mesh of skin. - - Mesh of skin. - - - - Rebuild the mesh of skin. - - - - - Attach MeshCollider to skin. - - - - - Remove MeshCollider from skin. - - - - - Render dynamic hose mesh base on center curve. - - - - - Polygon of hose cross section. - - - - - Segment length of subdivide hose. - - - - - Radius of hose mesh. - - - - - Is seal at both ends of hose? - - - - - Polygon of hose cross section. - - - - - Segment length of subdivide hose. - - - - - Radius of hose mesh. - - - - - Is seal at both ends of hose? - - - - - Max key of hose center curve. - - - - - Length of hose center curve. - - - - - Curve for hose. - - - - - Radian of circle. - - - - - Delta to calculate tangent. - - - - - Length of hose center curve. - - - - - Segment count of subdivide hose. - - - - - Rebuild the mesh of hose. - - - - - Create the vertices of hose mesh. - - Is seal at both ends of hose? - Vertices array. - - - - Create triangles of hose mesh. - - Is seal at both ends of hose? - Triangles array. - - - - Create triangles of hose side mesh. - - - - - - Create uv of hose mesh. - - Is seal at both ends of hose? - UV array. - - - - Rebuild the mesh of hose. - - - - - Get point from center curve of hose at key. - - Key of hose center curve. - Point on hose curve at key. - - - - Render dynamic hose mesh base on cubic bezier curve. - - - - - Anchor points of hose curve. - - - - - Start point of hose curve. - - - - - End point of hose curve. - - - - - Start tangent point of hose curve. - - - - - End tangent point of hose curve. - - - - - Curve for hose. - - - - - Curve of hose. - - - - - Rebuild the mesh of hose. - - - - - Render dynamic hose mesh base on circle curve. - - - - - Extend radius of hose curve. - - - - - Curve for hose. - - - - - Curve of hose. - - - - - Rebuild the mesh of hose. - - - - - Render dynamic hose mesh base on ellipse curve. - - - - - Semi minor axis of ellipse. - - - - - Semi major axis of ellipse. - - - - - Curve for hose. - - - - - Curve of hose. - - - - - Rebuild hose. - - - - - Render dynamic hose mesh base on helix curve. - - - - - Top ellipse args of curve. - - - - - Bottom ellipse args of curve. - - - - - Max around radian of helix. - - - - - Curve for hose. - - - - - Curve of hose. - - - - - Rebuild hose. - - - - - Render dynamic hose mesh base on hermite curve. - - - - - Hose curve is close? - - - - - Anchors of hose curve. - - - - - Count of hose curve anchors. - - - - - Curve for hose. - - - - - Anchor curve of hose. - - - - - Rebuild the mesh of hose. - - - - - Add anchor item. - - Anchor item. - - - - Insert Anchor item at index. - - Index of anchor. - Anchor item. - - - - Set the anchor item at index. - - Index of anchor. - Anchor item. - - - - Get the anchor item at index. - - Anchor index. - Anchor item. - - - - Remove the anchor item. - - Anchor item. - - - - Remove the anchor item at index. - - Anchor index. - - - - Clear all anchor items. - - - - - Interface of curve hose. - - - - - Polygon of hose cross section. - - - - - Segment length of subdivide hose. - - - - - Radius of hose mesh. - - - - - Is seal at both ends of hose? - - - - - Render dynamic hose mesh base on sin curve. - - - - - Args of sin curve. - - - - - Max key of sin curve. - - - - - Curve for hose. - - - - - Curve of hose. - - - - - Rebuild hose. - - - - - Interface of skinned mesh. - - - - - Skinned mesh renderer of skin. - - - - - Mesh collider of skin. - - - - - Rebuild the mesh of skin. - - - - - Attach collider to skin mesh. - - - - - Remove collider from skin mesh. - - - - diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.dll b/UnityProject/Assets/Plugins/MGS/MGS.UCommon.dll deleted file mode 100644 index c3368ee..0000000 Binary files a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.dll and /dev/null differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.dll.meta b/UnityProject/Assets/Plugins/MGS/MGS.UCommon.dll.meta deleted file mode 100644 index a36bf19..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.dll.meta +++ /dev/null @@ -1,20 +0,0 @@ -fileFormatVersion: 2 -guid: 7096783b904c7ac4f959905719c17db5 -timeCreated: 1585491987 -licenseType: Pro -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - platformData: - Any: - enabled: 1 - settings: {} - Editor: - enabled: 0 - settings: - DefaultValueInitialized: true - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.xml b/UnityProject/Assets/Plugins/MGS/MGS.UCommon.xml deleted file mode 100644 index 3f9faec..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.xml +++ /dev/null @@ -1,844 +0,0 @@ - - - - MGS.UCommon - - - - - Event trigger for UI behaviour. - - - - - On pointer enter event. - - - - - On pointer exit event. - - - - - On pointer down event. - - - - - On pointer up event. - - - - - On pointer click event. - - - - - On begin drag event. - - - - - On initialize potential drag event. - - - - - On drag event. - - - - - On end drag event. - - - - - On drop event. - - - - - On scroll event. - - - - - On update selected event. - - - - - On select event. - - - - - On deselect event. - - - - - On move event. - - - - - On submit event. - - - - - On cancel event. - - - - - On pointer enter. - - Pointer event data. - - - - On pointer exit. - - Pointer event data. - - - - On pointer down. - - Pointer event data. - - - - On pointer up. - - Pointer event data. - - - - On pointer click. - - Pointer event data. - - - - On begin drag. - - Pointer event data. - - - - On initialize potential drag. - - Pointer event data. - - - - On drag. - - Pointer event data. - - - - On end drag. - - Pointer event data. - - - - On drop. - - Pointer event data. - - - - On scroll. - - Pointer event data. - - - - On update selected. - - Pointer event data. - - - - On select. - - Pointer event data. - - - - On deselect. - - Pointer event data. - - - - On move. - - Pointer event data. - - - - On submit. - - Pointer event data. - - - - On cancel. - - Pointer event data. - - - - Coordinate axis. - - - - - X axis. - - - - - Y axis. - - - - - Z axis. - - - - - Mode of color blend. - - - - - Normal-Normal Mode. - - - - - Normal-Dissolve Mode. - - - - - Darken-Darken Mode. - - - - - Darken-Multiply Mode. - - - - - Darken-ColorBurn Mode. - - - - - Darken-LinearBurn Mode. - - - - - Darken-DarkerColor Mode. - - - - - Lighten-Lighten Mode. - - - - - Lighten-Screen Mode. - - - - - Lighten-ColorDodge Mode. - - - - - Lighten-LinearDodge Mode. - - - - - Lighten-LighterColor Mode. - - - - - Contrast-Overlay Mode. - - - - - Contrast-SoftLight Mode. - - - - - Contrast-HardLight Mode. - - - - - Contrast-VividLight Mode. - - - - - Contrast-LinearLight Mode. - - - - - Contrast-PinLight Mode. - - - - - Contrast-HardMix Mode. - - - - - Cancelation-Difference Mode. - - - - - Cancelation-Exclusion Mode. - - - - - Cancelation-Subtract Mode. - - - - - Cancelation-Divide Mode. - - - - - Component-Hue Mode. - - - - - Component-Color Mode. - - - - - Component-Saturation Mode. - - - - - Component-Luminosity Mode. - - - - - Lerp mode. - - - - - Lerp mode. - - - - - Towards mode. - - - - - Mode of mirror. - - - - - Horizontal mirror. - - - - - Vertical mirror. - - - - - Both horizontal and vertical mirror. - - - - - Range form min to max. - - - - - Min value of range. - - - - - Max value of range. - - - - - Length of range from min to max. - - - - - Constructor. - - Min value of range. - Max value of range. - - - - Rectangle area on plane. - - - - - Center of area. - - - - - Width of area. - - - - - Length of area. - - - - - Constructor. - - Center of area. - Width of area. - Length of area. - - - - Extention for UnityEngine.GameObject. - - - - - Set layer include it's children. - - - - - Extension for UnityEngine.Terrain. - - - - - Normalize position relative to terrain. - - Base terrain. - Position in wold space. - Normalize position. - - - - Position relative to terrain map. - - Base terrain. - Map size(x is width, z is height). - Normalize position relative to terrain. - Relative position. - - - - Extention for UnityEngine.Texture2D. - - - - - Update the pixels of Texture2D. - - Base Texture2D. - Color array for pixels. - The mip level of the texture to write to. - When set to true, mipmap levels are recalculated. - When set to true, system memory copy of a texture is released. - - - - Update the pixels of Texture2D. - - Base Texture2D. - Color array for pixels. - The mip level of the texture to write to. - When set to true, mipmap levels are recalculated. - When set to true, system memory copy of a texture is released. - - - - Update the pixels of Texture2D. - - Base Texture2D. - Color array for pixels. - The mip level of the texture to write to. - When set to true, mipmap levels are recalculated. - When set to true, system memory copy of a texture is released. - - - - Update the pixels of Texture2D. - - Base Texture2D. - Color array for pixels. - The mip level of the texture to write to. - When set to true, mipmap levels are recalculated. - When set to true, system memory copy of a texture is released. - - - - Utility for color blend. - - - - - Blend color a and color b. - - Color a. - Color b. - Mode of color blend. - Blended color. - - - - Normal mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Dissolve mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Darken mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Multiply mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - ColorBurn mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - LinearBurn vblend color a and color b. - - Color a. - Color b. - Blended color. - - - - DarkerColor mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Lighten mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Screen mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - ColorDodge mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - LinearDodge mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - LighterColor mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Overlay mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - SoftLight mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - HardLight mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - VividLight mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - LinearLight mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - PinLight mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - HardMix mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Difference mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Exclusion mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Subtract mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Divide mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Hue mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Component-Color mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Saturation mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Luminosity mode blend color a and color b. - - Color a. - Color b. - Blended color. - - - - Utility for EventSystem. - - - - - Check mouse pointer is over target gameobject? - - Target gameobject. - Pointer is over target gameobject? - - - - Utility for mesh. - - - - - Create vertices base on polygon. - - Edge count of polygon. - Radius of polygon. - Center of polygon. - Rotation of polygon. - Vertices base on polygon. - - - - Create triangles index base on polygon and center vertice. - - Edge count of polygon. - Index of center vertice. - Index of start vertice. - Triangle indexs is clockwise. - Triangles base on polygon. - - - - Create triangles index base on prism. - - Edge count of prism polygon. - Segment count of prism vertices vertical division. - Start index of prism vertice. - Triangles index base on prism. - - - - Create uv base on polygon. - - Edge count of polygon. - UV base on polygon. - - - - Create uv base on prism. - - Edge count of prism polygon. - Segment count of prism vertices vertical division. - UV base on prism. - - - - Utility for RectTransform. - - - - - Mirror RectTransform. - - Target RectTransform. - Mode of mirror. - - - - Utility for unity vector. - - - - - Calculate project angle of two vectors in the range(0~360). - - Start vector. - End vector. - Normal of plane to project. - Project angle of two vectors. - - - diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.xml.meta b/UnityProject/Assets/Plugins/MGS/MGS.UCommon.xml.meta deleted file mode 100644 index 1af237a..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.UCommon.xml.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1fd534e4815ec2643a0fdde063cdf744 -timeCreated: 1609059931 -licenseType: Pro -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.dll b/UnityProject/Assets/Plugins/MGS/MGS.UCurve.dll deleted file mode 100644 index 7afe2bf..0000000 Binary files a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.dll and /dev/null differ diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.xml b/UnityProject/Assets/Plugins/MGS/MGS.UCurve.xml deleted file mode 100644 index e7ab159..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.xml +++ /dev/null @@ -1,608 +0,0 @@ - - - - MGS.UCurve - - - - - Anchor points of linear bezier curve. - - - - - Start point of curve. - - - - - End point of curve. - - - - - Constructor. - - Start point of curve. - End point of curve. - - - - Anchor points of quadratic bezier curve. - - - - - Start point of curve. - - - - - End point of curve. - - - - - Tangent point of curve. - - - - - Constructor. - - Start point of curve. - End point of curve. - Tangent point of curve. - - - - Anchor points of cubic bezier curve. - - - - - Start point of curve. - - - - - End point of curve. - - - - - Start tangent point of curve. - - - - - End tangent point of curve. - - - - - Constructor. - - Start point of curve. - End point of curve. - Start tangent point of curve. - End tangent point of curve. - - - - Bezier curve. - - - - - Delta to lerp key. - - - - - Length of curve. - - - - - Max key of curve. - - - - - Get point on curve at key. - - Key is in the range(0~1). - The point on curve at key. - - - - Linear bezier curve. - - - - - Anchor points of curve. - - - - - Constructor. - - - - - Constructor. - - Anchor points of curve. - - - - Get point on curve at key. - - Key is in the range(0~1). - The point on curve at key. - - - - Get curve point base on anchor points and key. - - Anchor points of curve. - Key is in the range(0~1). - Point on curve. - - - - Quadratic bezier curve. - - - - - Anchor points of curve. - - - - - Constructor. - - - - - Constructor. - - Anchor points of curve. - - - - Get point on curve at key. - - Key is in the range(0~1). - The point on curve at key. - - - - Get curve point base on anchor points and t. - - Anchor points of curve. - t is in the range(0~1). - Point on curve. - - - - Cubic bezier curve. - - - - - Anchor points of curve. - - - - - Constructor. - - - - - Constructor. - - Anchor points of curve. - - - - Get point on curve at key. - - Key is in the range(0~1). - The point on curve at key. - - - - Get curve point base on anchor points and key. - - Anchor points of curve. - Key is in the range(0~1). - Point on curve. - - - - Args of ellipse. - - - - - Center of ellipse. - - - - - Semi minor axis of ellipse. - - - - - Semi major axis of ellipse. - - - - - Constructor. - - Center of ellipse. - Semi minor axis of ellipse. - Semi major axis of ellipse. - - - - Ellipse curve. - - - - - Args of ellipse curve. - - - - - Length of curve. - - - - - Max around radian of ellipse. - - - - - Constructor. - - - - - Constructor. - - Args of ellipse curve. - - - - Get point on ellipse at around radian. - - Around radian of ellipse. - The point on ellipse at around radian. - - - - Get point on ellipse at around radian. - - Args of ellipse curve. - Around radian of ellipse. - The point on ellipse at around radian. - - - - Helix curve. - - - - - Coefficient of delta to lerp key. - - - - - Top ellipse args of curve. - - - - - Bottom ellipse args of curve. - - - - - Length of curve. - - - - - Max around radian of helix. - - - - - Constructor. - - - - - Constructor. - - Top ellipse args of curve. - Bottom ellipse args of curve. - - - - Get point on helix at around radian. - - Around radian of helix. - The point on helix at around radian. - - - - Get point on helix at around radian. - - Top ellipse args of curve. - Bottom ellipse args of curve. - Max around radian of helix. - Around radian of helix. - The point on helix at around radian. - - - - Vector keyframe. - - - - - Key of keyframe. - - - - - Value of keyframe. - - - - - Constructor. - - Key of keyframe. - Value of keyframe. - - - - Hermite curve in three dimensional space. - - - - - Get the index key frame. - - Index of key frame. - Key frame at index. - - - - Coefficient of delta to lerp key. - - - - - Count of Keyframes. - - - - - Length of curve. - - - - - Max key of curve. - - - - - The behaviour of the animation after the last keyframe. - - - - - The behaviour of the animation before the first keyframe. - - - - - Curve for x. - - - - - Curve for y. - - - - - Curve for z. - - - - - Constructor. - - - - - Add a new keyframe to the curve. - - The keyframe to add to the curve. - The index of the added keyframe, or -1 if the keyframe could not be added. - - - - Add a new keyframe to the curve. - - The key of the keyframe. - The value of the keyframe. - The index of the added keyframe, or -1 if the keyframe could not be added. - - - - Removes a keyframe. - - The index of the keyframe to remove. - - - - Smooth the in and out tangents of the keyframe at index. - - The index of the keyframe. - The smoothing weight to apply to the keyframe's tangents. - - - - Smooth the in and out tangents of keyframes. - - The smoothing weight to apply to the keyframe's tangents. - - - - Get point by evaluate the curve at key. - - The key within the curve you want to evaluate. - The point on the curve at the key. - - - - Create a curve base on anchors. - - Anchor points of curve. - Curve is close? - New curve. - - - - Interface of curve. - - - - - Length of curve. - - - - - Max key of curve. - - - - - Get point on curve at key. - - Key of curve. - The point on curve at key. - - - - Args of sin. - - - - - Amplitude of sin. - - - - - Angular of sin. - - - - - Initial phase of sin. - - - - - Setover of sin. - - - - - Constructor. - - Amplitude of sin. - Angular of sin. - Initial phase of sin. - Setover of sin. - - - - Sin curve. - - - - - Coefficient of delta to lerp key. - - - - - Args of sin curve. - - - - - Length of sin curve. - - - - - Max key of sin curve. - - - - - Constructor. - - - - - Constructor. - - Args of sin curve. - - - - Get point on sin curve at x. - - Value of x axis. - The point on sin curve at x. - - - - Evaluate the value of sin curve at x. - - Args of sin curve. - Value of x axis. - The value of sin curve at x. - - - - Get point on sin curve at x. - - Args of sin curve. - Value of x axis. - The point on sin curve at x. - - - diff --git a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.xml.meta b/UnityProject/Assets/Plugins/MGS/MGS.UCurve.xml.meta deleted file mode 100644 index 7671015..0000000 --- a/UnityProject/Assets/Plugins/MGS/MGS.UCurve.xml.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ae0b2951dfcb60f45b787960a6e9aedb -timeCreated: 1609059931 -licenseType: Pro -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Scripts.meta b/UnityProject/Assets/Scripts.meta deleted file mode 100644 index b6ffe83..0000000 --- a/UnityProject/Assets/Scripts.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0c82370e743e8604ea768bf5f73b8d72 -folderAsset: yes -timeCreated: 1556768528 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Scripts/MGS.meta b/UnityProject/Assets/Scripts/MGS.meta deleted file mode 100644 index 3b7fe2f..0000000 --- a/UnityProject/Assets/Scripts/MGS.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 056eb82201618a84aa6a112e6ed56295 -folderAsset: yes -timeCreated: 1556768536 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Scripts/MGS/HUD.meta b/UnityProject/Assets/Scripts/MGS/HUD.meta deleted file mode 100644 index af45d9b..0000000 --- a/UnityProject/Assets/Scripts/MGS/HUD.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d0fca7d701ba9214eb82175d6daf709f -folderAsset: yes -timeCreated: 1558232049 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Scripts/MGS/HUD/HelpHUD.cs b/UnityProject/Assets/Scripts/MGS/HUD/HelpHUD.cs deleted file mode 100644 index c4d304f..0000000 --- a/UnityProject/Assets/Scripts/MGS/HUD/HelpHUD.cs +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * Copyright © 2016-2019 Mogoson. All rights reserved. - *------------------------------------------------------------------------ - * File : HelpHUD.cs - * Description : Draw help HUD in scene. - *------------------------------------------------------------------------ - * Author : Mogoson - * Version : 0.1.0 - * Date : 4/15/2018 - * Description : Initial development version. - *************************************************************************/ - -using UnityEngine; - -namespace MGS.HUD -{ - [AddComponentMenu("MGS/HUD/HelpHUD")] - public class HelpHUD : MonoBehaviour - { - #region Field and Property - [Multiline] - public string info = "Help info."; - - public float top = 10; - public float left = 10; - #endregion - - #region Private Method - private void OnGUI() - { - DrawHelpHUD(); - } - - private void DrawHelpHUD() - { - GUILayout.Space(top); - GUILayout.BeginHorizontal(); - GUILayout.Space(left); - GUILayout.Label(info); - GUILayout.EndHorizontal(); - } - #endregion - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/MGS/HUD/HelpHUD.cs.meta b/UnityProject/Assets/Scripts/MGS/HUD/HelpHUD.cs.meta deleted file mode 100644 index 4d458a6..0000000 --- a/UnityProject/Assets/Scripts/MGS/HUD/HelpHUD.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4cf0db196e148cf46bc73a152fef59aa -timeCreated: 1523781829 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Scripts/MGS/Logger.meta b/UnityProject/Assets/Scripts/MGS/Logger.meta deleted file mode 100644 index 50dafa1..0000000 --- a/UnityProject/Assets/Scripts/MGS/Logger.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 39941d2111966ed4c86cf961ee7e29fe -folderAsset: yes -timeCreated: 1556768552 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Scripts/MGS/Logger/LogUtilityInitializer.cs b/UnityProject/Assets/Scripts/MGS/Logger/LogUtilityInitializer.cs deleted file mode 100644 index c1ff4d1..0000000 --- a/UnityProject/Assets/Scripts/MGS/Logger/LogUtilityInitializer.cs +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* - * Copyright © 2018 Mogoson. All rights reserved. - *------------------------------------------------------------------------ - * File : LogUtilityInitializer.cs - * Description : Initializer for log utility. - *------------------------------------------------------------------------ - * Author : Mogoson - * Version : 0.1.0 - * Date : 9/19/2018 - * Description : Initial development version. - *************************************************************************/ - -using UnityEngine; - -namespace MGS.Logger -{ - /// - /// Initializer for log utility. - /// - sealed class LogUtilityInitializer - { - #region Public Method - /// - /// Awake initializer. - /// - [RuntimeInitializeOnLoadMethod] - static void Awake() - { - //Awake automatic execute after MonoBehaviour.Awake, - //so if you need to output logs earlier, - //your should move the following codes to your game start. - -#if UNITY_EDITOR - LogUtility.AddLogger(new UnityDebugger()); -#else - //Use persistentDataPath support more platforms, example Android. - var logDir = string.Format("{0}/Log/", Application.persistentDataPath); - LogUtility.AddLogger(new FileLogger(logDir)); -#endif - } - #endregion - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/MGS/Logger/LogUtilityInitializer.cs.meta b/UnityProject/Assets/Scripts/MGS/Logger/LogUtilityInitializer.cs.meta deleted file mode 100644 index 5d13d51..0000000 --- a/UnityProject/Assets/Scripts/MGS/Logger/LogUtilityInitializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b18ccc6eda6a04349ae7812e152f1f06 -timeCreated: 1609059537 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Scripts/MGS/Logger/UnityDebugger.cs b/UnityProject/Assets/Scripts/MGS/Logger/UnityDebugger.cs deleted file mode 100644 index 977b8d2..0000000 --- a/UnityProject/Assets/Scripts/MGS/Logger/UnityDebugger.cs +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * Copyright © 2018 Mogoson. All rights reserved. - *------------------------------------------------------------------------ - * File : UnityDebugger.cs - * Description : Debugger for unity editor. - *------------------------------------------------------------------------ - * Author : Mogoson - * Version : 0.1.0 - * Date : 9/19/2018 - * Description : Initial development version. - *************************************************************************/ - -using UnityEngine; - -namespace MGS.Logger -{ - /// - /// Debugger for unity editor. - /// - class UnityDebugger : Logger.ILogger - { - #region Public Method - /// - /// Constructor. - /// - public UnityDebugger() { } - - /// - /// Logs a formatted message. - /// - /// A composite format string. - /// Format arguments. - public void Log(string format, params object[] args) - { - Debug.LogFormat(format, args); - } - - /// - /// Logs a formatted error message. - /// - /// A composite format string. - /// Format arguments. - public void LogError(string format, params object[] args) - { - Debug.LogErrorFormat(format, args); - } - - /// - /// Logs a formatted warning message. - /// - /// A composite format string. - /// Format arguments. - public void LogWarning(string format, params object[] args) - { - Debug.LogWarningFormat(format, args); - } - #endregion - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/MGS/Logger/UnityDebugger.cs.meta b/UnityProject/Assets/Scripts/MGS/Logger/UnityDebugger.cs.meta deleted file mode 100644 index 59724f5..0000000 --- a/UnityProject/Assets/Scripts/MGS/Logger/UnityDebugger.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 17ef10ab7d60dcd488a42bbee9e07c10 -timeCreated: 1556768552 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/ProjectSettings/EditorBuildSettings.asset b/UnityProject/ProjectSettings/EditorBuildSettings.asset index 535271a..8df5727 100644 Binary files a/UnityProject/ProjectSettings/EditorBuildSettings.asset and b/UnityProject/ProjectSettings/EditorBuildSettings.asset differ