mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
parent
72f8f98a54
commit
1f3dceed40
@ -42,7 +42,6 @@ namespace Spine {
|
||||
SpriteBatcher batcher;
|
||||
BasicEffect effect;
|
||||
RasterizerState rasterizerState;
|
||||
public bool PremultipliedAlpha { get; set; }
|
||||
float[] vertices = new float[8];
|
||||
|
||||
public SkeletonRenderer (GraphicsDevice device) {
|
||||
@ -64,7 +63,7 @@ namespace Spine {
|
||||
|
||||
public void Begin () {
|
||||
device.RasterizerState = rasterizerState;
|
||||
device.BlendState = BlendState.AlphaBlend;
|
||||
device.BlendState = BlendState.AlphaBlend; // spine-xna textures are premultiplied on load, see Util.cs.
|
||||
|
||||
effect.Projection = Matrix.CreateOrthographicOffCenter(0, device.Viewport.Width, device.Viewport.Height, 0, 1, 0);
|
||||
}
|
||||
@ -94,26 +93,12 @@ namespace Spine {
|
||||
AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject;
|
||||
item.Texture = (Texture2D)region.page.rendererObject;
|
||||
|
||||
byte r = (byte)(skeletonR * slot.R * 255);
|
||||
byte g = (byte)(skeletonG * slot.G * 255);
|
||||
byte b = (byte)(skeletonB * slot.B * 255);
|
||||
byte a = (byte)(skeletonA * slot.A * 255);
|
||||
item.vertexTL.Color.R = r;
|
||||
item.vertexTL.Color.G = g;
|
||||
item.vertexTL.Color.B = b;
|
||||
item.vertexTL.Color.A = a;
|
||||
item.vertexBL.Color.R = r;
|
||||
item.vertexBL.Color.G = g;
|
||||
item.vertexBL.Color.B = b;
|
||||
item.vertexBL.Color.A = a;
|
||||
item.vertexBR.Color.R = r;
|
||||
item.vertexBR.Color.G = g;
|
||||
item.vertexBR.Color.B = b;
|
||||
item.vertexBR.Color.A = a;
|
||||
item.vertexTR.Color.R = r;
|
||||
item.vertexTR.Color.G = g;
|
||||
item.vertexTR.Color.B = b;
|
||||
item.vertexTR.Color.A = a;
|
||||
float a = skeletonA * slot.A;
|
||||
Color color = new Color(skeletonR * slot.R * a, skeletonG * slot.G * a, skeletonB * slot.B * a, a);
|
||||
item.vertexTL.Color = color;
|
||||
item.vertexBL.Color = color;
|
||||
item.vertexBR.Color = color;
|
||||
item.vertexTR.Color = color;
|
||||
|
||||
float[] vertices = this.vertices;
|
||||
regionAttachment.ComputeWorldVertices(x, y, slot.Bone, vertices);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user