public CameraChangedEventArgs(bool positionChanged, bool viewChanged, bool projectionChanged, Camera camera) { this.PositionChanged = positionChanged; this.ProjectionChanged = projectionChanged; this.ViewChanged = viewChanged; this.Camera = camera; }
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); }
private void SetCamera(Camera value) { if (camera != null) { camera.CameraChanged -= FireCamerChangedEvent; } camera = value; camera.CameraChanged += FireCamerChangedEvent; }
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; }
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; }
public FirstPersonCameraInput(Control control) { Camera = new Camera(); this.AttachToControl(control); this.SetSize(control.Width, control.Height); baseSpeed = DefaultSpeed; stopwatch = Stopwatch.StartNew(); }