Exemplo n.º 1
0
        public IEnumerator Incremental([Range(0.0f, 360.0f, 15.0f)] float angle)
        {
            using (var texture = new MonochromeTexture("Maskox/Linear"))
            {
                texture.Material.SetFloat("_Maskox_Angle", angle);

                yield return(texture.Initialize());

                yield return(texture.Update());

                var radian = angle * Mathf.Deg2Rad;

                var direction = Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.right;
                UnityAssert.AreEqual(0.0f, direction.z);
                UnityAssert.AreApproximatelyEqual(1.0f, direction.magnitude);

                var center  = new Vector2(0.5f, 0.5f);
                var extents = new Vector2(direction.x * 0.5f, direction.y * 0.5f);
                var start   = center - extents;
                var end     = center + extents;

                UnityAssert.AreApproximatelyEqual(0.5f, texture[0.5f, 0.5f], 1.0f / 256.0f);

                texture.AssertIncremental(start, end);
            }
        }
Exemplo n.º 2
0
        public IEnumerator ZeroOrOne([Range(0.0f, 360.0f, 15.0f)] float angle)
        {
            using (var texture = new MonochromeTexture("Maskox/Step", 64, 64))
            {
                texture.Material.SetFloat("_Maskox_Angle", angle);

                yield return(texture.Initialize());

                yield return(texture.Update());

                Assert.IsTrue(texture.All(it => it.Alpha == 0.0f || it.Alpha == 1.0f));
            }
        }
Exemplo n.º 3
0
        public IEnumerator Incremental(
            [Range(-1.0f, +1.5f, 4)] float dx,
            [Range(-2.0f, +1.2f, 3)] float dy)
        {
            using (var texture = new MonochromeTexture("Maskox/Radial"))
            {
                var center = new Vector2(0.5f, 0.5f);

                texture.Material.SetVector("_Maskox_Center", center);

                yield return(texture.Initialize());

                yield return(texture.Update());

                var direction = dx != 0.0f || dy != 0.0f ? new Vector2(dx, dy).normalized : Vector2.right;
                texture.AssertIncremental(center, center + (direction * 0.5f));
            }
        }