Пример #1
0
        public double Speed;               // present spirit move speed
        public ISpirit3D(double speed)
        {
            Speed = speed;

            _eventListener = new RenderingEventListener(this.Update);
            RenderingEventManager.AddListener(_eventListener);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref = "WiggleView3D" /> class.
        /// </summary>
        public WiggleView3D()
        {
            this.InitializeComponent();

            this.RightCamera = new PerspectiveCamera();
            this.BindViewports(this.View1, null, true, true);

            this.Loaded += this.ControlLoaded;
            this.Unloaded += this.ControlUnloaded;

            this.UpdateTimer();
            this.watch.Start();
            this.renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderingModelVisual3D"/> class.
 /// </summary>
 protected RenderingModelVisual3D()
 {
     renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);
 }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Viewport3DX" /> class.
        /// </summary>
        public Viewport3DX()
        {
            this.perspectiveCamera = new PerspectiveCamera();
            this.orthographicCamera = new OrthographicCamera();
            this.perspectiveCamera.Reset();
            this.orthographicCamera.Reset();

            this.Camera = this.Orthographic ? (ProjectionCamera)this.orthographicCamera : this.perspectiveCamera;

            //this.Children = new Element3DCollection();

            this.rotateHandler = new RotateHandler(this);
            this.panHandler = new PanHandler(this);
            this.zoomHandler = new ZoomHandler(this);
            this.changeFieldOfViewHandler = new ZoomHandler(this, true);
            this.zoomRectangleHandler = new ZoomRectangleHandler(this);

            this.CommandBindings.Add(new CommandBinding(ViewportCommands.ZoomExtents, this.ZoomExtentsHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.SetTarget, this.SetTargetHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Reset, this.ResetHandler));

            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Zoom, this.zoomHandler.Execute));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Pan, this.panHandler.Execute));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Rotate, this.rotateHandler.Execute));
            this.CommandBindings.Add(
                new CommandBinding(ViewportCommands.ChangeFieldOfView, this.changeFieldOfViewHandler.Execute));
            this.CommandBindings.Add(
                new CommandBinding(ViewportCommands.ZoomRectangle, this.zoomRectangleHandler.Execute));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.BottomView, this.BottomViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.TopView, this.TopViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.FrontView, this.FrontViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.BackView, this.BackViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.LeftView, this.LeftViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.RightView, this.RightViewHandler));

            this.SetDefaultGestures();

            this.fpsWatch.Start();

            this.renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);

            this.Loaded += this.ControlLoaded;
            this.Unloaded += this.ControlUnloaded;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CameraController" /> class.
        /// </summary>
        public CameraController()
        {
            this.Loaded += this.CameraControllerLoaded;
            this.Unloaded += this.CameraControllerUnloaded;

            // Must be focusable to received key events
            this.Focusable = true;
            this.FocusVisualStyle = null;

            this.IsManipulationEnabled = true;

            this.InitializeBindings();
            this.renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HelixViewport3D" /> class. Initializes a new instance of the
        ///     <see
        ///         cref="HelixViewport3D" />
        /// class.
        /// </summary>
        public HelixViewport3D()
        {
            // The Viewport3D must be created here since the Children collection is attached directly
            this.viewport = new Viewport3D();

            // viewport.SetBinding(UIElement.IsHitTestVisibleProperty, new Binding("IsViewportHitTestVisible") { Source = this });
            // viewport.SetBinding(UIElement.ClipToBoundsProperty, new Binding("ClipToBounds") { Source = this });

            // headlight
            this.lights = new Model3DGroup();
            this.viewport.Children.Add(new ModelVisual3D { Content = this.lights });

            this.perspectiveCamera = new PerspectiveCamera();
            this.orthographicCamera = new OrthographicCamera();
            CameraHelper.Reset(this.perspectiveCamera);
            CameraHelper.Reset(this.orthographicCamera);

            this.Camera = this.Orthographic ? (ProjectionCamera)this.orthographicCamera : this.perspectiveCamera;

            // http://blogs.msdn.com/wpfsdk/archive/2007/01/15/maximizing-wpf-3d-performance-on-tier-2-hardware.aspx
            // RenderOptions.EdgeMode?

            // start a watch for FPS calculations
            this.fpsWatch.Start();

            this.Loaded += this.OnControlLoaded;
            this.Unloaded += this.OnControlUnloaded;

            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, this.CopyHandler));
            this.CommandBindings.Add(new CommandBinding(OrthographicToggleCommand, this.OrthographicToggle));
            this.renderingEventListener = new RenderingEventListener(this.CompositionTargetRendering);
        }
Пример #7
0
 public WindTurbineVisual3D()
 {
     renderingEventListener=new RenderingEventListener(this.OnCompositionTargetRendering);
     RenderingEventManager.AddListener(renderingEventListener);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderingModelVisual3D"/> class.
 /// </summary>
 public FaceTheCameraBillboard()
     : base()
 {
     renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);
 }
Пример #9
0
 /// <summary>
  /// Initializes a new instance of the <see cref="RenderingControl"/> class.
 /// </summary>
 protected RenderingControl()
 {
     this.renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderingModelVisual3D"/> class.
 /// </summary>
 public FaceTheCameraBillboard()
     : base()
 {
     renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);
 }
Пример #11
0
 public WindTurbineVisual3D()
 {
     renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);
     RenderingEventManager.AddListener(renderingEventListener);
 }