1#include "Library/Projection/Projection.h"
2
3namespace al {
4
5f32 Projection::getTop() const {
6 return mBase.getTop();
7}
8
9f32 Projection::getBottom() const {
10 return mBase.getBottom();
11}
12
13f32 Projection::getLeft() const {
14 return mBase.getLeft();
15}
16
17f32 Projection::getRight() const {
18 return mBase.getRight();
19}
20
21f32 Projection::getNear() const {
22 return mBase.getNear();
23}
24
25f32 Projection::getFar() const {
26 return mBase.getFar();
27}
28
29void Projection::setFovy(f32 fovy) {
30 mFovy = fovy;
31 mFocalLength = tanf(fovy * 0.5f);
32}
33
34void Projection::setAspect(f32 aspect) {
35 mBase.setAspect(aspect);
36 mAspect = aspect;
37}
38
39void Projection::setNear(f32 near) {
40 mBase.setNear(near);
41 mNear = near;
42}
43
44void Projection::setFar(f32 far) {
45 mBase.setFar(far);
46 mFar = far;
47}
48
49f32 Projection::calcNearClipHeight() {
50 return 2 * getNear() * mFocalLength;
51}
52
53f32 Projection::calcNearClipWidth() {
54 return calcNearClipHeight() * mBase.getAspect();
55}
56
57void Projection::setTop(f32 top) {
58 mTop = top;
59}
60
61void Projection::setBottom(f32 bottom) {
62 mBottom = bottom;
63}
64
65void Projection::setLeft(f32 left) {
66 mLeft = left;
67}
68
69void Projection::setRight(f32 right) {
70 mRight = right;
71}
72
73void Projection::setOffset(const sead::Vector2f& offset) {
74 mBase.setOffset(offset);
75 mOffset.set(offset);
76}
77
78f32 Projection::getAspect() const {
79 return mBase.getAspect();
80}
81
82f32 Projection::getFovy() const {
83 return mBase.getFovy();
84}
85
86const sead::Matrix44f& Projection::getProjMtx() const {
87 return mBase.getDeviceProjectionMatrix();
88}
89
90const sead::Matrix44f& Projection::getProjInvMtx() const {
91 return mInvMtx;
92}
93
94} // namespace al
95