mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
one more is + as -> as + null check
This commit is contained in:
parent
0b86e3330a
commit
905890f7ca
@ -303,8 +303,8 @@ public class SkeletonRenderer : MonoBehaviour {
|
|||||||
} else {
|
} else {
|
||||||
if (!renderMeshes)
|
if (!renderMeshes)
|
||||||
continue;
|
continue;
|
||||||
if (attachment is MeshAttachment) {
|
MeshAttachment meshAttachment = attachment as MeshAttachment;
|
||||||
MeshAttachment meshAttachment = (MeshAttachment)attachment;
|
if (meshAttachment != null) {
|
||||||
int meshVertexCount = meshAttachment.vertices.Length;
|
int meshVertexCount = meshAttachment.vertices.Length;
|
||||||
if (tempVertices.Length < meshVertexCount)
|
if (tempVertices.Length < meshVertexCount)
|
||||||
this.tempVertices = tempVertices = new float[meshVertexCount];
|
this.tempVertices = tempVertices = new float[meshVertexCount];
|
||||||
@ -327,21 +327,22 @@ public class SkeletonRenderer : MonoBehaviour {
|
|||||||
uvs[vertexIndex].x = meshUVs[ii];
|
uvs[vertexIndex].x = meshUVs[ii];
|
||||||
uvs[vertexIndex].y = meshUVs[ii + 1];
|
uvs[vertexIndex].y = meshUVs[ii + 1];
|
||||||
}
|
}
|
||||||
} else if (attachment is SkinnedMeshAttachment) {
|
} else {
|
||||||
SkinnedMeshAttachment meshAttachment = (SkinnedMeshAttachment)attachment;
|
SkinnedMeshAttachment skinnedMeshAttachment = attachment as SkinnedMeshAttachment;
|
||||||
int meshVertexCount = meshAttachment.uvs.Length;
|
if (skinnedMeshAttachment != null) {
|
||||||
|
int meshVertexCount = skinnedMeshAttachment.uvs.Length;
|
||||||
if (tempVertices.Length < meshVertexCount)
|
if (tempVertices.Length < meshVertexCount)
|
||||||
this.tempVertices = tempVertices = new float[meshVertexCount];
|
this.tempVertices = tempVertices = new float[meshVertexCount];
|
||||||
meshAttachment.ComputeWorldVertices(slot, tempVertices);
|
skinnedMeshAttachment.ComputeWorldVertices(slot, tempVertices);
|
||||||
|
|
||||||
color.a = (byte)(a * slot.a * meshAttachment.a);
|
color.a = (byte)(a * slot.a * skinnedMeshAttachment.a);
|
||||||
color.r = (byte)(r * slot.r * meshAttachment.r * color.a);
|
color.r = (byte)(r * slot.r * skinnedMeshAttachment.r * color.a);
|
||||||
color.g = (byte)(g * slot.g * meshAttachment.g * color.a);
|
color.g = (byte)(g * slot.g * skinnedMeshAttachment.g * color.a);
|
||||||
color.b = (byte)(b * slot.b * meshAttachment.b * color.a);
|
color.b = (byte)(b * slot.b * skinnedMeshAttachment.b * color.a);
|
||||||
if (slot.data.additiveBlending)
|
if (slot.data.additiveBlending)
|
||||||
color.a = 0;
|
color.a = 0;
|
||||||
|
|
||||||
float[] meshUVs = meshAttachment.uvs;
|
float[] meshUVs = skinnedMeshAttachment.uvs;
|
||||||
float z = i * zSpacing;
|
float z = i * zSpacing;
|
||||||
for (int ii = 0; ii < meshVertexCount; ii += 2, vertexIndex++) {
|
for (int ii = 0; ii < meshVertexCount; ii += 2, vertexIndex++) {
|
||||||
vertices[vertexIndex].x = tempVertices[ii];
|
vertices[vertexIndex].x = tempVertices[ii];
|
||||||
@ -354,6 +355,7 @@ public class SkeletonRenderer : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Double buffer mesh.
|
// Double buffer mesh.
|
||||||
Mesh mesh = useMesh1 ? mesh1 : mesh2;
|
Mesh mesh = useMesh1 ? mesh1 : mesh2;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user