EdenAutoMorpherScript dll을 디컴파일한 결과를 그대로 가져옴

This commit is contained in:
2026-02-01 14:57:52 +09:00
parent 8e1adbd907
commit f9c4088ef4
85 changed files with 10524 additions and 0 deletions

View File

@@ -0,0 +1,174 @@
// Decompiled with JetBrains decompiler
// Type: Eden.AutoMorpher.VertexMoverUtil
// Assembly: EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: D39968B3-E151-4276-BDB4-E82752BBAFF0
// Assembly location: D:\dev\AutoMorpher\Assets\@Eden_Tools\Eden_AutoMorpher\Script\EdenAutoMorpherScript.dll
using UnityEngine;
namespace Eden.AutoMorpher
{
public class VertexMoverUtil
{
public Vector3[] MoveVertices(
ClothInstance cloth,
Vector3 targetPoint,
bool centerIsLeftLeg,
bool centerIsRightLeg,
float maxRadius,
float param,
Vector3 vertexMovement)
{
Vector3[] verts = cloth != null && cloth.worldVertices != null ? cloth.worldVertices : throw new AutoMorpherException("Cloth or World Vertices are Missing", "[MoveVertices] MoveVertices\n - cloth is null or cloth.worldVertices is null");
int length = verts.Length;
bool[] isInboundVerts;
float[] euclideanDistances = this.ComputeEuclideanDistances(verts, targetPoint, maxRadius, out isInboundVerts);
if (euclideanDistances == null)
return (Vector3[])null;
float[] kernelWeights = this.ComputeKernelWeights(euclideanDistances, isInboundVerts, maxRadius, WeightKernel.Gaussian, param);
Vector3[] vector3Array = new Vector3[length];
bool[] isLeftLegVertex = cloth.isLeftLegVertex;
bool[] isRightLegVertex = cloth.isRightLegVertex;
for (int index = 0; index < length; ++index)
{
if (!isInboundVerts[index])
vector3Array[index] = Vector3.zero;
else if (centerIsLeftLeg && this.IsRightLegVertex(isRightLegVertex, index))
vector3Array[index] = Vector3.zero;
else if (centerIsRightLeg && this.IsLeftLegVertex(isLeftLegVertex, index))
{
vector3Array[index] = Vector3.zero;
}
else
{
float num = kernelWeights[index];
vector3Array[index] = Vector3.op_Multiply(vertexMovement, num);
}
}
return vector3Array;
}
public Vector3[] MoveVertices(
ClothInstance cloth,
int targetVertexIdx,
bool centerIsLeftLeg,
bool centerIsRightLeg,
float maxRadius,
float param,
Vector3 vertexMovement)
{
Vector3[] verts = cloth != null && cloth.worldVertices != null ? cloth.worldVertices : throw new AutoMorpherException("Cloth or World Vertices are Missing", "[MoveVertices] MoveVertices\n - cloth is null or cloth.worldVertices is null");
int length = verts.Length;
bool[] isInboundVerts;
float[] euclideanDistances = this.ComputeEuclideanDistances(verts, targetVertexIdx, maxRadius, out isInboundVerts);
if (euclideanDistances == null)
return (Vector3[])null;
float[] kernelWeights = this.ComputeKernelWeights(euclideanDistances, isInboundVerts, maxRadius, WeightKernel.Gaussian, param);
Vector3[] vector3Array = new Vector3[length];
bool[] isLeftLegVertex = cloth.isLeftLegVertex;
bool[] isRightLegVertex = cloth.isRightLegVertex;
for (int index = 0; index < length; ++index)
{
if (!isInboundVerts[index])
vector3Array[index] = Vector3.zero;
else if (centerIsLeftLeg && this.IsRightLegVertex(isRightLegVertex, index))
vector3Array[index] = Vector3.zero;
else if (centerIsRightLeg && this.IsLeftLegVertex(isLeftLegVertex, index))
{
vector3Array[index] = Vector3.zero;
}
else
{
float num = kernelWeights[index];
vector3Array[index] = Vector3.op_Multiply(vertexMovement, num);
}
}
return vector3Array;
}
private float[] ComputeEuclideanDistances(
Vector3[] verts,
int targetVertIdx,
float maxRadius,
out bool[] isInboundVerts)
{
return this.ComputeEuclideanDistances(verts, verts[targetVertIdx], maxRadius, out isInboundVerts);
}
private float[] ComputeEuclideanDistances(
Vector3[] verts,
Vector3 targetVert,
float maxRadius,
out bool[] isInboundVerts)
{
int length = verts.Length;
float[] numArray = new float[length];
isInboundVerts = new bool[length];
bool flag = false;
for (int index = 0; index < length; ++index)
{
numArray[index] = Vector3.Distance(verts[index], targetVert);
isInboundVerts[index] = (double)numArray[index] <= (double)maxRadius;
flag |= isInboundVerts[index];
}
return !flag ? (float[])null : numArray;
}
private float ComputeGaussianWeight(float distance, float alpah)
{
return Mathf.Exp((float)(-((double)distance * (double)distance) / (2.0 * (double)alpah * (double)alpah)));
}
private float ComputeLaplacianWeight(float distance, float beta)
{
return Mathf.Exp((float)-((double)distance / (double)beta));
}
private float[] ComputeKernelWeights(
float[] dist,
bool[] isInboundVerts,
float maxRadius,
WeightKernel kernel,
float param)
{
int length = dist.Length;
float[] kernelWeights = new float[length];
float num1 = Mathf.Max(1E-08f, param);
for (int index = 0; index < length; ++index)
{
if (!isInboundVerts[index])
{
kernelWeights[index] = 0.0f;
}
else
{
switch (kernel)
{
case WeightKernel.Gaussian:
kernelWeights[index] = this.ComputeGaussianWeight(dist[index], num1);
break;
case WeightKernel.Laplacian:
kernelWeights[index] = this.ComputeLaplacianWeight(dist[index], num1);
break;
default:
kernelWeights[index] = 0.0f;
break;
}
float num2 = (float)(1.0 - (double)dist[index] / (double)maxRadius);
kernelWeights[index] *= num2 * num2;
}
}
return kernelWeights;
}
private bool IsLeftLegVertex(bool[] leftMask, int index)
{
return leftMask != null && index >= 0 && index < leftMask.Length && leftMask[index];
}
private bool IsRightLegVertex(bool[] rightMask, int index)
{
return rightMask != null && index >= 0 && index < rightMask.Length && rightMask[index];
}
}
}