public Scene3D() { IsCached = true; Focusable = true; IsInteractive = true; Background = Brushes.Black; ModelsContainer = new Object3D(); Models = ModelsContainer.Children; Lighting = new Lighting(); Child = Viewport = new Viewport3D(); Viewport.Children.Add(ModelsContainer); Viewport.Children.Add(Lighting); AddCamera(-5, -4, 6); AddCamera(+5, -4, 6); AddCamera(10, 10, 9); ActivateCamera(0); //--- timer is required for flight simulation timer = new DispatcherTimer(DispatcherPriority.Render); timer.Interval = TimeSpan.FromMilliseconds(30); timer.Tick += TimerTick; }
void AddBoundingBox(Object3D obj, ref Rect bounds) { if (obj == null) { return; } Primitive3D primitive = obj as Primitive3D; if (primitive != null) { bounds.Union(primitive.GetBoundingBox()); } foreach (var child in obj.Children) { AddBoundingBox(child as Object3D, ref bounds); } }
public Scene3D() { IsCached = true; Focusable = true; IsInteractive = true; Background = Brushes.Black; ModelsContainer = new Object3D(); Models = ModelsContainer.Children; Lighting = new Lighting(); Child = Viewport = new Viewport3D(); Viewport.Children.Add(ModelsContainer); Viewport.Children.Add(Lighting); AddCamera(8, -8, 6); AddCamera(-8, -8, 6); AddCamera(12, 12, 9); ActivateCamera(0); //--- timer is required for flight simulation timer.Interval = TimeSpan.FromMilliseconds(30); timer.Tick += TimerTick; }
internal static void OnNewTransform(Object sender, DependencyPropertyChangedEventArgs e) { Object3D obj = sender as Object3D; obj.NewTransform(); }