From 2100a04284b0202425c30178a142e212e52d376c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 20:12:37 +0900 Subject: [PATCH] separate --- .../RotateParticle/Runtime/Jobs/Collision.cs | 52 +++++++++++ .../Runtime/Jobs/Collision.cs.meta | 11 +++ .../Runtime/Jobs/{Types.cs => Particle.cs} | 87 +------------------ .../Runtime/Jobs/Particle.cs.meta | 11 +++ .../Runtime/Jobs/TransformType.cs | 35 ++++++++ .../Runtime/Jobs/TransformType.cs.meta | 11 +++ .../RotateParticle/Runtime/Jobs/Warp.cs | 8 ++ .../Jobs/{Types.cs.meta => Warp.cs.meta} | 0 8 files changed, 130 insertions(+), 85 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/{Types.cs => Particle.cs} (69%) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/{Types.cs.meta => Warp.cs.meta} (100%) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs new file mode 100644 index 000000000..111890ffa --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs @@ -0,0 +1,52 @@ +using UniGLTF.SpringBoneJobs.Blittables; +using Unity.Collections; +using Unity.Jobs; +using UnityEngine; +using UnityEngine.Jobs; + + +namespace RotateParticle.Jobs +{ + public struct InputColliderJob : IJobParallelForTransform + { + [WriteOnly] public NativeArray CurrentCollider; + + public void Execute(int index, TransformAccess transform) + { + CurrentCollider[index] = transform.localToWorldMatrix; + } + } + + public struct CollisionJob : IJobParallelFor + { + [ReadOnly] public NativeArray Colliders; + [ReadOnly] public NativeArray CurrentColliders; + [WriteOnly] public NativeArray NextPositions; + + public void Execute(int index) + { + for (int i = 0; i < Colliders.Length; ++i) + { + var c = Colliders[i]; + switch (c.colliderType) + { + case BlittableColliderType.Sphere: + break; + + default: + // TODO + break; + } + } + // var d = Vector3.Distance(from, to); + // if (d > (ra + rb)) + // { + // resolved = default; + // return false; + // } + // Vector3 normal = (to - from).normalized; + // resolved = new(from, from + normal * (d - rb)); + // return true; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta new file mode 100644 index 000000000..46b06c78d --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 874e448619fc4d54f900f52f83708a6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs similarity index 69% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs index f81418139..38b8d05a3 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs @@ -1,46 +1,12 @@ -using System.Collections; -using System.Collections.Generic; using UniGLTF.SpringBoneJobs.Blittables; using Unity.Collections; using Unity.Jobs; using UnityEngine; using UnityEngine.Jobs; + namespace RotateParticle.Jobs { - public enum TransformType - { - Center, - WarpRootParent, - WarpRoot, - Particle, - } - - public static class TransformTypeExtensions - { - public static bool PositionInput(this TransformType t) - { - return t == TransformType.WarpRoot; - } - - public static bool Movable(this TransformType t) - { - return t == TransformType.Particle; - } - - public static bool Writable(this TransformType t) - { - switch (t) - { - case TransformType.WarpRoot: - case TransformType.Particle: - return true; - default: - return false; - } - } - } - public struct TransformInfo { public TransformType TransformType; @@ -69,23 +35,7 @@ namespace RotateParticle.Jobs } } - public struct WarpInfo - { - public int StartIndex; - public int EndIndex; - } - // [Input] - public struct InputColliderJob : IJobParallelForTransform - { - [WriteOnly] public NativeArray CurrentCollider; - - public void Execute(int index, TransformAccess transform) - { - CurrentCollider[index] = transform.localToWorldMatrix; - } - } - public struct InputTransformJob : IJobParallelForTransform { [ReadOnly] public NativeArray Info; @@ -148,39 +98,6 @@ namespace RotateParticle.Jobs } } - public struct CollisionJob : IJobParallelFor - { - [ReadOnly] public NativeArray Colliders; - [ReadOnly] public NativeArray CurrentColliders; - [WriteOnly] public NativeArray NextPositions; - - public void Execute(int index) - { - for (int i = 0; i < Colliders.Length; ++i) - { - var c = Colliders[i]; - switch (c.colliderType) - { - case BlittableColliderType.Sphere: - break; - - default: - // TODO - break; - } - } - // var d = Vector3.Distance(from, to); - // if (d > (ra + rb)) - // { - // resolved = default; - // return false; - // } - // Vector3 normal = (to - from).normalized; - // resolved = new(from, from + normal * (d - rb)); - // return true; - } - } - public struct ApplyRotationJob : IJobParallelFor { [ReadOnly] public NativeArray Warps; @@ -218,4 +135,4 @@ namespace RotateParticle.Jobs } } } -} +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta new file mode 100644 index 000000000..9db266542 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69453c7639ad8df4c94cbe3dae50e72c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs new file mode 100644 index 000000000..008fcf961 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs @@ -0,0 +1,35 @@ +namespace RotateParticle.Jobs +{ + public enum TransformType + { + Center, + WarpRootParent, + WarpRoot, + Particle, + } + + public static class TransformTypeExtensions + { + public static bool PositionInput(this TransformType t) + { + return t == TransformType.WarpRoot; + } + + public static bool Movable(this TransformType t) + { + return t == TransformType.Particle; + } + + public static bool Writable(this TransformType t) + { + switch (t) + { + case TransformType.WarpRoot: + case TransformType.Particle: + return true; + default: + return false; + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta new file mode 100644 index 000000000..024088d6c --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56860caf8e0babc41807521ed55a4f20 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs new file mode 100644 index 000000000..3d314bfdb --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs @@ -0,0 +1,8 @@ +namespace RotateParticle.Jobs +{ + public struct WarpInfo + { + public int StartIndex; + public int EndIndex; + } +} diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs.meta