某些优化
This commit is contained in:
@@ -147,8 +147,8 @@ namespace Dreamteck.Splines
|
||||
private Spline[] _splines = new Spline[0];
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _initializedInEditor = false;
|
||||
|
||||
//private bool _initializedInEditor = false;
|
||||
//不把这些warning消掉就难受
|
||||
private int iterations => _subdivisions * _otherComputers.Length;
|
||||
|
||||
protected override void Awake()
|
||||
@@ -177,7 +177,7 @@ namespace Dreamteck.Splines
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case SubdivisionMode.BSpline: return Spline.Type.BSpline;
|
||||
case SubdivisionMode.BSpline: return Spline.Type.BSpline;
|
||||
case SubdivisionMode.Linear: return Spline.Type.Linear;
|
||||
default: return Spline.Type.CatmullRom;
|
||||
}
|
||||
@@ -199,7 +199,8 @@ namespace Dreamteck.Splines
|
||||
{
|
||||
_splines[i] = new Spline(ModeToSplineType(_subdivisionMode));
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < _splines.Length; i++)
|
||||
{
|
||||
@@ -208,7 +209,7 @@ namespace Dreamteck.Splines
|
||||
}
|
||||
|
||||
base.BuildMesh();
|
||||
AllocateMesh(sampleCount * (iterations + 1), iterations * (sampleCount-1) * 6);
|
||||
AllocateMesh(sampleCount * (iterations + 1), iterations * (sampleCount - 1) * 6);
|
||||
_tsMesh.triangles = MeshUtility.GeneratePlaneTriangles(sampleCount - 1, iterations + 1, false);
|
||||
GenerateVertices();
|
||||
_tsMesh.subMeshes.Clear();
|
||||
@@ -251,7 +252,7 @@ namespace Dreamteck.Splines
|
||||
{
|
||||
_splines[j].points = new SplinePoint[_otherComputers.Length + 1];
|
||||
}
|
||||
|
||||
|
||||
double xPercent = DMath.Lerp(clipFrom, clipTo, (double)j / (sampleCount - 1));
|
||||
if (i > 0)
|
||||
{
|
||||
@@ -275,7 +276,8 @@ namespace Dreamteck.Splines
|
||||
if (uvMode == UVMode.UniformClamp || uvMode == UVMode.UniformClip)
|
||||
{
|
||||
AddUVDistance(x);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSample(x, ref sample2);
|
||||
}
|
||||
@@ -292,11 +294,12 @@ namespace Dreamteck.Splines
|
||||
ydist += Vector3.Distance(lastPos, sample.position);
|
||||
}
|
||||
lastPos = sample.position;
|
||||
if (uvMode == UVMode.UniformClamp )
|
||||
if (uvMode == UVMode.UniformClamp)
|
||||
{
|
||||
__uvs.x = CalculateUVUniformClamp(_vDist);
|
||||
__uvs.y = CalculateUVUniformClamp(ydist);
|
||||
} else if(uvMode == UVMode.UniformClip)
|
||||
}
|
||||
else if (uvMode == UVMode.UniformClip)
|
||||
{
|
||||
__uvs.x = CalculateUVUniformClip(_vDist);
|
||||
__uvs.y = CalculateUVUniformClip(ydist);
|
||||
|
||||
Reference in New Issue
Block a user