1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00

Fixed StaticSpriteBatch handling rotated sprites incorrectly

This commit is contained in:
Ell 2022-01-02 22:58:01 +01:00
parent 04fab568f8
commit 2699d0e1c2
2 changed files with 29 additions and 8 deletions

View file

@ -49,6 +49,7 @@ Improvements
Fixes
- Fixed some end-of-line inconsistencies when using the Right text alignment
- Fixed StaticSpriteBatch handling rotated sprites incorrectly
Removals
- **Removed deprecated Misc versions of SoundEffectInfo and SoundEffectInstanceHandler**

View file

@ -367,18 +367,38 @@ namespace MLEM.Graphics {
private Item Add(Texture2D texture, Vector2 pos, Vector2 offset, Vector2 size, float sin, float cos, Color color, Vector2 texTl, Vector2 texBr, float depth) {
return this.Add(texture, depth,
new VertexPositionColorTexture(new Vector3(pos.X + offset.X * cos - offset.Y * sin, pos.Y + offset.X * sin + offset.Y * cos, depth), color, texTl),
new VertexPositionColorTexture(new Vector3(pos.X + (offset.X + size.X) * cos - offset.Y * sin, pos.Y + (offset.X + size.X) + offset.Y * cos, depth), color, new Vector2(texBr.X, texTl.Y)),
new VertexPositionColorTexture(new Vector3(pos.X + offset.X * cos - (offset.Y + size.Y) * sin, pos.Y + offset.X * sin + (offset.Y + size.Y) * cos, depth), color, new Vector2(texTl.X, texBr.Y)),
new VertexPositionColorTexture(new Vector3(pos.X + (offset.X + size.X) * cos - (offset.Y + size.Y) * sin, pos.Y + (offset.X + size.X) * sin + (offset.Y + size.Y) * cos, depth), color, texBr));
new VertexPositionColorTexture(new Vector3(
pos.X + offset.X * cos - offset.Y * sin,
pos.Y + offset.X * sin + offset.Y * cos, depth),
color, texTl),
new VertexPositionColorTexture(new Vector3(
pos.X + (offset.X + size.X) * cos - offset.Y * sin,
pos.Y + (offset.X + size.X) * sin + offset.Y * cos, depth),
color, new Vector2(texBr.X, texTl.Y)),
new VertexPositionColorTexture(new Vector3(
pos.X + offset.X * cos - (offset.Y + size.Y) * sin,
pos.Y + offset.X * sin + (offset.Y + size.Y) * cos, depth),
color, new Vector2(texTl.X, texBr.Y)),
new VertexPositionColorTexture(new Vector3(
pos.X + (offset.X + size.X) * cos - (offset.Y + size.Y) * sin,
pos.Y + (offset.X + size.X) * sin + (offset.Y + size.Y) * cos, depth),
color, texBr));
}
private Item Add(Texture2D texture, Vector2 pos, Vector2 size, Color color, Vector2 texTl, Vector2 texBr, float depth) {
return this.Add(texture, depth,
new VertexPositionColorTexture(new Vector3(pos, depth), color, texTl),
new VertexPositionColorTexture(new Vector3(pos.X + size.X, pos.Y, depth), color, new Vector2(texBr.X, texTl.Y)),
new VertexPositionColorTexture(new Vector3(pos.X, pos.Y + size.Y, depth), color, new Vector2(texTl.X, texBr.Y)),
new VertexPositionColorTexture(new Vector3(pos.X + size.X, pos.Y + size.Y, depth), color, texBr));
new VertexPositionColorTexture(
new Vector3(pos, depth),
color, texTl),
new VertexPositionColorTexture(
new Vector3(pos.X + size.X, pos.Y, depth),
color, new Vector2(texBr.X, texTl.Y)),
new VertexPositionColorTexture(
new Vector3(pos.X, pos.Y + size.Y, depth),
color, new Vector2(texTl.X, texBr.Y)),
new VertexPositionColorTexture(
new Vector3(pos.X + size.X, pos.Y + size.Y, depth),
color, texBr));
}
private Item Add(Texture2D texture, float depth, VertexPositionColorTexture tl, VertexPositionColorTexture tr, VertexPositionColorTexture bl, VertexPositionColorTexture br) {