Exemple #1
0
 /// <summary>
 /// vector-and-scalar constructor (CAUTION: not angle-axis, use FromAngleAxis instead)
 /// </summary>
 public uquat(uvec3 v, uint s)
 {
     this.x = v.x;
     this.y = v.y;
     this.z = v.z;
     this.w = s;
 }
Exemple #2
0
 public void Constructors()
 {
     {
         var v = new uvec3(9u);
         Assert.AreEqual(9u, v.x);
         Assert.AreEqual(9u, v.y);
         Assert.AreEqual(9u, v.z);
     }
     {
         var v = new uvec3(6u, 5u, 2u);
         Assert.AreEqual(6u, v.x);
         Assert.AreEqual(5u, v.y);
         Assert.AreEqual(2u, v.z);
     }
     {
         var v = new uvec3(new uvec2(8u, 9u));
         Assert.AreEqual(8u, v.x);
         Assert.AreEqual(9u, v.y);
         Assert.AreEqual(0u, v.z);
     }
     {
         var v = new uvec3(new uvec3(6u, 3u, 2u));
         Assert.AreEqual(6u, v.x);
         Assert.AreEqual(3u, v.y);
         Assert.AreEqual(2u, v.z);
     }
     {
         var v = new uvec3(new uvec4(8u, 5u, 6u, 4u));
         Assert.AreEqual(8u, v.x);
         Assert.AreEqual(5u, v.y);
         Assert.AreEqual(6u, v.z);
     }
 }
Exemple #3
0
        /// <summary>
        /// Returns a vector rotated by the quaternion.
        /// </summary>
        public static uvec3 operator*(uquat q, uvec3 v)
        {
            var qv  = new uvec3(q.x, q.y, q.z);
            var uv  = uvec3.Cross(qv, v);
            var uuv = uvec3.Cross(qv, uv);

            return(v + ((uv * q.w) + uuv) * 2);
        }
Exemple #4
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public umat2x3(uvec3 c0, uvec3 c1)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
 }
Exemple #5
0
        public void PropertyValues()
        {
            var v    = new uvec3(5u, 2u, 9u);
            var vals = v.Values;

            Assert.AreEqual(5u, vals[0]);
            Assert.AreEqual(2u, vals[1]);
            Assert.AreEqual(9u, vals[2]);
            Assert.That(vals.SequenceEqual(v.ToArray()));
        }
Exemple #6
0
        public void SerializationJson()
        {
            var v0 = new uvec3(5u, 4u, 3u);
            var s0 = JsonConvert.SerializeObject(v0);

            var v1 = JsonConvert.DeserializeObject <uvec3>(s0);
            var s1 = JsonConvert.SerializeObject(v1);

            Assert.AreEqual(v0, v1);
            Assert.AreEqual(s0, s1);
        }
Exemple #7
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public umat2x4(uvec3 c0, uvec3 c1)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = 0u;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = 0u;
 }
Exemple #8
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public umat3(uvec3 c0, uvec3 c1, uvec3 c2)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m20 = c2.x;
     this.m21 = c2.y;
     this.m22 = c2.z;
 }
