mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
[xna][monogame] Fixed up renderer
This commit is contained in:
parent
e464a9fbba
commit
ac3201afca
@ -98,7 +98,7 @@ namespace Spine {
|
|||||||
Attachment attachment = slot.Attachment;
|
Attachment attachment = slot.Attachment;
|
||||||
if (attachment is RegionAttachment) {
|
if (attachment is RegionAttachment) {
|
||||||
RegionAttachment regionAttachment = (RegionAttachment)attachment;
|
RegionAttachment regionAttachment = (RegionAttachment)attachment;
|
||||||
BlendState blend = slot.Data.BlendMode == BlendMode.additive ? BlendState.Additive : defaultBlendState;
|
BlendState blend = slot.Data.BlendMode == BlendMode.Additive ? BlendState.Additive : defaultBlendState;
|
||||||
if (device.BlendState != blend) {
|
if (device.BlendState != blend) {
|
||||||
End();
|
End();
|
||||||
device.BlendState = blend;
|
device.BlendState = blend;
|
||||||
@ -129,29 +129,29 @@ namespace Spine {
|
|||||||
itemVertices[BR].Color = color;
|
itemVertices[BR].Color = color;
|
||||||
itemVertices[TR].Color = color;
|
itemVertices[TR].Color = color;
|
||||||
|
|
||||||
regionAttachment.ComputeWorldVertices(slot.Bone, vertices);
|
regionAttachment.ComputeWorldVertices(slot.Bone, vertices, 0, 2);
|
||||||
itemVertices[TL].Position.X = vertices[RegionAttachment.X1];
|
itemVertices[TL].Position.X = vertices[0];
|
||||||
itemVertices[TL].Position.Y = vertices[RegionAttachment.Y1];
|
itemVertices[TL].Position.Y = vertices[1];
|
||||||
itemVertices[TL].Position.Z = 0;
|
itemVertices[TL].Position.Z = 0;
|
||||||
itemVertices[BL].Position.X = vertices[RegionAttachment.X2];
|
itemVertices[BL].Position.X = vertices[2];
|
||||||
itemVertices[BL].Position.Y = vertices[RegionAttachment.Y2];
|
itemVertices[BL].Position.Y = vertices[3];
|
||||||
itemVertices[BL].Position.Z = 0;
|
itemVertices[BL].Position.Z = 0;
|
||||||
itemVertices[BR].Position.X = vertices[RegionAttachment.X3];
|
itemVertices[BR].Position.X = vertices[4];
|
||||||
itemVertices[BR].Position.Y = vertices[RegionAttachment.Y3];
|
itemVertices[BR].Position.Y = vertices[5];
|
||||||
itemVertices[BR].Position.Z = 0;
|
itemVertices[BR].Position.Z = 0;
|
||||||
itemVertices[TR].Position.X = vertices[RegionAttachment.X4];
|
itemVertices[TR].Position.X = vertices[6];
|
||||||
itemVertices[TR].Position.Y = vertices[RegionAttachment.Y4];
|
itemVertices[TR].Position.Y = vertices[7];
|
||||||
itemVertices[TR].Position.Z = 0;
|
itemVertices[TR].Position.Z = 0;
|
||||||
|
|
||||||
float[] uvs = regionAttachment.UVs;
|
float[] uvs = regionAttachment.UVs;
|
||||||
itemVertices[TL].TextureCoordinate.X = uvs[RegionAttachment.X1];
|
itemVertices[TL].TextureCoordinate.X = uvs[0];
|
||||||
itemVertices[TL].TextureCoordinate.Y = uvs[RegionAttachment.Y1];
|
itemVertices[TL].TextureCoordinate.Y = uvs[1];
|
||||||
itemVertices[BL].TextureCoordinate.X = uvs[RegionAttachment.X2];
|
itemVertices[BL].TextureCoordinate.X = uvs[2];
|
||||||
itemVertices[BL].TextureCoordinate.Y = uvs[RegionAttachment.Y2];
|
itemVertices[BL].TextureCoordinate.Y = uvs[3];
|
||||||
itemVertices[BR].TextureCoordinate.X = uvs[RegionAttachment.X3];
|
itemVertices[BR].TextureCoordinate.X = uvs[4];
|
||||||
itemVertices[BR].TextureCoordinate.Y = uvs[RegionAttachment.Y3];
|
itemVertices[BR].TextureCoordinate.Y = uvs[5];
|
||||||
itemVertices[TR].TextureCoordinate.X = uvs[RegionAttachment.X4];
|
itemVertices[TR].TextureCoordinate.X = uvs[6];
|
||||||
itemVertices[TR].TextureCoordinate.Y = uvs[RegionAttachment.Y4];
|
itemVertices[TR].TextureCoordinate.Y = uvs[7];
|
||||||
} else if (attachment is MeshAttachment) {
|
} else if (attachment is MeshAttachment) {
|
||||||
MeshAttachment mesh = (MeshAttachment)attachment;
|
MeshAttachment mesh = (MeshAttachment)attachment;
|
||||||
int vertexCount = mesh.WorldVerticesLength;
|
int vertexCount = mesh.WorldVerticesLength;
|
||||||
|
|||||||
@ -90,7 +90,7 @@ namespace Spine {
|
|||||||
Slot slot = drawOrderItems[i];
|
Slot slot = drawOrderItems[i];
|
||||||
RegionAttachment regionAttachment = slot.Attachment as RegionAttachment;
|
RegionAttachment regionAttachment = slot.Attachment as RegionAttachment;
|
||||||
if (regionAttachment != null) {
|
if (regionAttachment != null) {
|
||||||
BlendState blend = slot.Data.BlendMode == BlendMode.additive ? BlendState.Additive : defaultBlendState;
|
BlendState blend = slot.Data.BlendMode == BlendMode.Additive ? BlendState.Additive : defaultBlendState;
|
||||||
if (device.BlendState != blend) {
|
if (device.BlendState != blend) {
|
||||||
End();
|
End();
|
||||||
device.BlendState = blend;
|
device.BlendState = blend;
|
||||||
@ -113,29 +113,29 @@ namespace Spine {
|
|||||||
item.vertexTR.Color = color;
|
item.vertexTR.Color = color;
|
||||||
|
|
||||||
float[] vertices = this.vertices;
|
float[] vertices = this.vertices;
|
||||||
regionAttachment.ComputeWorldVertices(slot.Bone, vertices);
|
regionAttachment.ComputeWorldVertices(slot.Bone, vertices, 0, 2);
|
||||||
item.vertexTL.Position.X = vertices[RegionAttachment.X1];
|
item.vertexTL.Position.X = vertices[0];
|
||||||
item.vertexTL.Position.Y = vertices[RegionAttachment.Y1];
|
item.vertexTL.Position.Y = vertices[1];
|
||||||
item.vertexTL.Position.Z = 0;
|
item.vertexTL.Position.Z = 0;
|
||||||
item.vertexBL.Position.X = vertices[RegionAttachment.X2];
|
item.vertexBL.Position.X = vertices[2];
|
||||||
item.vertexBL.Position.Y = vertices[RegionAttachment.Y2];
|
item.vertexBL.Position.Y = vertices[3];
|
||||||
item.vertexBL.Position.Z = 0;
|
item.vertexBL.Position.Z = 0;
|
||||||
item.vertexBR.Position.X = vertices[RegionAttachment.X3];
|
item.vertexBR.Position.X = vertices[4];
|
||||||
item.vertexBR.Position.Y = vertices[RegionAttachment.Y3];
|
item.vertexBR.Position.Y = vertices[5];
|
||||||
item.vertexBR.Position.Z = 0;
|
item.vertexBR.Position.Z = 0;
|
||||||
item.vertexTR.Position.X = vertices[RegionAttachment.X4];
|
item.vertexTR.Position.X = vertices[6];
|
||||||
item.vertexTR.Position.Y = vertices[RegionAttachment.Y4];
|
item.vertexTR.Position.Y = vertices[7];
|
||||||
item.vertexTR.Position.Z = 0;
|
item.vertexTR.Position.Z = 0;
|
||||||
|
|
||||||
float[] uvs = regionAttachment.UVs;
|
float[] uvs = regionAttachment.UVs;
|
||||||
item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1];
|
item.vertexTL.TextureCoordinate.X = uvs[0];
|
||||||
item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1];
|
item.vertexTL.TextureCoordinate.Y = uvs[1];
|
||||||
item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2];
|
item.vertexBL.TextureCoordinate.X = uvs[2];
|
||||||
item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2];
|
item.vertexBL.TextureCoordinate.Y = uvs[3];
|
||||||
item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3];
|
item.vertexBR.TextureCoordinate.X = uvs[4];
|
||||||
item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3];
|
item.vertexBR.TextureCoordinate.Y = uvs[5];
|
||||||
item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4];
|
item.vertexTR.TextureCoordinate.X = uvs[6];
|
||||||
item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4];
|
item.vertexTR.TextureCoordinate.Y = uvs[7];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user