Esempio n. 1
0
        public static void half3_from_float3_explicit_conversion()
        {
            half3 h = (half3)float3(123.4f, 5.96046448e-08f, -65504.0f);

            TestUtils.AreEqual(0x57B6, h.x.value);
            TestUtils.AreEqual(0x0001, h.y.value);
            TestUtils.AreEqual(0xFBFF, h.z.value);
        }
Esempio n. 2
0
        public static void half3_minvalue()
        {
            half3 min = half.MinValueAsHalf;

            TestUtils.AreEqual(0xfbff, min.x.value);
            TestUtils.AreEqual(0xfbff, min.y.value);
            TestUtils.AreEqual(0xfbff, min.z.value);
        }
Esempio n. 3
0
        public static void half3_maxvalue()
        {
            half3 max = half.MaxValueAsHalf;

            TestUtils.AreEqual(0x7bff, max.x.value);
            TestUtils.AreEqual(0x7bff, max.y.value);
            TestUtils.AreEqual(0x7bff, max.z.value);
        }
Esempio n. 4
0
        public static void half3_from_float3_construction()
        {
            half3 h0 = half3(float3(0.0f, 2.98e-08f, 5.96046448e-08f));
            half3 h1 = half3(float3(123.4f, 65504.0f, 65520.0f));
            half3 h2 = half3(float3(float.PositiveInfinity, float.NaN, -2.98e-08f));
            half3 h3 = half3(float3(-5.96046448e-08f, -123.4f, -65504.0f));
            half3 h4 = half3(float3(-65520.0f, float.NegativeInfinity, 0.0f));

            TestUtils.AreEqual(uint3(0x0000, 0x0000, 0x0001), uint3(h0.x.value, h0.y.value, h0.z.value));
            TestUtils.AreEqual(uint3(0x57B6, 0x7BFF, 0x7C00), uint3(h1.x.value, h1.y.value, h1.z.value));
            TestUtils.AreEqual(uint3(0x7C00, 0xFE00, 0x8000), uint3(h2.x.value, h2.y.value, h2.z.value));

            TestUtils.AreEqual(uint3(0x8001, 0xD7B6, 0xFBFF), uint3(h3.x.value, h3.y.value, h3.z.value));
            TestUtils.AreEqual(uint3(0xFC00, 0xFC00, 0x0000), uint3(h4.x.value, h4.y.value, h4.z.value));
        }
Esempio n. 5
0
        public static void half3_from_double3_construction()
        {
            half3 h0 = half3(double3(0.0, 2.98e-08, 5.96046448e-08));
            half3 h1 = half3(double3(123.4, 65504.0, 65520.0));
            half3 h2 = half3(double3(double.PositiveInfinity, TestUtils.SignedDoubleQNaN(), -2.98e-08));
            half3 h3 = half3(double3(-5.96046448e-08, -123.4, -65504.0));
            half3 h4 = half3(double3(-65520.0, double.NegativeInfinity, 0.0));

            TestUtils.AreEqual(uint3(0x0000, 0x0000, 0x0001), uint3(h0.x.value, h0.y.value, h0.z.value));
            TestUtils.AreEqual(uint3(0x57B6, 0x7BFF, 0x7C00), uint3(h1.x.value, h1.y.value, h1.z.value));
            TestUtils.AreEqual(uint3(0x7C00, 0xFE00, 0x8000), uint3(h2.x.value, h2.y.value, h2.z.value));

            TestUtils.AreEqual(uint3(0x8001, 0xD7B6, 0xFBFF), uint3(h3.x.value, h3.y.value, h3.z.value));
            TestUtils.AreEqual(uint3(0xFC00, 0xFC00, 0x0000), uint3(h4.x.value, h4.y.value, h4.z.value));
        }
Esempio n. 6
0
 public half8(half3 x012, half2 x34, half3 x567)
 {
     this = maxmath.ashalf(new ushort8(maxmath.asushort(x012), maxmath.asushort(x34), maxmath.asushort(x567)));
 }
Esempio n. 7
0
 public half8(half3 x012, half3 x345, half2 x67)
 {
     this = maxmath.ashalf(new ushort8(maxmath.asushort(x012), maxmath.asushort(x345), maxmath.asushort(x67)));
 }
Esempio n. 8
0
 public void Combine(ref half3 curr, ref half3 value)
 {
     curr.x += value.x;
     curr.y += value.y;
     curr.z += value.z;
 }
Esempio n. 9
0
 public half8(half2 x01, half3 x234, half3 x567)
 {
     this = maxmath.ashalf(new ushort8(maxmath.asushort(x01), maxmath.asushort(x234), maxmath.asushort(x567)));
 }
Esempio n. 10
0
 public static half3 abs(half3 x)
 {
     return(ashalf(asushort(x) & 0x7FFF));
 }
Esempio n. 11
0
 public static bool3 isinf(half3 h)
 {
     return((asushort(h) & 0x7FFF) == 0x7C00);
 }
        public static double Double3Half3(ref double3 a)
        {
            var h = new half3(a);

            return(Vectors.ConvertToDouble((double3) new double3(h).x));
        }