Exemple #9
0
 public void InvariantCommutative()
 {
     {
         var v0 = new uvec3(2u, 5u, 4u);
         var v1 = new uvec3(3u, 0u, 3u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(0u, 8u, 8u);
         var v1 = new uvec3(9u, 6u, 4u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(0u, 0u, 1u);
         var v1 = new uvec3(0u, 7u, 4u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(1u, 3u, 6u);
         var v1 = new uvec3(9u, 6u, 3u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(2u, 6u, 5u);
         var v1 = new uvec3(5u, 2u, 2u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(4u, 1u, 7u);
         var v1 = new uvec3(6u, 2u, 9u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(5u, 0u, 6u);
         var v1 = new uvec3(5u, 1u, 8u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(3u, 9u, 0u);
         var v1 = new uvec3(8u, 3u, 1u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(0u, 3u, 6u);
         var v1 = new uvec3(8u, 6u, 8u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
     {
         var v0 = new uvec3(2u, 2u, 9u);
         var v1 = new uvec3(1u, 1u, 3u);
         Assert.AreEqual(v0 * v1, v1 * v0);
     }
 }
Exemple #10
0
 public void TriangleInequality()
 {
     {
         var v0 = new uvec3(0u, 1u, 1u);
         var v1 = new uvec3(9u, 3u, 5u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(8u, 2u, 2u);
         var v1 = new uvec3(3u, 9u, 9u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(2u, 6u, 6u);
         var v1 = new uvec3(8u, 3u, 3u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(3u, 4u, 4u);
         var v1 = new uvec3(2u, 2u, 1u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(5u, 5u, 5u);
         var v1 = new uvec3(0u, 5u, 7u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(1u, 0u, 4u);
         var v1 = new uvec3(2u, 2u, 7u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(0u, 3u, 6u);
         var v1 = new uvec3(5u, 4u, 1u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(4u, 9u, 1u);
         var v1 = new uvec3(0u, 6u, 2u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(9u, 3u, 7u);
         var v1 = new uvec3(8u, 3u, 7u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
     {
         var v0 = new uvec3(0u, 8u, 8u);
         var v1 = new uvec3(9u, 4u, 7u);
         Assert.GreaterOrEqual(v0.NormMax + v1.NormMax, (v0 + v1).NormMax);
     }
 }
Exemple #11
0
 public void InvariantCrossDot()
 {
     {
         var v0 = new uvec3(7u, 0u, 6u);
         var v1 = new uvec3(9u, 3u, 8u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(1u, 9u, 2u);
         var v1 = new uvec3(9u, 3u, 4u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(0u, 6u, 7u);
         var v1 = new uvec3(6u, 0u, 9u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(4u, 2u, 7u);
         var v1 = new uvec3(8u, 9u, 3u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(9u, 2u, 3u);
         var v1 = new uvec3(6u, 9u, 1u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(9u, 7u, 1u);
         var v1 = new uvec3(8u, 9u, 8u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(2u, 1u, 4u);
         var v1 = new uvec3(4u, 7u, 3u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(3u, 5u, 5u);
         var v1 = new uvec3(2u, 9u, 8u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(0u, 1u, 4u);
         var v1 = new uvec3(7u, 7u, 6u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
     {
         var v0 = new uvec3(8u, 8u, 1u);
         var v1 = new uvec3(3u, 0u, 0u);
         Assert.Less(glm.Abs(glm.Dot(v0, glm.Cross(v0, v1))), 0.1);
     }
 }
Exemple #12
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public umat3(uvec3 c0, uvec3 c1)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m20 = 0u;
     this.m21 = 0u;
     this.m22 = 1u;
 }
Exemple #13
0
        public void Operators()
        {
            var v1 = new uvec3(3u, 5u, 6u);
            var v2 = new uvec3(3u, 5u, 6u);
            var v3 = new uvec3(6u, 5u, 3u);

            Assert.That(v1 == new uvec3(v1));
            Assert.That(v2 == new uvec3(v2));
            Assert.That(v3 == new uvec3(v3));
            Assert.That(v1 == v2);
            Assert.That(v1 != v3);
            Assert.That(v2 != v3);
        }
Exemple #14
0
        public void StringInterop()
        {
            var v = new uvec3(4u, 3u, 3u);

            var s0 = v.ToString();
            var s1 = v.ToString("#");

            var v0 = uvec3.Parse(s0);
            var v1 = uvec3.Parse(s1, "#");

            Assert.AreEqual(v, v0);
            Assert.AreEqual(v, v1);

            var b0 = uvec3.TryParse(s0, out v0);
            var b1 = uvec3.TryParse(s1, "#", out v1);

            Assert.That(b0);
            Assert.That(b1);
            Assert.AreEqual(v, v0);
            Assert.AreEqual(v, v1);

            b0 = uvec3.TryParse(null, out v0);
            Assert.False(b0);
            b0 = uvec3.TryParse("", out v0);
            Assert.False(b0);
            b0 = uvec3.TryParse(s0 + ", 0", out v0);
            Assert.False(b0);

            Assert.Throws <NullReferenceException>(() => { uvec3.Parse(null); });
            Assert.Throws <FormatException>(() => { uvec3.Parse(""); });
            Assert.Throws <FormatException>(() => { uvec3.Parse(s0 + ", 0"); });

            var s2 = v.ToString(";", CultureInfo.InvariantCulture);

            Assert.That(s2.Length > 0);

            var s3 = v.ToString("; ", "G");
            var s4 = v.ToString("; ", "G", CultureInfo.InvariantCulture);
            var v3 = uvec3.Parse(s3, "; ", NumberStyles.Number);
            var v4 = uvec3.Parse(s4, "; ", NumberStyles.Number, CultureInfo.InvariantCulture);

            Assert.AreEqual(v, v3);
            Assert.AreEqual(v, v4);

            var b4 = uvec3.TryParse(s4, "; ", NumberStyles.Number, CultureInfo.InvariantCulture, out v4);

            Assert.That(b4);
            Assert.AreEqual(v, v4);
        }
Exemple #15
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public umat4x3(uvec3 c0, uvec3 c1, uvec3 c2, uvec3 c3)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m20 = c2.x;
     this.m21 = c2.y;
     this.m22 = c2.z;
     this.m30 = c3.x;
     this.m31 = c3.y;
     this.m32 = c3.z;
 }
 /// <summary>
 /// update minimum values.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="currentMin"></param>
 public static void UpdateMin(this uvec3 item, ref uvec3 currentMin)
 {
     if (item.x < currentMin.x)
     {
         currentMin.x = item.x;
     }
     if (item.y < currentMin.y)
     {
         currentMin.y = item.y;
     }
     if (item.z < currentMin.z)
     {
         currentMin.z = item.z;
     }
 }
 /// <summary>
 /// update minimum values.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="currentMax"></param>
 public static void UpdateMax(this uvec3 item, ref uvec3 currentMax)
 {
     if (currentMax.x < item.x)
     {
         currentMax.x = item.x;
     }
     if (currentMax.y < item.y)
     {
         currentMax.y = item.y;
     }
     if (currentMax.z < item.z)
     {
         currentMax.z = item.z;
     }
 }
Exemple #18
0
 public void InvariantNorm()
 {
     {
         var v0 = new uvec3(2u, 3u, 1u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(7u, 7u, 8u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(1u, 7u, 6u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(1u, 9u, 1u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(3u, 0u, 4u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(8u, 3u, 9u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(7u, 8u, 4u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(3u, 5u, 0u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(0u, 7u, 2u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
     {
         var v0 = new uvec3(1u, 4u, 8u);
         Assert.LessOrEqual(v0.NormMax, v0.Norm);
     }
 }
Exemple #19
0
 public void InvariantTriple()
 {
     {
         var v0 = new uvec3(2u, 5u, 8u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(3u, 1u, 8u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(2u, 0u, 0u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(4u, 9u, 5u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(1u, 4u, 6u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(9u, 4u, 3u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(0u, 1u, 4u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(5u, 1u, 6u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(6u, 4u, 3u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
     {
         var v0 = new uvec3(6u, 7u, 7u);
         Assert.AreEqual(v0 + v0 + v0, 3 * v0);
     }
 }
Exemple #20
0
 public void InvariantId()
 {
     {
         var v0 = new uvec3(9u, 1u, 7u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(6u, 9u, 0u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(2u, 4u, 5u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(9u, 8u, 2u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(7u, 1u, 8u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(0u, 3u, 0u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(4u, 4u, 2u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(6u, 3u, 5u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(1u, 4u, 4u);
         Assert.AreEqual(v0, +v0);
     }
     {
         var v0 = new uvec3(6u, 0u, 1u);
         Assert.AreEqual(v0, +v0);
     }
 }
Exemple #21
0
 public void InvariantDouble()
 {
     {
         var v0 = new uvec3(8u, 5u, 2u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(9u, 5u, 8u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(0u, 5u, 7u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(9u, 0u, 6u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(9u, 1u, 7u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(7u, 4u, 4u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(9u, 5u, 9u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(1u, 9u, 8u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(6u, 4u, 0u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
     {
         var v0 = new uvec3(2u, 6u, 7u);
         Assert.AreEqual(v0 + v0, 2 * v0);
     }
 }
Exemple #22
0
        public void Indexer()
        {
            var v = new uvec3(9u, 1u, 1u);

            Assert.AreEqual(9u, v[0]);
            Assert.AreEqual(1u, v[1]);
            Assert.AreEqual(1u, v[2]);

            Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[-2147483648]; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { v[-2147483648] = 0u; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[-1]; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { v[-1] = 0u; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[3]; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { v[3] = 0u; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[2147483647]; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { v[2147483647] = 0u; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { var s = v[5]; });
            Assert.Throws <ArgumentOutOfRangeException>(() => { v[5] = 0u; });

            v[1] = 0u;
            Assert.AreEqual(0u, v[1]);
            v[0] = 1u;
            Assert.AreEqual(1u, v[0]);
            v[1] = 2u;
            Assert.AreEqual(2u, v[1]);
            v[2] = 3u;
            Assert.AreEqual(3u, v[2]);
            v[0] = 4u;
            Assert.AreEqual(4u, v[0]);
            v[2] = 5u;
            Assert.AreEqual(5u, v[2]);
            v[0] = 6u;
            Assert.AreEqual(6u, v[0]);
            v[2] = 7u;
            Assert.AreEqual(7u, v[2]);
            v[2] = 8u;
            Assert.AreEqual(8u, v[2]);
            v[1] = 9u;
            Assert.AreEqual(9u, v[1]);
        }
Exemple #23
0
 protected uvec3 min(uvec3 x, uint y)
 {
     throw new NotImplementedException();
 }
 /// <summary> Returns the bit number of the least significant bit set to 1 in the 
 /// binary representation of value. If value is zero, -1 will be returned. </summary>
 protected static ivec3 findLSB(uvec3 value)
 {
     throw _invalidAccess;
 }
 /// <summary>Returns y if x &lt; y, otherwise it returns x.</summary>
 protected internal static uvec3 Max(uvec3 x, uvec3 y)
 {
     throw _invalidAccess;
 }
 /// <summary>
 /// Returns the insertion the bits least-significant bits of insert into base.
 /// The result will have bits [offset, offset + bits - 1] taken from bits [0, bits – 1] 
 /// of insert, and all other bits taken directly from the corresponding bits of base. 
 /// If bits is zero, the result will simply be base. 
 /// The result will be undefined if offset or bits is negative, or if the sum of
 /// offset and bits is greater than the number of bits used to store the operand.
 /// </summary>
 protected static uvec3 bitfieldInsert(uvec3 _base, uvec3 insert, int offset, int bits)
 {
     throw _invalidAccess;
 }
 /// <summary>Returns Min (Max (x, minVal), maxVal). Results are undefined if minVal > maxVal.</summary>
 protected internal static uvec3 Clamp(uvec3 x, uvec3 minVal, uvec3 maxVal)
 {
     throw _invalidAccess;
 }
Exemple #28
0
 protected uvec3 max(uvec3 x, uvec3 y)
 {
     throw new NotImplementedException();
 }
 /// <summary> Subtracts the 32-bit unsigned integer y from x, returning the difference 
 /// if non-negative, or 2**32 plus the difference otherwise. 
 /// The value borrow is set to 0 if x >= y, or to 1 otherwise. </summary>
 protected static uvec3 usubBorrow(uvec3 x, uvec3 y, out uvec3 borrow)
 {
     throw _invalidAccess;
 }
Exemple #30
0
 public void InvariantAssociative()
 {
     {
         var v0 = new uvec3(0u, 8u, 1u);
         var v1 = new uvec3(1u, 8u, 2u);
         var v2 = new uvec3(4u, 8u, 1u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(5u, 4u, 3u);
         var v1 = new uvec3(0u, 1u, 9u);
         var v2 = new uvec3(2u, 5u, 3u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(9u, 1u, 9u);
         var v1 = new uvec3(7u, 2u, 6u);
         var v2 = new uvec3(9u, 1u, 9u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(9u, 3u, 4u);
         var v1 = new uvec3(0u, 3u, 6u);
         var v2 = new uvec3(8u, 6u, 2u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(1u, 6u, 3u);
         var v1 = new uvec3(7u, 9u, 5u);
         var v2 = new uvec3(0u, 2u, 1u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(8u, 6u, 0u);
         var v1 = new uvec3(6u, 5u, 3u);
         var v2 = new uvec3(6u, 8u, 2u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(0u, 2u, 6u);
         var v1 = new uvec3(5u, 1u, 6u);
         var v2 = new uvec3(2u, 5u, 4u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(6u, 4u, 1u);
         var v1 = new uvec3(7u, 1u, 4u);
         var v2 = new uvec3(6u, 0u, 9u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(9u, 1u, 2u);
         var v1 = new uvec3(4u, 7u, 9u);
         var v2 = new uvec3(4u, 0u, 5u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
     {
         var v0 = new uvec3(9u, 3u, 8u);
         var v1 = new uvec3(1u, 4u, 4u);
         var v2 = new uvec3(4u, 7u, 3u);
         Assert.AreEqual(v0 * (v1 + v2), v0 * v1 + v0 * v2);
     }
 }
Exemple #31
0
 protected uvec3 clamp(uvec3 x, uint minVal, uint maxVal)
 {
     throw new NotImplementedException();
 }
Exemple #32
0
 /// <summary>
 /// update minimum values.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="currentMin"></param>
 public static void UpdateMin(this uvec3 item, ref uvec3 currentMin)
 {
     if (item.x < currentMin.x) { currentMin.x = item.x; }
     if (item.y < currentMin.y) { currentMin.y = item.y; }
     if (item.z < currentMin.z) { currentMin.z = item.z; }
 }
 /// <summary>Returns y if y &lt; x, otherwise it returns x.</summary>
 protected internal static uvec3 Min(uvec3 x, uint y)
 {
     throw _invalidAccess;
 }
Exemple #34
0
 protected bvec3 lessThan(uvec3 x, uvec3 y)
 {
     throw new NotImplementedException();
 }
 /// <summary> Fetch a single texel as in texelFetch offset by offset as described in textureOffset. </summary>
 protected static uvec4 texelFetchOffset(sampler3D sampler, uvec3 P, int lod, ivec3 offset)
 {
     throw _invalidAccess;
 }
 /// <summary>
 /// Extracts bits [offset, offset + bits - 1] from value, returning them 
 /// in the least significant bits of the result.
 /// The most significant bits of the result will be set to zero.
 /// If bits is zero, the result will be zero. The result will be undefined if 
 /// offset or bits is negative, or if the sum of offset and bits is greater than 
 /// the number of bits used to store the operand.
 /// </summary>
 /// <returns></returns>
 protected static uvec3 bitfieldExtract(uvec3 value, int offset, int bits)
 {
     throw _invalidAccess;
 }
Exemple #37
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bvec3 NotEqual(uvec3 lhs, uvec3 rhs) => uvec3.NotEqual(lhs, rhs);
 /// <summary>
 /// Multiplies 32-bit integers x and y, producing a 64-bit result. 
 /// The 32 least-significant bits are returned in lsb. The 32 most-significant bits are returned in msb.
 /// </summary>
 protected static void umulExtended(uvec3 x, uvec3 y, out uvec3 msb, out uvec3 lsb)
 {
     throw _invalidAccess;
 }
Exemple #39
0
 public uvec2(uvec3 xyz)
 {
     x = xyz.x;
     y = xyz.y;
 }
 /// <summary>Returns the number of bits set to 1 in the binary representation of value.</summary>
 protected static ivec3 bitCount(uvec3 value)
 {
     throw _invalidAccess;
 }
 /// <summary>
 /// Returns the reversal of the bits of value. The bit numbered n of the result will be taken from 
 /// bit (bits - 1) - n of value, where bits is the total number of bits used to represent value.
 /// </summary>
 protected static uvec3 bitfieldReverse(uvec3 value)
 {
     throw _invalidAccess;
 }
 /// <summary>
 /// Returns the bit number of the most significant bit in the binary representation of value.
 /// The result will be the bit number of the most significant bit set to 1.
 /// For a value of zero, -1 will be returned.
 /// </summary>
 protected static int findMSB(uvec3 value)
 {
     throw _invalidAccess;
 }
 /// <summary>
 /// </summary>
 /// <param name="uniformName"></param>
 /// <param name="values"></param>
 /// <returns></returns>
 public int SetUniform(string uniformName, uvec3[] values)
 {
     int location = GetUniformLocation(uniformName);
     if (location >= 0)
     {
         if (glUniform3uiv == null) { glUniform3uiv = OpenGL.GetDelegateFor<OpenGL.glUniform3uiv>(); }
         int count = values.Length;
         var value = new uint[count * 3];
         int index = 0;
         for (int i = 0; i < value.Length; i++)
         {
             value[index++] = values[i].x;
             value[index++] = values[i].y;
             value[index++] = values[i].z;
         }
         glUniform3uiv(location, count, value);
     }
     return location;
 }
 /// <summary>
 /// Returns a floating-point value corresponding to an unsigned integer encoding 
 /// of a floating-point value. If a NaN is passed in, it will not signal, 
 /// and the resulting floating point value is unspecified. If an Inf is passed in,
 /// the resulting floating-point value is the corresponding Inf.
 /// </summary>
 protected static vec3 uintBitsToFloat(uvec3 value)
 {
     throw _invalidAccess;
 }
Exemple #45
0
 protected bvec3 greaterThanEqual(uvec3 x, uvec3 y)
 {
     throw new NotImplementedException();
 }
 /// <summary> Adds 32-bit unsigned integer x and y, returning the sum modulo 2**32. 
 /// The value carry is set to 0 if the sum was less than 232, or to 1 otherwise. </summary>
 protected static uvec3 uaddCarry(uvec3 x, uvec3 y, out uvec3 carry)
 {
     throw _invalidAccess;
 }
Exemple #47
0
 protected bvec3 notEqual(uvec3 x, uvec3 y)
 {
     throw new NotImplementedException();
 }
Exemple #48
0
 /// <summary>
 /// update minimum values.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="currentMax"></param>
 public static void UpdateMax(this uvec3 item, ref uvec3 currentMax)
 {
     if (currentMax.x < item.x) { currentMax.x = item.x; }
     if (currentMax.y < item.y) { currentMax.y = item.y; }
     if (currentMax.z < item.z) { currentMax.z = item.z; }
 }