using System; using Microsoft.Xna.Framework; namespace MonoGame.Extended { /// /// Represents an abstract camera. /// /// /// The position type for the camera. /// Typically for 2D cameras or for 3D cameras /// public abstract class Camera where T : struct { /// /// Gets or sets the position fo the camera in world coordinates. /// public abstract T Position { get; set; } /// /// Gets or sets the rotation of the camera in radians. /// public abstract float Rotation { get; set; } /// /// Gets or sets the zoom level of the camera. /// /// /// The zoom factor where 1.0 represents the default zoom level. /// Values greater than 1.0 in and values less than 1.0 zoom out. /// public abstract float Zoom { get; set; } /// /// Gets or sets the minimum allowed zoom level. /// public abstract float MinimumZoom { get; set; } /// /// Gets or sets the maximum allowed zoom level. /// public abstract float MaximumZoom { get; set; } /// /// Gets or sets the vertical scale multiplier applied to the camera's zoom. /// /// /// This property is deprecated and will be removed in the next major version. /// [Obsolete("Pitch will be removed in the next major version")] public abstract float Pitch { get; set; } /// /// Gets or sets the minimum allowed pitch value. /// /// /// This property is deprecated and will be removed in the next major version. /// [Obsolete("Pitch will be removed in the next major version")] public abstract float MinimumPitch { get; set; } /// /// Gets or Sets the maximum allowed pitch value. /// /// /// This property is deprecated and will be removed in the next major version. /// [Obsolete("Pitch will be removed in the next major version")] public abstract float MaximumPitch { get; set; } /// /// Gets the axis-aligned bounding rectangle of the camera's view in world coordinates. /// public abstract RectangleF BoundingRectangle { get; } /// /// Gets or sets the origin point for rotation and zoom transformations. /// /// /// The origin defines the center point around which rotation and zoom are applied. /// Typically set to the center of the viewport. /// public abstract T Origin { get; set; } /// /// Gets the center position of the camera's view in world coordinates. /// public abstract T Center { get; } /// /// Moves the camera by the specified direction vector. /// /// The direction and distance to move the camera. public abstract void Move(T direction); /// /// Rotates the camera by the specified amount /// /// The rotation amount in radians to apply. public abstract void Rotate(float deltaRadians); /// /// Increases the camera's zoom level by the specified amount. /// /// The amount to increase the zoom by. public abstract void ZoomIn(float deltaZoom); /// /// Decreases the camera's zoom level by the specified amount. /// /// The amount to decrease the zoom by. public abstract void ZoomOut(float deltaZoom); /// /// Increases the pitch value by the specified amount. /// /// The amount to increase the pitch by. /// /// This method is deprecated and will be removed in the next major version. /// [Obsolete("Pitch will be removed in the next major version")] public abstract void PitchUp(float deltaZoom); /// /// Decreases the pitch value by the specified amount. /// /// The amount to decrease the pitch by. /// /// This method is deprecated and will be removed in the next major version. /// [Obsolete("Pitch will be removed in the next major version")] public abstract void PitchDown(float deltaZoom); /// /// Positions the camera to look at the specified position. /// /// The world position to center the camera on. public abstract void LookAt(T position); /// /// Converts a position from world coordinates to screen coordinates. /// /// The position in world coordinates. /// The corresponding position in screen coordinates. public abstract T WorldToScreen(T worldPosition); /// /// Converts a position from screen coordinates to world coordinates. /// /// The position in screen coordinates. /// The corresponding position in world coordinates. public abstract T ScreenToWorld(T screenPosition); /// /// Gets the view transformation matrix for the camera. /// /// A representing the camera's view transformation. public abstract Matrix GetViewMatrix(); /// /// Gets the inverse of the view transformation matrix for the camera. /// /// A representing the inverse of the camera's view transformation. public abstract Matrix GetInverseViewMatrix(); /// /// Gets the bounding frustum for the camera's view volume. /// /// A representing the camera's view volume. public abstract BoundingFrustum GetBoundingFrustum(); /// /// Determines whether the camera's view contains the specified point. /// /// The point to test, in world coordinates. /// /// A indicating whether the point is inside, outside, or /// intersects the camera's view. /// public abstract ContainmentType Contains(Vector2 vector2); /// /// Determines whether the camera's view contains the specified rectangle. /// /// The rectangle to test, in world coordinates. /// /// /// A indicating whether the rectangle is inside, outside, or /// intersects the camera's view. /// public abstract ContainmentType Contains(Rectangle rectangle); } }