public void ColorAtRayMiss() { var world = new DefaultWorld(); var ray = new Ray(new Point(0, 0, -5), new Vector(0, 1, 0)); Assert.Equal(new Color(0, 0, 0), world.ColorAt(ray, 0)); }
public void ColorAtRayHit() { var world = new DefaultWorld(); var ray = new Ray(new Point(0, 0, -5), new Vector(0, 0, 1)); Assert.Equal(new Color(0.38066f, 0.47583f, 0.2855f), world.ColorAt(ray, 0)); }
public void ColorAtIntersectionBehindRay() { var world = new DefaultWorld(); world.Shapes[0] = new Sphere(new Material(new Color(0.8f, 1.0f, 0.6f), diffuse: 0.7f, specular: 0.2f, ambient: 1)); var inner = world.Shapes[1] = new Sphere(Matrix4x4.Scaling(0.5f, 0.5f, 0.5f), new Material(ambient: 1)); var ray = new Ray(new Point(0, 0, 0.75f), new Vector(0, 0, -1)); Assert.Equal(((SolidPattern)inner.Material.Pattern).Color, world.ColorAt(ray, 0)); }