Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:SharpDX.Mathematics.Half3" /> structure.
 /// </summary>
 /// <param name="x">The X component.</param>
 /// <param name="y">The Y component.</param>
 /// <param name="z">The Z component.</param>
 public Half3(ushort x, ushort y, ushort z)
 {
     this.X = new Half(x);
     this.Y = new Half(y);
     this.Z = new Half(z);
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:SharpDX.Mathematics.Half3" /> structure.
 /// </summary>
 /// <param name="value">The value to set for the X, Y, and Z components.</param>
 public Half3(Half value)
 {
     this.X = value;
     this.Y = value;
     this.Z = value;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:SharpDX.Mathematics.Half3" /> structure.
 /// </summary>
 /// <param name="x">The X component.</param>
 /// <param name="y">The Y component.</param>
 /// <param name="z">The Z component.</param>
 public Half3(Half x, Half y, Half z)
 {
     this.X = x;
     this.Y = y;
     this.Z = z;
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:SharpDX.Mathematics.Half3" /> structure.
 /// </summary>
 /// <param name="x">The X component.</param>
 /// <param name="y">The Y component.</param>
 /// <param name="z">The Z component.</param>
 public Half3(float x, float y, float z)
 {
     this.X = new Half(x);
     this.Y = new Half(y);
     this.Z = new Half(z);
 }
Beispiel #5
0
 /// <summary>
 /// Returns a value that indicates whether the current instance is equal to the specified object.
 /// </summary>
 /// <param name = "other">Object to make the comparison with.</param>
 /// <returns>
 /// <c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
 public bool Equals(Half other)
 {
     return(other.value == value);
 }
 public void Serialize(ref Half value)
 {
     if (Mode == SerializerMode.Write)
     {
         Writer.Write(value.RawValue);
     }
     else
     {
         value.RawValue = Reader.ReadUInt16();
     }
 }
Beispiel #7
0
 /// <summary>
 /// Determines whether the specified object instances are considered equal.
 /// </summary>
 /// <param name = "value1" />
 /// <param name = "value2" />
 /// <returns>
 /// <c>true</c> if <paramref name = "value1" /> is the same instance as <paramref name = "value2" /> or
 /// if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>
 public static bool Equals(ref Half value1, ref Half value2)
 {
     return(value1.value == value2.value);
 }
Beispiel #8
0
 /// <summary>
 /// Returns a value that indicates whether the current instance is equal to the specified object.
 /// </summary>
 /// <param name = "other">Object to make the comparison with.</param>
 /// <returns>
 /// <c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
 public bool Equals(Half other)
 {
     return other.value == value;
 }
Beispiel #9
0
 /// <summary>
 /// Determines whether the specified object instances are considered equal.
 /// </summary>
 /// <param name = "value1" />
 /// <param name = "value2" />
 /// <returns>
 /// <c>true</c> if <paramref name = "value1" /> is the same instance as <paramref name = "value2" /> or 
 /// if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>
 public static bool Equals(ref Half value1, ref Half value2)
 {
     return value1.value == value2.value;
 }
Beispiel #10
0
 /// <summary>
 /// Converts an array of full precision values into half precision values.
 /// </summary>
 /// <param name = "values">The values to be converted.</param>
 /// <returns>An array of converted values.</returns>
 public static Half[] ConvertToHalf(float[] values)
 {
     Half[] results = new Half[values.Length];
     for(int i = 0; i < results.Length; i++)
         results[i] = new Half(values[i]);
     return results;
 }
Beispiel #11
0
 /// <summary>
 /// Converts an array of half precision values into full precision values.
 /// </summary>
 /// <param name = "values">The values to be converted.</param>
 /// <returns>An array of converted values.</returns>
 public static float[] ConvertToFloat(Half[] values)
 {
     float[] results = new float[values.Length];
     for(int i = 0; i < results.Length; i++)
         results[i] = HalfUtils.Unpack(values[i].RawValue);
     return results;
 }