コード例 #1
0
        private static uint Pack(float x, float y)
        {
            uint packX = HalfUtils.ConvertFloatToHalf(x);
            uint packY = (uint)(HalfUtils.ConvertFloatToHalf(y) << 16);

            return(packX | packY);
        }
コード例 #2
0
 /// <summary>
 /// Expands this <see cref="Half2"/> structure to a <see cref="Vector2"/>.
 /// </summary>
 public Vector2 ToVector2()
 {
     return(new Vector2(
                HalfUtils.ConvertHalfToFloat((ushort)PackedValue),
                HalfUtils.ConvertHalfToFloat((ushort)(PackedValue >> 16))
                ));
 }
コード例 #3
0
 void IPackedVector.PackFromVector4(Vector4 vector)
 {
     PackedValue = HalfUtils.ConvertFloatToHalf(vector.X);
 }
コード例 #4
0
 /// <summary>
 /// Expands the packed value to a <see cref="float"/>.
 /// </summary>
 public float ToSingle() => HalfUtils.ConvertHalfToFloat(PackedValue);
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Half"/> structure.
 /// </summary>
 /// <param name="value">The floating point value that should be stored in 16 bit format.</param>
 public Half(float value)
 {
     PackedValue = HalfUtils.ConvertFloatToHalf(value);
 }
コード例 #6
0
ファイル: Half.cs プロジェクト: uygary/Vortice.Mathematics
 /// <summary>
 /// Initializes a new instance of the <see cref="Half"/> structure.
 /// </summary>
 /// <param name="vector">The <see cref="Vector4"/> to pack from.</param>
 public Half(Vector4 vector)
 {
     PackedValue = HalfUtils.ConvertFloatToHalf(vector.X);
 }