1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/includes/xna/graphics/viewport.hpp

48 lines
1.5 KiB
C++
Raw Permalink Normal View History

2024-03-18 15:41:46 -03:00
#ifndef XNA_GRAPHICS_VIEWPORT
#define XNA_GRAPHICS_VIEWPORT
2024-06-03 21:55:09 -03:00
#include "../common/numerics.hpp"
2024-05-31 14:59:45 -03:00
2024-03-18 15:41:46 -03:00
namespace xna {
2024-08-05 17:58:05 -03:00
//Defines the window dimensions of a render-target surface onto which a 3D volume projects.
2024-03-18 15:41:46 -03:00
struct Viewport {
2024-08-05 17:58:05 -03:00
//Gets or sets the pixel coordinate of the upper-left corner of the viewport on the render-target surface.
2024-03-18 15:41:46 -03:00
float X{ 0 };
2024-08-05 17:58:05 -03:00
//Gets or sets the pixel coordinate of the upper-left corner of the viewport on the render-target surface.
2024-03-18 15:41:46 -03:00
float Y{ 0 };
2024-08-05 17:58:05 -03:00
//Gets or sets the width dimension of the viewport on the render-target surface, in pixels.
2024-03-18 15:41:46 -03:00
float Width{ 0 };
2024-08-05 17:58:05 -03:00
//Gets or sets the height dimension of the viewport on the render-target surface, in pixels.
2024-03-18 15:41:46 -03:00
float Height{ 0 };
2024-08-05 17:58:05 -03:00
//Gets or sets the minimum depth of the clip volume.
2024-03-18 15:41:46 -03:00
float MinDetph{ 0 };
2024-08-05 17:58:05 -03:00
//Gets or sets the maximum depth of the clip volume.
2024-03-18 15:41:46 -03:00
float MaxDepth{ 1.0F };
constexpr Viewport() = default;
constexpr Viewport(float X, float Y, float Width, float Height, float MinDetph, float MaxDepth)
: X(X), Y(Y), Width(Width), Height(Height), MinDetph(MinDetph), MaxDepth(MaxDepth) {}
constexpr bool operator==(const Viewport& other) const {
return X == other.X
&& Y == other.Y
&& Width == other.Width
&& Height == other.Height
&& MinDetph == other.MinDetph
&& MaxDepth == other.MaxDepth;
}
2024-05-31 14:59:45 -03:00
2024-08-05 17:58:05 -03:00
//Gets the size of this resource.
2024-05-31 14:59:45 -03:00
constexpr Rectangle Bounds() const {
return {
static_cast<int>(X),
static_cast<int>(Y),
static_cast<int>(Width),
static_cast<int>(Height),
};
}
2024-03-18 15:41:46 -03:00
};
}
#endif