-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Projection Libraries #129
Open
Esras
wants to merge
8
commits into
open-ead:master
Choose a base branch
from
Esras:various_additions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b5229aa
Add a number of the projection functions and headers to the library. …
82b43bd
Match sead::Projection::getProjectionMatrix()
ab1c16f
Add more functions and matching for the library functions for Project…
87db9b3
Fix a minor bug where Matrix44f couldn't use the makeIdentity function.
61c596f
Merge branch 'master' into various_additions
Esras c6dbabd
WIP: Merge work from another branch and split among files again.
7500ec5
Pull in more files from Aboood's branch and try to merge it into the …
ccfcbe8
Merge branch 'various_additions' of github.com:Esras/sead into variou…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
#include <gfx/seadProjection.h> | ||
|
||
namespace sead | ||
{ | ||
|
||
class DirectProjection : public Projection | ||
{ | ||
SEAD_RTTI_OVERRIDE(DirectProjection, Projection) | ||
|
||
public: | ||
DirectProjection(); | ||
DirectProjection(const Matrix44f* mtx, Graphics::DevicePosture posture); | ||
~DirectProjection() override = default; | ||
|
||
void updateAttributesForDirectProjection() override; | ||
Type getProjectionType() const override { return cType_Undefined; } | ||
void doUpdateMatrix(Matrix44f* dst) const override; | ||
|
||
void setDirectProjectionMatrix(const Matrix44f* mtx, Graphics::DevicePosture posture); | ||
|
||
f32 getNear() const override { return mNear; } | ||
f32 getFar() const override { return mFar; } | ||
f32 getFovy() const override { return mFovy; } | ||
|
||
f32 getAspect() const override { return mAspect; } | ||
void getOffset(Vector2f* offset) const override { *offset = mOffset; } | ||
|
||
void doScreenPosToCameraPosTo(Vector3f* dst, const Vector3f& screen_pos) const override; | ||
|
||
private: | ||
Matrix44f mDirectMatrix = Matrix44f::ident; | ||
f32 mNear = 0.0; | ||
f32 mFar = 0.0; | ||
f32 mFovy = 0.0; | ||
f32 mAspect = 0.0; | ||
Vector2f mOffset = Vector2f::zero; | ||
bool someBool = true; | ||
}; | ||
#ifdef cafe | ||
static_assert(sizeof(FrustumProjection) == 0xAC, "sead::FrustumProjection size mismatch"); | ||
#endif // cafe | ||
|
||
} // namespace sead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#pragma once | ||
#include <gfx/seadProjection.h> | ||
|
||
namespace sead | ||
{ | ||
|
||
class FrustumProjection : public Projection | ||
{ | ||
SEAD_RTTI_OVERRIDE(FrustumProjection, Projection) | ||
|
||
public: | ||
FrustumProjection() = default; | ||
FrustumProjection(f32 _near, f32 _far, f32 top, f32 bottom, f32 left, f32 right); | ||
FrustumProjection(f32 _near, f32 _far, const BoundBox2f& box); | ||
~FrustumProjection() override = default; | ||
|
||
Type getProjectionType() const override { return Projection::cType_Perspective; } | ||
void doUpdateMatrix(Matrix44f* dst) const override; | ||
void doScreenPosToCameraPosTo(Vector3f* dst, const Vector3f& screen_pos) const override; | ||
|
||
void setNear(f32 near); | ||
void setFar(f32 far); | ||
void setTop(f32 top); | ||
void setBottom(f32 bottom); | ||
void setLeft(f32 left); | ||
void setRight(f32 right); | ||
|
||
void setTBLR(f32 top, f32 bottom, f32 left, f32 right); | ||
|
||
void setBoundBox(const BoundBox2f& box); | ||
|
||
void createDividedProjection(FrustumProjection* dst, s32 partno_x, s32 partno_y, s32 divnum_x, | ||
s32 divnum_y) const; | ||
|
||
f32 getNear() const override { return mNear; } | ||
f32 getFar() const override { return mFar; } | ||
f32 getTop() const { return mTop; } | ||
f32 getBottom() const { return mBottom; } | ||
f32 getLeft() const { return mLeft; } | ||
f32 getRight() const { return mRight; } | ||
|
||
f32 getFovy() const override; | ||
f32 getAspect() const override; | ||
void getOffset(Vector2f* dst) const override; | ||
|
||
void setFovyAspectOffset(f32 fovy, f32 aspect, const Vector2f& offset); | ||
|
||
private: | ||
f32 mNear; | ||
f32 mFar; | ||
f32 mTop; | ||
f32 mBottom; | ||
f32 mLeft; | ||
f32 mRight; | ||
}; | ||
|
||
} // namespace sead |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason why this was commented out?