示例#1
0
        private static void TestCase07()
        {
            World         w     = new DefaultWorld();
            Ray           r     = new Ray(Tuple.Point(0, 0, -5), Tuple.Vector(0, 0, 1));
            LightingModel phong = new PhongReflection();
            Tuple         c     = phong.ColorAt(w, r);

            Assert.Equal(Tuple.Color(0.38066f, 0.47583f, 0.2855f), c);
        }
示例#2
0
        private static void TestCase08()
        {
            World w     = new DefaultWorld();
            Shape outer = w.Shapes[0];

            outer.Material.Ambient = 1;
            Shape inner = w.Shapes[1];

            inner.Material.Ambient = 1;
            Ray           r     = new Ray(Tuple.Point(0, 0, 0.75f), Tuple.Vector(0, 0, -1));
            LightingModel phong = new PhongReflection();
            Tuple         c     = phong.ColorAt(w, r);

            Assert.Equal(c, inner.Material.Color);
        }
示例#3
0
        private static void TestCase06()
        {
            // ColorAt() with mutually reflective surfaces
            World w = new World();

            w.Lights.Add(new PointLight(Tuple.Point(0, 0, 0), Tuple.Color(1, 1, 1)));
            Shape lower = new Plane();

            lower.Material.Reflective = 1;
            lower.Transform           = Transformation.Translation(0, -1, 0);
            w.Shapes.Add(lower);
            Shape upper = new Plane();

            upper.Material.Reflective = 1;
            upper.Transform           = Transformation.Translation(0, 1, 0);
            w.Shapes.Add(upper);
            Ray           r = new Ray(Tuple.Point(0, 0, 0), Tuple.Vector(0, 1, 0));
            LightingModel l = new PhongReflection();

            l.ColorAt(w, r);

            Assert.True(true);
        }