Esempio n. 13
0
        public void half3_from_double3_construction_signed_zero()
        {
            half3 h0 = half3(double3(-0.0, -0.0, -0.0));

            TestUtils.AreEqual(uint3(h0.x.value, h0.y.value, h0.z.value), uint3(0x8000, 0x8000, 0x8000));
        }
Esempio n. 14
0
 public static ushort3 asushort(half3 x)
 {
     return(*(ushort3 *)&x);
 }
        public static float Float3Half3(ref float3 a)
        {
            var h = new half3(a);

            return(Vectors.ConvertToFloat((float3) new float3(h).x));
        }
Esempio n. 16
0
 public static short3 asshort(half3 x)
 {
     return(*(short3 *)&x);
 }
Esempio n. 17
0
 public static bool3 isnan(half3 h)
 {
     return((asushort(h) & 0x7FFF) > 0x7C00);
 }
Esempio n. 18
0
 public static bool3 isfinite(half3 h)
 {
     return((asushort(h) & 0x7FFF) < 0x7C00);
 }
Esempio n. 19
0
        public static void half3_from_double3_construction_signed_zero()
        {
            half3 h0 = half3(double3(TestUtils.SignedDoubleZero(), TestUtils.SignedDoubleZero(), TestUtils.SignedDoubleZero()));

            TestUtils.AreEqual(uint3(0x8000, 0x8000, 0x8000), uint3(h0.x.value, h0.y.value, h0.z.value));
        }
Esempio n. 20
0
        public static void half3_from_float3_construction_signed_zero()
        {
            half3 h0 = half3(float3(-0.0f, -0.0f, -0.0f));

            TestUtils.AreEqual(uint3(0x8000, 0x8000, 0x8000), uint3(h0.x.value, h0.y.value, h0.z.value));
        }
Esempio n. 21
0
 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
 {
     _tmpBuffer.Clear();
     if (stream.isWriting)
     {
         byte num   = Convert.ToByte(_values.ActiveHandle(CurrentIndicatorIndex));
         byte thing = (byte)((_gmOnlyMode ? 0x40 : 0) | num);
         NativeHelpers.SerializeUnmanagedAndAppend <sbyte>(_tmpBuffer, Convert.ToSByte(CurrentIndicatorIndex));
         NativeHelpers.SerializeUnmanagedAndAppend(_tmpBuffer, thing);
         float3 num3 = _values.Get(CurrentIndicatorIndex, 0);
         NativeHelpers.SerializeUnmanagedAndAppend <float3>(_tmpBuffer, num3);
         int num4 = num + 1;
         for (int i = 1; i < num4; i++)
         {
             half3 half = (half3)(_values.Get(CurrentIndicatorIndex, i) - num3);
             NativeHelpers.SerializeUnmanagedAndAppend <half3>(_tmpBuffer, half);
         }
         stream.SendNext(_tmpBuffer.ToArray());
     }
     else
     {
         sbyte  num7;
         byte   num8;
         float3 num11;
         byte[] src = (byte[])stream.ReceiveNext();
         _tmpBuffer.AddRange <byte>(src);
         int byteOffset = 0;
         NativeHelpers.DeserializeUnmanagedAndAdvance <sbyte>((NativeArray <byte>)_tmpBuffer, ref byteOffset, out num7);
         NativeHelpers.DeserializeUnmanagedAndAdvance <byte>((NativeArray <byte>)_tmpBuffer, ref byteOffset, out num8);
         bool gmOnly = (num8 & 0x40) != 0;
         SetGmOnly(gmOnly);
         int num9  = num8 & -65;
         int num10 = _values.ActiveHandle(num7);
         NativeHelpers.DeserializeUnmanagedAndAdvance <float3>((NativeArray <byte>)_tmpBuffer, ref byteOffset, out num11);
         float3 num12 = _targetValues[0] = num11;
         int    num13 = num9 + 1;
         for (int i = 1; i < num13; i++)
         {
             half3 half2;
             NativeHelpers.DeserializeUnmanagedAndAdvance <half3>((NativeArray <byte>)_tmpBuffer, ref byteOffset, out half2);
             float3 num16 = num12 + half2;
             num12 = _targetValues[i] = num16;
             if (num10 < i)
             {
                 _values.Set(CurrentIndicatorIndex, i, num12);
             }
         }
         if ((num7 != CurrentIndicatorIndex) || (num9 < num10))
         {
             SetNewIndicator(num7, true);
         }
         else
         {
             for (int j = num10 + 1; j <= num9; j++)
             {
                 _indicator.InitHandle(j);
                 _indicator.SetHandle(j, _values.Get(CurrentIndicatorIndex, j));
             }
         }
     }
 }
Esempio n. 22
0
 public void GetIdentity(out half3 identity)
 {
     identity = new half3(0);
 }
Esempio n. 23
0
 public static half3 nabs(half3 x)
 {
     return(ashalf(asushort(x) | 0x8000));
 }
 public static bool3 toboolsafe(half3 x)
 {
     return((float3)x != 0f);
 }