mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-07-22 02:00:59 -05:00
separate
This commit is contained in:
parent
b577c3bb9f
commit
2100a04284
|
|
@ -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<Matrix4x4> CurrentCollider;
|
||||
|
||||
public void Execute(int index, TransformAccess transform)
|
||||
{
|
||||
CurrentCollider[index] = transform.localToWorldMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
public struct CollisionJob : IJobParallelFor
|
||||
{
|
||||
[ReadOnly] public NativeArray<BlittableCollider> Colliders;
|
||||
[ReadOnly] public NativeArray<Matrix4x4> CurrentColliders;
|
||||
[WriteOnly] public NativeArray<Vector3> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 874e448619fc4d54f900f52f83708a6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -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<Matrix4x4> CurrentCollider;
|
||||
|
||||
public void Execute(int index, TransformAccess transform)
|
||||
{
|
||||
CurrentCollider[index] = transform.localToWorldMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
public struct InputTransformJob : IJobParallelForTransform
|
||||
{
|
||||
[ReadOnly] public NativeArray<TransformInfo> Info;
|
||||
|
|
@ -148,39 +98,6 @@ namespace RotateParticle.Jobs
|
|||
}
|
||||
}
|
||||
|
||||
public struct CollisionJob : IJobParallelFor
|
||||
{
|
||||
[ReadOnly] public NativeArray<BlittableCollider> Colliders;
|
||||
[ReadOnly] public NativeArray<Matrix4x4> CurrentColliders;
|
||||
[WriteOnly] public NativeArray<Vector3> 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<WarpInfo> Warps;
|
||||
|
|
@ -218,4 +135,4 @@ namespace RotateParticle.Jobs
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 69453c7639ad8df4c94cbe3dae50e72c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 56860caf8e0babc41807521ed55a4f20
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
namespace RotateParticle.Jobs
|
||||
{
|
||||
public struct WarpInfo
|
||||
{
|
||||
public int StartIndex;
|
||||
public int EndIndex;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user