예제 #1
0
        public void AssignTransform()
        {
            var pat = new TestPattern
            {
                Transform = Transform.Translate(1, 2, 3),
            };

            Assert.Equal(Transform.Translate(1, 2, 3), pat.Transform);
        }
예제 #2
0
        public void PatternWithPatternTransformation()
        {
            var obj = new Sphere();
            var pat = new TestPattern
            {
                Transform = Transform.Scale(2, 2, 2),
            };

            var c        = pat.GetColor(obj, Vector4.CreatePosition(2, 3, 4));
            var expected = new Color(1, 1.5, 2);

            Assert.Equal(expected, c);
        }
예제 #3
0
        public void PatternWithObjectAndPatternTransformation()
        {
            var obj = new Sphere()
            {
                Transform = Transform.Scale(2, 2, 2),
            };

            var pat = new TestPattern
            {
                Transform = Transform.Translate(0.5, 1, 1.5),
            };

            var c        = pat.GetColor(obj, Vector4.CreatePosition(2.5, 3, 3.5));
            var expected = new Color(0.75, 0.5, 0.25);

            Assert.Equal(expected, c);
        }
예제 #4
0
        public void DefaultPatternTransformation()
        {
            var pat = new TestPattern();

            Assert.Equal(Matrix4x4.Identity, pat.Transform);
        }