mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge pull request #46 from Dgizusse/master
Small fix and optimization when updating the mesh.
This commit is contained in:
commit
78d687e2db
@ -131,11 +131,24 @@ public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionFor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mesh.Clear();
|
||||||
|
|
||||||
mesh.vertices = vertices;
|
mesh.vertices = vertices;
|
||||||
mesh.colors = colors;
|
mesh.colors = colors;
|
||||||
mesh.uv = uvs;
|
mesh.uv = uvs;
|
||||||
mesh.triangles = triangles;
|
mesh.triangles = triangles;
|
||||||
mesh.RecalculateNormals();
|
|
||||||
|
if (skeletonDataAsset.sprites.normalGenerationMode != tk2dSpriteCollection.NormalGenerationMode.None) {
|
||||||
|
mesh.RecalculateNormals();
|
||||||
|
|
||||||
|
if (skeletonDataAsset.sprites.normalGenerationMode == tk2dSpriteCollection.NormalGenerationMode.NormalsAndTangents) {
|
||||||
|
Vector4[] tangents = new Vector4[mesh.normals.Length];
|
||||||
|
for (int t = 0; t < tangents.Length; ++t) {
|
||||||
|
tangents[t] = new Vector4(1, 0, 0, 1);
|
||||||
|
}
|
||||||
|
mesh.tangents = tangents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderer.sharedMaterial = skeletonDataAsset.sprites.spriteCollection.inst.materials[0];
|
renderer.sharedMaterial = skeletonDataAsset.sprites.spriteCollection.inst.materials[0];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user