| 1 | #pragma once |
| 2 | |
| 3 | #include <gfx/seadGraphics.h> |
| 4 | #include <math/seadBoundBox.h> |
| 5 | #include <math/seadVector.h> |
| 6 | |
| 7 | namespace sead |
| 8 | { |
| 9 | template <typename T> |
| 10 | class Ray; |
| 11 | class DrawContext; |
| 12 | class LogicalFrameBuffer; |
| 13 | class Projection; |
| 14 | class Camera; |
| 15 | |
| 16 | class Viewport : public BoundBox2f |
| 17 | { |
| 18 | public: |
| 19 | Viewport(); |
| 20 | Viewport(float left, float top, float right, float bottom); |
| 21 | explicit Viewport(const BoundBox2f& parent); |
| 22 | explicit Viewport(const LogicalFrameBuffer& buffer); |
| 23 | virtual ~Viewport() = default; |
| 24 | |
| 25 | void setByFrameBuffer(const LogicalFrameBuffer& buffer); |
| 26 | void apply(DrawContext*, const LogicalFrameBuffer& buffer) const; |
| 27 | void getOnFrameBufferPos(Vector2f* out, const LogicalFrameBuffer& buffer) const; |
| 28 | void getOnFrameBufferSize(Vector2f* out, const LogicalFrameBuffer& buffer) const; |
| 29 | void applyViewport(DrawContext* context, const LogicalFrameBuffer& buffer) const; |
| 30 | void applyScissor(DrawContext* context, const LogicalFrameBuffer& buffer) const; |
| 31 | void project(Vector2f*, const Vector3f&) const; |
| 32 | void project(Vector2f*, const Vector2f&) const; |
| 33 | void unproject(Vector3f*, const Vector2f&, const Projection&, const Camera&) const; |
| 34 | void unproject(Ray<Vector3f>*, const Vector2f&, const Projection&, const Camera&) const; |
| 35 | |
| 36 | private: |
| 37 | Graphics::DevicePosture mDevicePosture; |
| 38 | }; |
| 39 | } // namespace sead |
| 40 | |