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