Exemple #1
0
        public void ReflectionTest()
        {
            var image = new Image(100, 100);
            var scene = new Scene
            {
                Camera = new Camera(0, 0, 0)
                {
                    Direction   = Vector3.UnitZ,
                    FieldOfView = 90f,
                    Position    = Vector3.Zero
                }
            };

            var reflectiveSphere = new Sphere
            {
                Center   = new Vector3(0, 0, -10),
                Radius   = 2,
                Material = new BrdfMaterial
                {
                    Scene = scene
                }
            };

            var hollowSphere = new SphereHollow
            {
                Center   = Vector3.Zero,
                Radius   = 20,
                Material = new FullBright {
                    Color = Color.FromArgb(255, 0, 0)
                }
            };

            scene.RenderObjects = new List <IRenderObject>()
            {
                reflectiveSphere,
                hollowSphere
            };

            scene.Render(image);

            foreach (var(x, y, pixel) in image.PixelEnumerator())
            {
                Assert.Equal(1.0f, pixel.R);
            }
        }