mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Vector documentation
This commit is contained in:
@@ -8,6 +8,9 @@ using GlitchyEngine.Math.Attributes;
|
||||
|
||||
namespace GlitchyEngine.Math;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a vector with two single-precision floating-point values.
|
||||
/// </summary>
|
||||
[Vector(typeof(float), 2, "float")]
|
||||
[ComparableVector]
|
||||
[VectorMath]
|
||||
@@ -16,15 +19,30 @@ namespace GlitchyEngine.Math;
|
||||
[VectorCast(typeof(half2), true)]
|
||||
public partial struct float2
|
||||
{
|
||||
/// <summary>
|
||||
/// A vector whose elements are all equal to zero.
|
||||
/// </summary>
|
||||
public static readonly float2 Zero = new(0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (1, 0).
|
||||
/// </summary>
|
||||
public static readonly float2 UnitX = new(1.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 1).
|
||||
/// </summary>
|
||||
public static readonly float2 UnitY = new(0.0f, 1.0f);
|
||||
/// <summary>
|
||||
/// A vector whose elements are all equal to one.
|
||||
/// </summary>
|
||||
public static readonly float2 One = new(0.0f, 0.0f);
|
||||
|
||||
public static explicit operator Vector2(float2 self) => new(self.X, self.Y);
|
||||
public static explicit operator float2(Vector2 self) => new(self.X, self.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a vector with three single-precision floating-point values.
|
||||
/// </summary>
|
||||
[Vector(typeof(float), 3, "float")]
|
||||
[ComparableVector]
|
||||
[VectorMath]
|
||||
@@ -33,23 +51,59 @@ public partial struct float2
|
||||
[VectorCast(typeof(half3), true)]
|
||||
public partial struct float3
|
||||
{
|
||||
/// <summary>
|
||||
/// A vector whose elements are all equal to zero.
|
||||
/// </summary>
|
||||
public static readonly float3 Zero = new(0.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (1, 0, 0).
|
||||
/// </summary>
|
||||
public static readonly float3 UnitX = new(1.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 1, 0).
|
||||
/// </summary>
|
||||
public static readonly float3 UnitY = new(0.0f, 1.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 0, 1).
|
||||
/// </summary>
|
||||
public static readonly float3 UnitZ = new(0.0f, 0.0f, 1.0f);
|
||||
/// <summary>
|
||||
/// A vector whose elements are all equal to one.
|
||||
/// </summary>
|
||||
public static readonly float3 One = new(0.0f, 0.0f, 0.0f);
|
||||
|
||||
/// <summary>
|
||||
/// The vector (0, 0, 1).
|
||||
/// </summary>
|
||||
public static readonly float3 Forward = new(0.0f, 0.0f, 1.0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 0, -1).
|
||||
/// </summary>
|
||||
public static readonly float3 Backward = new(0.0f, 0.0f, -1.0f);
|
||||
/// <summary>
|
||||
/// The vector (-1, 0, 0).
|
||||
/// </summary>
|
||||
public static readonly float3 Left = new(-1.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (1, 0, 0).
|
||||
/// </summary>
|
||||
public static readonly float3 Right = new(1.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 1, 0).
|
||||
/// </summary>
|
||||
public static readonly float3 Up = new(0.0f, 1.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// The vector (0, -1, 0).
|
||||
/// </summary>
|
||||
public static readonly float3 Down = new(0.0f, -1.0f, 0.0f);
|
||||
|
||||
public static explicit operator Vector3(float3 self) => new(self.X, self.Y, self.Z);
|
||||
public static explicit operator float3(Vector3 self) => new(self.X, self.Y, self.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a vector with four single-precision floating-point values.
|
||||
/// </summary>
|
||||
[Vector(typeof(float), 4, "float")]
|
||||
[ComparableVector]
|
||||
[VectorMath]
|
||||
@@ -58,11 +112,29 @@ public partial struct float3
|
||||
[VectorCast(typeof(half4), true)]
|
||||
public partial struct float4
|
||||
{
|
||||
/// <summary>
|
||||
/// A vector whose elements are all equal to zero.
|
||||
/// </summary>
|
||||
public static readonly float4 Zero = new(0f, 0f, 0f, 0f);
|
||||
/// <summary>
|
||||
/// The vector (1, 0, 0, 0).
|
||||
/// </summary>
|
||||
public static readonly float4 UnitX = new(1f, 0f, 0f, 0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 1, 0, 0).
|
||||
/// </summary>
|
||||
public static readonly float4 UnitY = new(0f, 1f, 0f, 0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 0, 1, 0).
|
||||
/// </summary>
|
||||
public static readonly float4 UnitZ = new(0f, 0f, 1f, 0f);
|
||||
/// <summary>
|
||||
/// The vector (0, 0, 0, 1).
|
||||
/// </summary>
|
||||
public static readonly float4 UnitW = new(0f, 0f, 0f, 1f);
|
||||
/// <summary>
|
||||
/// A vector whose elements are all equal to one.
|
||||
/// </summary>
|
||||
public static readonly float4 One = new(1f, 1f, 1f, 1f);
|
||||
|
||||
public static explicit operator Vector4(float4 self) => new(self.X, self.Y, self.Z, self.W);
|
||||
|
||||
Reference in New Issue
Block a user