Пример #1
0
 public CameraChangedEventArgs(bool positionChanged, bool viewChanged, bool projectionChanged, Camera camera)
 {
     this.PositionChanged = positionChanged;
     this.ProjectionChanged = projectionChanged;
     this.ViewChanged = viewChanged;
     this.Camera = camera;
 }
Пример #2
0
 public virtual void SetCamera(Camera camera)
 {
     previousCamera = camera;
     View.SetMatrix(camera.View);
     Proj.SetMatrix(camera.Projection);
     InvProj.SetMatrix(Matrix.Invert(camera.Projection));
     CameraPos.Set(camera.Position);
 }
Пример #3
0
 private void SetCamera(Camera value)
 {
     if (camera != null)
     {
         camera.CameraChanged -= FireCamerChangedEvent;
     }
     camera = value;
     camera.CameraChanged += FireCamerChangedEvent;
 }
Пример #4
0
 public static Vector3 MoveRelativeToWorld(Vector3 movement, Camera camera)
 {
     if (movement == Vector3.Zero) return camera.Position;
     double Pan = camera.YawPitchRoll.X;
     double z = Math.Cos(Pan) * movement.Z + Math.Sin(Pan) * -movement.X;
     double x = Math.Cos(Pan) * movement.X - Math.Sin(Pan) * -movement.Z;
     Vector3 pos = camera.Position + new Vector3((float)x, (float)movement.Y, (float)z);
     return pos;
 }
Пример #5
0
 public static Vector3 MoveRelativeToCamera(Vector3 movement, Camera camera)
 {
     Vector3 right = new Vector3(camera.View.M11, camera.View.M21, camera.View.M31);
     Vector3 pos = camera.Position + right * movement.X + Vector3.UnitY * movement.Y + camera.Direction * movement.Z;
     return pos;
 }
Пример #6
0
        public FirstPersonCameraInput(Control control)
        {
            Camera = new Camera();
            this.AttachToControl(control);
            this.SetSize(control.Width, control.Height);

            baseSpeed = DefaultSpeed;
            stopwatch = Stopwatch.StartNew();
        }