remove empty struct constructors for language compatibility

main
cosmonaut 2022-06-20 13:04:44 -07:00
parent 97fad21c0c
commit b23792acd0
3 changed files with 26 additions and 24 deletions

View File

@ -8,11 +8,11 @@
public VertexBinding[] VertexBindings; public VertexBinding[] VertexBindings;
public VertexAttribute[] VertexAttributes; public VertexAttribute[] VertexAttributes;
public VertexInputState() public static readonly VertexInputState Empty = new VertexInputState
{ {
VertexBindings = new VertexBinding[0]; VertexBindings = new VertexBinding[0],
VertexAttributes = new VertexAttribute[0]; VertexAttributes = new VertexAttribute[0]
} };
public VertexInputState( public VertexInputState(
VertexBinding vertexBinding, VertexBinding vertexBinding,

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Math.Fixed namespace MoonWorks.Math.Fixed
{ {
public struct Transform2D : System.IEquatable<Transform2D> public struct Transform2D : System.IEquatable<Transform2D>
{ {
@ -6,8 +6,9 @@ namespace MoonWorks.Math.Fixed
public Fix64 Rotation { get; } public Fix64 Rotation { get; }
public Vector2 Scale { get; } public Vector2 Scale { get; }
private bool transformMatrixCalculated = false; private bool transformMatrixCalculated;
private Matrix3x2 transformMatrix = Matrix3x2.Identity; private Matrix3x2 transformMatrix;
public Matrix3x2 TransformMatrix public Matrix3x2 TransformMatrix
{ {
get get
@ -25,20 +26,15 @@ namespace MoonWorks.Math.Fixed
public bool IsAxisAligned => Rotation % Fix64.PiOver2 == Fix64.Zero; public bool IsAxisAligned => Rotation % Fix64.PiOver2 == Fix64.Zero;
public bool IsUniformScale => Scale.X == Scale.Y; public bool IsUniformScale => Scale.X == Scale.Y;
public static Transform2D Identity = new Transform2D(Vector2.Zero, Fix64.Zero, Vector2.One); public static readonly Transform2D Identity = new Transform2D(Vector2.Zero, Fix64.Zero, Vector2.One);
public Transform2D()
{
Position = Vector2.Zero;
Rotation = Fix64.Zero;
Scale = Vector2.One;
}
public Transform2D(Vector2 position) public Transform2D(Vector2 position)
{ {
Position = position; Position = position;
Rotation = Fix64.Zero; Rotation = Fix64.Zero;
Scale = Vector2.One; Scale = Vector2.One;
transformMatrixCalculated = false;
transformMatrix = Matrix3x2.Identity;
} }
public Transform2D(Vector2 position, Fix64 rotation) public Transform2D(Vector2 position, Fix64 rotation)
@ -46,6 +42,8 @@ namespace MoonWorks.Math.Fixed
Position = position; Position = position;
Rotation = rotation; Rotation = rotation;
Scale = Vector2.One; Scale = Vector2.One;
transformMatrixCalculated = false;
transformMatrix = Matrix3x2.Identity;
} }
public Transform2D(Vector2 position, Fix64 rotation, Vector2 scale) public Transform2D(Vector2 position, Fix64 rotation, Vector2 scale)
@ -53,6 +51,8 @@ namespace MoonWorks.Math.Fixed
Position = position; Position = position;
Rotation = rotation; Rotation = rotation;
Scale = scale; Scale = scale;
transformMatrixCalculated = false;
transformMatrix = Matrix3x2.Identity;
} }
public Transform2D Compose(Transform2D other) public Transform2D Compose(Transform2D other)

View File

@ -1,4 +1,4 @@
namespace MoonWorks.Math.Float namespace MoonWorks.Math.Float
{ {
public struct Transform2D : System.IEquatable<Transform2D> public struct Transform2D : System.IEquatable<Transform2D>
{ {
@ -6,8 +6,9 @@ namespace MoonWorks.Math.Float
public float Rotation { get; } public float Rotation { get; }
public Vector2 Scale { get; } public Vector2 Scale { get; }
private bool transformMatrixCalculated = false; private bool transformMatrixCalculated;
private Matrix3x2 transformMatrix = Matrix3x2.Identity; private Matrix3x2 transformMatrix;
public Matrix3x2 TransformMatrix public Matrix3x2 TransformMatrix
{ {
get get
@ -25,18 +26,15 @@ namespace MoonWorks.Math.Float
public bool IsAxisAligned => Rotation % MathHelper.PiOver2 == 0; public bool IsAxisAligned => Rotation % MathHelper.PiOver2 == 0;
public bool IsUniformScale => Scale.X == Scale.Y; public bool IsUniformScale => Scale.X == Scale.Y;
public Transform2D() public static readonly Transform2D Identity = new Transform2D(Vector2.Zero, 0, Vector2.One);
{
Position = Vector2.Zero;
Rotation = 0;
Scale = Vector2.One;
}
public Transform2D(Vector2 position) public Transform2D(Vector2 position)
{ {
Position = position; Position = position;
Rotation = 0; Rotation = 0;
Scale = Vector2.One; Scale = Vector2.One;
transformMatrixCalculated = false;
transformMatrix = Matrix3x2.Identity;
} }
public Transform2D(Vector2 position, float rotation) public Transform2D(Vector2 position, float rotation)
@ -44,6 +42,8 @@ namespace MoonWorks.Math.Float
Position = position; Position = position;
Rotation = rotation; Rotation = rotation;
Scale = Vector2.One; Scale = Vector2.One;
transformMatrixCalculated = false;
transformMatrix = Matrix3x2.Identity;
} }
public Transform2D(Vector2 position, float rotation, Vector2 scale) public Transform2D(Vector2 position, float rotation, Vector2 scale)
@ -51,6 +51,8 @@ namespace MoonWorks.Math.Float
Position = position; Position = position;
Rotation = rotation; Rotation = rotation;
Scale = scale; Scale = scale;
transformMatrixCalculated = false;
transformMatrix = Matrix3x2.Identity;
} }
public Transform2D Compose(Transform2D other) public Transform2D Compose(Transform2D other)