public Intersection(double distance, Vector3 point, IObject obj, Vector3 normal, Vector2 baryCoords) { Intersects = true; Distance = distance; Point = point; Object = obj; Normal = normal; BaryCoords = baryCoords; }
private void DrawObject(IObject obj) { if (obj is Sphere) { Sphere s = obj as Sphere; Vector2 center = new Vector2(s.Position.X, s.Position.Z); Vector2 pc = VectorToPixel(center); double radius = s.Radius * scale.X; Rectangle rect = new Rectangle((int)(pc.X - radius), (int)(pc.Y - radius), (int)(radius * 2.0), (int)(radius * 2.0)); g.FillEllipse(new SolidBrush(Color.FromArgb(64, materials[s.Material].Color)), rect); g.DrawEllipse(new Pen(materials[s.Material].Color, 1.5f), rect); } if (obj is Triangle) DrawTriangle(obj as Triangle); if (obj is Quad) { Quad q = obj as Quad; DrawTriangle(q.T1); DrawTriangle(q.T2); } }