public void T03_AddingAChildToAGroup() { Group g = new Group(); TestRayObject o = new TestRayObject(); o.SetParent(g); Assert.Contains(o, g.GetChildren()); Assert.AreEqual(g, o.GetParent()); }
public void T01_DefaultTransform() { TestRayObject tro = new TestRayObject(); Assert.AreEqual(new Mat4(), tro.GetMatrix()); tro.SetMatrix(Mat4.TranslateMatrix(2, 3, 4)); Assert.AreEqual(Mat4.TranslateMatrix(2, 3, 4), tro.GetMatrix()); }
public void T02_Materials() { TestRayObject tro = new TestRayObject(); Material material = new Material(); Assert.AreEqual(material, tro.material); material.Ambient = 1; tro.material = material; Assert.AreEqual(material, tro.material); }
public void T08_LightingResults() { Material m = new Material(); Point p = new Point(0, 0, 0); Vector eye = new Vector(0, 0, -1); Vector normal = new Vector(0, 0, -1); Light light = new Light(new Point(0, 0, -10), new Color(1, 1, 1)); RayObject test = new TestRayObject(); Color result = test.Lighting(p, light, eye, normal, false); Assert.AreEqual(new Color(1.9f, 1.9f, 1.9f), result); eye = new Vector(0, (double)Math.Sqrt(2) / 2, (double)Math.Sqrt(2) / -2); normal = new Vector(0, 0, -1); result = test.Lighting(p, light, eye, normal, false); Assert.AreEqual(new Color(1, 1, 1), result); eye = new Vector(0, 0, -1); normal = new Vector(0, 0, -1); light.position = new Point(0, 10, -10); result = test.Lighting(p, light, eye, normal, false); Assert.AreEqual(new Color(0.7364f, 0.7364f, 0.7364f), result); eye = new Vector(0, (double)Math.Sqrt(2) / -2f, (double)Math.Sqrt(2) / -2f); normal = new Vector(0, 0, -1); result = test.Lighting(p, light, eye, normal, false); Assert.AreEqual(new Color(1.6364f, 1.6364f, 1.6364f), result); eye = new Vector(0, 0, -1); normal = new Vector(0, 0, -1); light.position = new Point(0, 0, 10); result = test.Lighting(p, light, eye, normal, false); Assert.AreEqual(new Color(0.1f, 0.1f, 0.1f), result); }
public void T02_ShapeHasParent() { TestRayObject r = new TestRayObject(); Assert.AreEqual(null, r.GetParent()); }