Loads and loads of small improvements I added while developing on my game

This commit is contained in:
Michel Fedde 2021-03-02 19:54:19 +01:00
parent 41421b1df9
commit a7c71e7ea1
107 changed files with 2278 additions and 1023 deletions

View file

@ -0,0 +1,26 @@
using System;
using OpenTK;
using SM.Base.Types;
namespace SM.Base.Drawing
{
public class TextureTransformation
{
public CVector2 Offset = new CVector2(0);
public CVector2 Scale = new CVector2(1);
public CVector1 Rotation = new CVector1(0);
public Matrix3 GetMatrix()
{
return CalculateMatrix(Offset, Scale, Rotation);
}
public static Matrix3 CalculateMatrix(Vector2 offset, Vector2 scale, float rotation)
{
float radians = MathHelper.DegreesToRadians(rotation);
Matrix3 result = Matrix3.CreateScale(scale.X, scale.Y, 1) * Matrix3.CreateRotationZ(radians);
result.Row2 = new Vector3(offset.X, offset.Y, 1);
return result;
}
}
}