private void UpdateVisuals() { Children.Clear(); if (Light == null) { return; } var dl = Light as DirectionalLight; if (dl != null) { var arrow = new ArrowVisual3D(); double distance = 10; double length = 5; arrow.Point1 = new Point3D() + dl.Direction * distance; arrow.Point2 = arrow.Point1 - dl.Direction * length; arrow.Diameter = 0.1 * length; arrow.Fill = new SolidColorBrush(dl.Color); Children.Add(arrow); } var sl = Light as SpotLight; if (sl != null) { var sphere = new SphereVisual3D(); sphere.Center = sl.Position; sphere.Fill = new SolidColorBrush(sl.Color); Children.Add(sphere); var arrow = new ArrowVisual3D(); arrow.Point1 = sl.Position; arrow.Point2 = sl.Position + sl.Direction; arrow.Diameter = 0.1; Children.Add(arrow); } var pl = Light as PointLight; if (pl != null) { var sphere = new SphereVisual3D(); sphere.Center = pl.Position; sphere.Fill = new SolidColorBrush(pl.Color); Children.Add(sphere); } var al = Light as AmbientLight; }
protected void UpdateVisuals() { Children.Clear(); for (int i = 0; i < Mesh.Positions.Count; i++) { var arrow = new ArrowVisual3D { Point1 = Mesh.Positions[i], Point2 = Mesh.Positions[i] + Mesh.Normals[i], Diameter = 0.1, Fill = Brushes.Blue, ThetaDiv = 10 }; Children.Add(arrow); } }
private void UpdateVisuals() { Children.Clear(); if (Light == null) return; var dl = Light as DirectionalLight; if (dl != null) { var arrow = new ArrowVisual3D(); double distance = 10; double length = 5; arrow.Point1 = new Point3D() + dl.Direction*distance; arrow.Point2 = arrow.Point1 - dl.Direction*length; arrow.Diameter = 0.1*length; arrow.Fill = new SolidColorBrush(dl.Color); Children.Add(arrow); } var sl = Light as SpotLight; if (sl != null) { var sphere = new SphereVisual3D(); sphere.Center = sl.Position; sphere.Fill = new SolidColorBrush(sl.Color); Children.Add(sphere); var arrow = new ArrowVisual3D(); arrow.Point1 = sl.Position; arrow.Point2 = sl.Position + sl.Direction; arrow.Diameter = 0.1; Children.Add(arrow); } var pl = Light as PointLight; if (pl != null) { var sphere = new SphereVisual3D(); sphere.Center = pl.Position; sphere.Fill = new SolidColorBrush(pl.Color); Children.Add(sphere); } var al = Light as AmbientLight; }