1
BIN
Assets/Dreamteck/.DS_Store
vendored
Normal file
BIN
Assets/Dreamteck/Splines/.DS_Store
vendored
Normal file
@@ -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);
|
||||
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
@@ -20,7 +20,8 @@ namespace Dreamteck.Splines
|
||||
{
|
||||
_size = value;
|
||||
Rebuild();
|
||||
} else _size = value;
|
||||
}
|
||||
else _size = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,13 +326,13 @@ namespace Dreamteck.Splines
|
||||
}
|
||||
filter.sharedMesh = _bakedMesh;
|
||||
_mesh = null;
|
||||
gameObject.isStatic = makeStatic;
|
||||
gameObject.isStatic = makeStatic;
|
||||
_baked = true;
|
||||
}
|
||||
|
||||
public void Unbake()
|
||||
{
|
||||
gameObject.isStatic = false;
|
||||
gameObject.isStatic = false;
|
||||
_baked = false;
|
||||
DestroyImmediate(_bakedMesh);
|
||||
_bakedMesh = null;
|
||||
@@ -406,8 +407,8 @@ namespace Dreamteck.Splines
|
||||
base.OnDestroy();
|
||||
MeshFilter filter = GetComponent<MeshFilter>();
|
||||
MeshRenderer rend = GetComponent<MeshRenderer>();
|
||||
if (filter != null) filter.hideFlags = HideFlags.None;
|
||||
if (rend != null) rend.hideFlags = HideFlags.None;
|
||||
if (filter != null) filter.hideFlags = HideFlags.None;
|
||||
if (rend != null) rend.hideFlags = HideFlags.None;
|
||||
}
|
||||
|
||||
|
||||
@@ -447,7 +448,8 @@ namespace Dreamteck.Splines
|
||||
if (sampleCount > 1)
|
||||
{
|
||||
BuildMesh();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearMesh();
|
||||
}
|
||||
@@ -470,7 +472,7 @@ namespace Dreamteck.Splines
|
||||
//Logic for mesh generation, automatically called in the Build method
|
||||
}
|
||||
|
||||
protected virtual void WriteMesh()
|
||||
protected virtual void WriteMesh()
|
||||
{
|
||||
MeshUtility.TransformMesh(_tsMesh, trs.worldToLocalMatrix);
|
||||
if (_doubleSided)
|
||||
@@ -515,11 +517,11 @@ namespace Dreamteck.Splines
|
||||
|
||||
protected virtual void AllocateMesh(int vertexCount, int trisCount)
|
||||
{
|
||||
if(trisCount < 0)
|
||||
if (trisCount < 0)
|
||||
{
|
||||
trisCount = 0;
|
||||
}
|
||||
if(vertexCount < 0)
|
||||
if (vertexCount < 0)
|
||||
{
|
||||
vertexCount = 0;
|
||||
}
|
||||
@@ -566,8 +568,8 @@ namespace Dreamteck.Splines
|
||||
__uvs.x = u * _uvScale.x - _uvOffset.x;
|
||||
switch (uvMode)
|
||||
{
|
||||
case UVMode.Clip: __uvs.y = CalculateUVClip(percent); break;
|
||||
case UVMode.Clamp: __uvs.y = CalculateUVClamp(percent); break;
|
||||
case UVMode.Clip: __uvs.y = CalculateUVClip(percent); break;
|
||||
case UVMode.Clamp: __uvs.y = CalculateUVClamp(percent); break;
|
||||
case UVMode.UniformClamp: __uvs.y = CalculateUVUniformClamp(_vDist); break;
|
||||
default: __uvs.y = CalculateUVUniformClip(_vDist); break;
|
||||
}
|
||||
@@ -595,7 +597,7 @@ namespace Dreamteck.Splines
|
||||
|
||||
protected float GetBaseSize(SplineSample sample)
|
||||
{
|
||||
return _useSplineSize? sample.size: 1f;
|
||||
return _useSplineSize ? sample.size : 1f;
|
||||
}
|
||||
|
||||
protected Color GetBaseColor(SplineSample sample)
|
||||
@@ -621,7 +623,7 @@ namespace Dreamteck.Splines
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
DestroyImmediate(_mesh);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(_mesh);
|
||||
@@ -633,5 +635,5 @@ namespace Dreamteck.Splines
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
executionOrder: -10
|
||||
icon: {fileID: 2800000, guid: 9bbaac8eb7021d44b9864113856c00fa, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||