mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-02 05:39:07 +08:00
parent
72f8f98a54
commit
1f3dceed40
@ -42,7 +42,6 @@ namespace Spine {
|
|||||||
SpriteBatcher batcher;
|
SpriteBatcher batcher;
|
||||||
BasicEffect effect;
|
BasicEffect effect;
|
||||||
RasterizerState rasterizerState;
|
RasterizerState rasterizerState;
|
||||||
public bool PremultipliedAlpha { get; set; }
|
|
||||||
float[] vertices = new float[8];
|
float[] vertices = new float[8];
|
||||||
|
|
||||||
public SkeletonRenderer (GraphicsDevice device) {
|
public SkeletonRenderer (GraphicsDevice device) {
|
||||||
@ -64,7 +63,7 @@ namespace Spine {
|
|||||||
|
|
||||||
public void Begin () {
|
public void Begin () {
|
||||||
device.RasterizerState = rasterizerState;
|
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);
|
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;
|
AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject;
|
||||||
item.Texture = (Texture2D)region.page.rendererObject;
|
item.Texture = (Texture2D)region.page.rendererObject;
|
||||||
|
|
||||||
byte r = (byte)(skeletonR * slot.R * 255);
|
float a = skeletonA * slot.A;
|
||||||
byte g = (byte)(skeletonG * slot.G * 255);
|
Color color = new Color(skeletonR * slot.R * a, skeletonG * slot.G * a, skeletonB * slot.B * a, a);
|
||||||
byte b = (byte)(skeletonB * slot.B * 255);
|
item.vertexTL.Color = color;
|
||||||
byte a = (byte)(skeletonA * slot.A * 255);
|
item.vertexBL.Color = color;
|
||||||
item.vertexTL.Color.R = r;
|
item.vertexBR.Color = color;
|
||||||
item.vertexTL.Color.G = g;
|
item.vertexTR.Color = color;
|
||||||
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[] vertices = this.vertices;
|
float[] vertices = this.vertices;
|
||||||
regionAttachment.ComputeWorldVertices(x, y, slot.Bone, vertices);
|
regionAttachment.ComputeWorldVertices(x, y, slot.Bone, vertices);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user