public readonly struct Vector4A four-component vector: homogeneous positions, shader constants, tangents with a handedness sign, and anything that has to match a GPU float4 byte for byte.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Sixteen bytes, sequentially laid out, so it reinterprets to and from Vector128`1 with no work at all — which is what the matrix code relies on.
Fields and properties (16)
public const int ComponentCountNumber of components.
public readonly float XThe X component.
public readonly float YThe Y component.
public readonly float ZThe Z component.
public readonly float WThe W component.
public static Vector4 ZeroAll components zero.
public static Vector4 OneAll components one.
public static Vector4 UnitXThe X axis.
public static Vector4 UnitYThe Y axis.
public static Vector4 UnitZThe Z axis.
public static Vector4 UnitWThe W axis.
public Vector3 XyzThe X, Y and Z components.
public Vector2 XyThe X and Y components.
public float this[int index]The component at .
public bool IsZeroWhether every component is zero.
public bool IsNaNWhether any component is NaN.
Methods (37)
public Vector4(float x, float y, float z, float w)Builds a vector from its components.
public Vector4(float value)Builds a vector with every component set to .
public Vector4(Vector3 xyz, float w)Extends a Vector3 with a W component.
public ReadOnlySpan<float> AsSpan()The components as a span. Valid as long as the vector it came from.
public void CopyTo(Span<float> destination)Copies the components into a caller-owned span.
public Vector128<float> AsVector128()Reinterprets the vector as a SIMD register. Free — the layouts are identical.
public static Vector4 FromVector128(Vector128<float> value)Reinterprets a SIMD register as a vector. Free — the layouts are identical.
public float Length()The length of the vector.
public float LengthSquared()The squared length, which avoids a square root where only comparison matters.
public static Vector4 Normalize(Vector4 value)The vector scaled to unit length; Zero if it is degenerate.
public static float Dot(Vector4 left, Vector4 right)The dot product.
public static float Distance(Vector4 left, Vector4 right)The distance between two points.
public static Vector4 Lerp(Vector4 from, Vector4 to, float amount)Linearly interpolates between two vectors.
public static Vector4 Min(Vector4 left, Vector4 right)The component-wise minimum.
public static Vector4 Max(Vector4 left, Vector4 right)The component-wise maximum.
public static Vector4 Clamp(Vector4 value, Vector4 min, Vector4 max)Constrains each component to the matching interval.
public static Vector4 Abs(Vector4 value)The component-wise absolute value.
public static bool NearEqual(Vector4 left, Vector4 right, float tolerance = 1E-06)Whether two vectors agree to within a tolerance, component by component.
public static Vector4 operator +(Vector4 left, Vector4 right)Adds two vectors.
public static Vector4 operator -(Vector4 left, Vector4 right)Subtracts one vector from another.
public static Vector4 operator -(Vector4 value)Negates a vector.
public static Vector4 operator *(Vector4 left, Vector4 right)Multiplies component by component.
public static Vector4 operator *(Vector4 value, float scale)Scales a vector.
public static Vector4 operator *(float scale, Vector4 value)Scales a vector.
public static Vector4 operator /(Vector4 left, Vector4 right)Divides component by component.
public static Vector4 operator /(Vector4 value, float divisor)Divides a vector by a scalar.
public static bool operator ==(Vector4 left, Vector4 right)Exact component-wise equality, IEEE semantics. See NearEqual.
public static bool operator !=(Vector4 left, Vector4 right)The negation of op_Equality.
public static implicit operator Vector4(Vector4 value)Converts to the BCL vector, which has the same layout.
public static implicit operator Vector4(Vector4 value)Converts from the BCL vector, which has the same layout.
public void Deconstruct(out float x, out float y, out float z, out float w)Splits the vector into its components.
public bool Equals(Vector4 other)Indicates whether the current object is equal to another object of the same type.
public override bool Equals(object? obj)Indicates whether this instance and a specified object are equal.
public override int GetHashCode()Returns the hash code for this instance.
public override string ToString()Returns the fully qualified type name of this instance.
public string ToString(string? format, IFormatProvider? formatProvider)Formats the value of the current instance using the specified format.
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default(ReadOnlySpan<char>), IFormatProvider? provider = null)Tries to format the value of the current instance into the provided span of characters.
Used by (163, showing 40)
- DrawConstantsPbrShowcase
- PbrShowcaseGamePbrShowcase
- ViewConstantsPbrShowcase
- MatrixBenchmarksVixen.Benchmarks.Math
- SweepBenchmarksVixen.Benchmarks.Vfx
- AccelerationStructureDeviceTestsVixen.Graphics.Golden.Tests
- AmbientCombineTestsVixen.Rendering.PostFx.Tests
- BoundingFrustumVixen.Core.Mathematics
- CaseVixen.Rendering.Tests
- ClusterAttributeTestsVixen.Rendering.Tests
- ClusterAttributesVixen.Rendering
- ClusteredLightingTestsVixen.Rendering.Tests
- Color4Vixen.Core.Mathematics
- ColorTestsVixen.Core.Mathematics.Tests
- CompositorImageTestsVixen.Graphics.Golden.Tests
- ConstantsVixen.Rendering
- ConventionTestsVixen.Core.Mathematics.Tests
- DelaunayTetrahedralizationVixen.Core.Mathematics
- DelaunayTetrahedralizationTestsVixen.Core.Mathematics.Tests
- EditorGizmoFacingDeviceTestsVixen.Graphics.Golden.Tests
- EffectLoaderVixen.Shaders
- FoliageCullParityTestsVixen.Rendering.Terrain.Tests
- FoliageCullViewRecordVixen.Rendering.Terrain
- GeneratedBindingsTestsVixen.Shaders.Tests
- GpuClusterCullingVixen.Rendering
- GpuCullingVixen.Rendering
- ImpostorCaptureConstantsVixen.Rendering
- ImpostorCaptureKeysVixen.Rendering
- Int4Vixen.Core.Mathematics
- LightProbeVolumeVixen.Rendering
- MaterialSurfaceTestsVixen.Rendering.Tests
- MathScalarsVixen.Core.Yaml
- Matrix4x4Vixen.Core.Mathematics
- MeshDataVixen.Rendering
- MeshInstanceVixen.Rendering
- MeshInstanceRendererTestsVixen.Rendering.Tests
- MeshRenderFeatureTestsVixen.Rendering.Tests
- MeshRendererVixen.Rendering
- MeshletBuildInputVixen.Rendering.VirtualGeometry
- MeshletPageSetVixen.Rendering.VirtualGeometry