1#pragma once
2
3#include <gfx/seadGraphics.h>
4#include <math/seadBoundBox.h>
5#include <math/seadVector.h>
6
7namespace sead
8{
9template <typename T>
10class Ray;
11class DrawContext;
12class LogicalFrameBuffer;
13class Projection;
14class Camera;
15
16class Viewport : public BoundBox2f
17{
18public:
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
36private:
37 Graphics::DevicePosture mDevicePosture;
38};
39} // namespace sead
40