Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Half4 Struct

    Namespace: Stride.Core.Mathematics
    Assembly: Stride.Core.Mathematics.dll

    Represents a four dimensional mathematical vector with half-precision floats.

    [DataContract]
    public struct Half4 : IEquatable<Half4>
    Name Description
    Constructors
    Half4(Half)

    Initializes a new instance of the Half4 structure.

    Half4(Half, Half, Half, Half)

    Initializes a new instance of the Half4 structure.

    Half4(Half[])

    Initializes a new instance of the Half4 struct.

    Half4(Single)

    Initializes a new instance of the Half4 structure.

    Half4(Single, Single, Single, Single)

    Initializes a new instance of the Half4 structure.

    Fields
    One

    A Half4 with all of its components set to one.

    SizeInBytes

    The size of the Half4 type, in bytes.

    UnitW

    The W unit Half4 (0, 0, 0, 1).

    UnitX

    The X unit Half4 (1, 0, 0, 0).

    UnitY

    The Y unit Half4 (0, 1, 0, 0).

    UnitZ

    The Z unit Half4 (0, 0, 1, 0).

    W

    Gets or sets the W component of the vector.

    X

    Gets or sets the X component of the vector.

    Y

    Gets or sets the Y component of the vector.

    Z

    Gets or sets the Z component of the vector.

    Zero

    A Half4 with all of its components set to zero.

    Methods
    Equals(Half4)

    Returns a value that indicates whether the current instance is equal to the specified object.

    Equals(ref Half4, ref Half4)

    Determines whether the specified object instances are considered equal.

    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

    GetHashCode()

    Returns the hash code for this instance.

    Operators
    Equality(Half4, Half4)

    Tests for equality between two objects.

    Explicit(Half4 to Vector4)

    Performs an explicit conversion from Half4 to Vector4.

    Explicit(Vector4 to Half4)

    Performs an explicit conversion from Vector4 to Half4.

    Inequality(Half4, Half4)

    Tests for inequality between two objects.

    | Improve this Doc View Source

    Constructors


    Half4(Half)

    Initializes a new instance of the Half4 structure.

    public Half4(Half value)
    Parameters
    Type Name Description
    Half value

    The value to set for the X, Y, Z, and W components.


    Half4(Half, Half, Half, Half)

    Initializes a new instance of the Half4 structure.

    public Half4(Half x, Half y, Half z, Half w)
    Parameters
    Type Name Description
    Half x

    The X component.

    Half y

    The Y component.

    Half z

    The Z component.

    Half w

    The W component.


    Half4(Half[])

    Initializes a new instance of the Half4 struct.

    public Half4(Half[] values)
    Parameters
    Type Name Description
    Half[] values

    The values to assign to the X, Y, Z, and W components of the vector. This must be an array with four elements.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than four elements.


    Half4(Single)

    Initializes a new instance of the Half4 structure.

    public Half4(float value)
    Parameters
    Type Name Description
    System.Single value

    The value to set for the X, Y, Z, and W components.


    Half4(Single, Single, Single, Single)

    Initializes a new instance of the Half4 structure.

    public Half4(float x, float y, float z, float w)
    Parameters
    Type Name Description
    System.Single x

    The X component.

    System.Single y

    The Y component.

    System.Single z

    The Z component.

    System.Single w

    The W component.

    | Improve this Doc View Source

    Fields


    One

    A Half4 with all of its components set to one.

    public static readonly Half4 One
    Field Value
    Type Description
    Half4

    SizeInBytes

    The size of the Half4 type, in bytes.

    public static readonly int SizeInBytes
    Field Value
    Type Description
    System.Int32

    UnitW

    The W unit Half4 (0, 0, 0, 1).

    public static readonly Half4 UnitW
    Field Value
    Type Description
    Half4

    UnitX

    The X unit Half4 (1, 0, 0, 0).

    public static readonly Half4 UnitX
    Field Value
    Type Description
    Half4

    UnitY

    The Y unit Half4 (0, 1, 0, 0).

    public static readonly Half4 UnitY
    Field Value
    Type Description
    Half4

    UnitZ

    The Z unit Half4 (0, 0, 1, 0).

    public static readonly Half4 UnitZ
    Field Value
    Type Description
    Half4

    W

    Gets or sets the W component of the vector.

    public Half W
    Field Value
    Type Description
    Half

    The W component of the vector.


    X

    Gets or sets the X component of the vector.

    public Half X
    Field Value
    Type Description
    Half

    The X component of the vector.


    Y

    Gets or sets the Y component of the vector.

    public Half Y
    Field Value
    Type Description
    Half

    The Y component of the vector.


    Z

    Gets or sets the Z component of the vector.

    public Half Z
    Field Value
    Type Description
    Half

    The Z component of the vector.


    Zero

    A Half4 with all of its components set to zero.

    public static readonly Half4 Zero
    Field Value
    Type Description
    Half4
    | Improve this Doc View Source

    Methods


    Equals(Half4)

    Returns a value that indicates whether the current instance is equal to the specified object.

    public bool Equals(Half4 other)
    Parameters
    Type Name Description
    Half4 other

    Object to make the comparison with.

    Returns
    Type Description
    System.Boolean

    true if the current instance is equal to the specified object; false otherwise.


    Equals(ref Half4, ref Half4)

    Determines whether the specified object instances are considered equal.

    public static bool Equals(ref Half4 value1, ref Half4 value2)
    Parameters
    Type Name Description
    Half4 value1

    The first value.

    Half4 value2

    The second value.

    Returns
    Type Description
    System.Boolean

    true if value1 is the same instance as value2 or if both are null references or if value1.Equals(value2) returns true; otherwise, false.


    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    Object to make the comparison with.

    Returns
    Type Description
    System.Boolean

    true if the current instance is equal to the specified object; false otherwise.

    Overrides
    System.ValueType.Equals(System.Object)

    GetHashCode()

    Returns the hash code for this instance.

    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    A 32-bit signed integer hash code.

    Overrides
    System.ValueType.GetHashCode()
    | Improve this Doc View Source

    Operators


    Equality(Half4, Half4)

    Tests for equality between two objects.

    public static bool operator ==(Half4 left, Half4 right)
    Parameters
    Type Name Description
    Half4 left

    The first value to compare.

    Half4 right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has the same value as right; otherwise, false.


    Explicit(Half4 to Vector4)

    Performs an explicit conversion from Half4 to Vector4.

    public static explicit operator Vector4(Half4 value)
    Parameters
    Type Name Description
    Half4 value

    The value.

    Returns
    Type Description
    Vector4

    The result of the conversion.


    Explicit(Vector4 to Half4)

    Performs an explicit conversion from Vector4 to Half4.

    public static explicit operator Half4(Vector4 value)
    Parameters
    Type Name Description
    Vector4 value

    The value.

    Returns
    Type Description
    Half4

    The result of the conversion.


    Inequality(Half4, Half4)

    Tests for inequality between two objects.

    public static bool operator !=(Half4 left, Half4 right)
    Parameters
    Type Name Description
    Half4 left

    The first value to compare.

    Half4 right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has a different value than right; otherwise, false.


    Inherited Members

    System.ValueType.ToString()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation