Пример #1
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="camera">The renderer camera that is to be manipulated by the new instance.</param>
        /// <param name="window">The window in which the scene is drawn.</param>
        /// <param name="ellipsoid">The ellipsoid defining the shape of the globe.</param>
        public CameraLookAtPoint(Camera camera, GraphicsWindow window, Ellipsoid ellipsoid)
        {
            if (camera == null)
            {
                throw new ArgumentNullException("camera");
            }
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }

            _camera = camera;
            _window = window;

            _centerPoint = camera.Target;

            _zoomFactor = 5.0;
            _zoomRateRangeAdjustment = ellipsoid.MaximumRadius;
            _maximumZoomRate = Double.MaxValue;
            _minimumZoomRate = ellipsoid.MaximumRadius / 100.0;

            _rotateFactor = 1.0 / ellipsoid.MaximumRadius;
            _rotateRateRangeAdjustment = ellipsoid.MaximumRadius;
            _maximumRotateRate = 1.0;
            _minimumRotateRate = 1.0 / 5000.0;

            // TODO: Should really be:
            // _range = (camera.Eye - camera.Target).Magnitude;
            _range = ellipsoid.MaximumRadius * 2.0;

            MouseEnabled = true;
        }
Пример #2
0
        public void SaveLoadView()
        {
            string filename = "view.xml";

            Camera camera = new Camera();
            camera.Eye = Vector3D.Zero;
            camera.Target = -Vector3D.UnitZ;
            camera.Up = Vector3D.UnitY;

            try
            {
                camera.SaveView(filename);

                Camera camera2 = new Camera();
                camera2.LoadView(filename);

                Assert.IsTrue(camera.Eye.Equals(camera2.Eye));
                Assert.IsTrue(camera.Target.Equals(camera2.Target));
                Assert.IsTrue(camera.Up.Equals(camera2.Up));
            }
            catch
            {
                throw;
            }
            finally
            {
                File.Delete(filename);
            }
        }
Пример #3
0
        public SceneState()
	    {
            DiffuseIntensity = 0.65f;
            SpecularIntensity = 0.25f;
            AmbientIntensity = 0.10f;
            Shininess = 12;
            Camera = new Camera();
            SunPosition = new Vector3D(200000, 0, 0);
            ModelMatrix = Matrix4D.Identity;
            HighResolutionSnapScale = 1;
        }
Пример #4
0
        public static void Execute(string filename, GraphicsWindow window, Camera camera)
        {
            if (File.Exists(filename))
            {
                camera.LoadView(filename);
            }

            window.Keyboard.KeyDown += delegate(object sender, KeyboardKeyEventArgs e)
            {
                if (e.Key == KeyboardKey.Space)
                {
                    camera.SaveView(filename);
                }
            };
        }
Пример #5
0
        public CameraFly(Camera camera, GraphicsWindow window)
        {
            if (camera == null)
            {
                throw new ArgumentNullException("camera");
            }
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }

            _camera = camera;
            _window = window;

            InputEnabled = true;
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="camera">The renderer camera that is to be manipulated by the new instance.</param>
 /// <param name="window">The window in which the scene is drawn.</param>
 /// <param name="ellipsoid">The ellipsoid defining the shape of the globe.</param>
 public CameraLookAtPoint(Camera camera, GraphicsWindow window) :
     this(camera, window, Ellipsoid.UnitSphere)
 {
 }