Skip to content
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
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

Esras
Copy link

@Esras Esras commented Jun 10, 2023

This PR attempts to implement many of the Projection libraries and tries to update their dependencies where needed and from @aboood40091's repo.

Goals

  • Implement more of the Projection libraries, including what appear to be the Perspective, Ortho, Frustum, and Direct projections.
  • Include the Graphics, Viewport, and DrawContext library updates that @aboood40091 has been working on.
  • Organize the files in such a way to be consumable, but still implemented as a single piece in the built object file for the BotW decomp.

Addresses
0xB1D898 - 0xB1F2B0 are the bulk of the Projection functions in BotW.
0xB1FFF0 - 0xB20718 are the sead::Viewport functions

Waiting on dependencies

  • Projection::unproject(Ray<>, ...)

Non-Matching Functions

  • Projection::doScreenPosToCameraPosTo(sead::Vector3<float>*, sead::Vector3<float> const&) const
  • Projection::project(sead::Vector2<float>*, sead::Vector3<float> const&, sead::Viewport const&) const
  • Projection::unproject(sead::Vector3<float>*, sead::Vector3<float> const&, sead::Camera const&) const
  • Projection::doUpdateDeviceMatrix(sead::Matrix44<float>*, sead::Matrix44<float> const&, sead::Graphics::DevicePosture) const
  • PerspectiveProjection::PerspectiveProjection()
  • PerspectiveProjection::PerspectiveProjection(float, float, float, float)
  • OrthoProjection::OrthoProjection()
  • OrthoProjection::OrthoProjection(float, float, float, float, float, float)
  • OrthoProjection::OrthoProjection(float, float, sead::Viewport const&)
  • OrthoProjection::setByViewport(sead::Viewport const&)
  • OrthoProjection::doUpdateMatrix(sead::Matrix44<float>*) const
  • FrustumProjection::FrustumProjection(float, float, float, float, float, float)
  • DirectProjection::DirectProjection()
  • DirectProjection::DirectProjection(sead::Matrix44<float> const*, sead::Graphics::DevicePosture)
  • DirectProjection::setDirectProjectionMatrix(sead::Matrix44<float> const*, sead::Graphics::DevicePosture)
  • DirectProjection::updateAttributesForDirectProjection()
  • DirectProjection::doUpdateMatrix(sead::Matrix44<float>*) const
  • DirectProjection::doScreenPosToCameraPosTo(sead::Vector3<float>*, sead::Vector3<float> const&) const

Next Steps
I'm looking for feedback on the non-matching functions, and which of the library files that have been modified that need to be updated here.


This change is Reviewable

@aboood40091
Copy link
Collaborator

All projections must be in the same header/cpp file.

@Esras Esras marked this pull request as draft June 15, 2023 04:31
@Esras Esras changed the title Projection Libraries RFC: Projection Libraries Jul 6, 2023
@Esras Esras marked this pull request as ready for review July 6, 2023 19:30
@ThePixelGamer ThePixelGamer self-requested a review August 7, 2023 19:40
Copy link
Contributor

@ThePixelGamer ThePixelGamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good but abood mentioned the projection headers and sources are supposed to be condensed into one file ie. seadProjection.(h/cpp)

@@ -63,6 +63,6 @@ class GraphicsNvn : public Graphics
bool _201;
bool _202;
};
static_assert(sizeof(GraphicsNvn) == 0x208);
// static_assert(sizeof(GraphicsNvn) == 0x208);
Copy link
Contributor

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?

} // namespace sead

#endif // SEAD_GRAPHICS_CONTEXT_H_
#ifndef SEAD_GRAPHICS_CONTEXT_H_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra copy and paste?

@@ -0,0 +1,550 @@
#ifndef SEAD_GRAPHICS_CONTEXT_H_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#pragma once

@@ -1,31 +1,35 @@
#pragma once
#ifndef SEAD_VIEWPORT_H_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pragma once

explicit Viewport(const BoundBox2f& parent);
explicit Viewport(const LogicalFrameBuffer& buffer);
Viewport(f32 left, f32 top, f32 sizeX, f32 sizeY);
// explicit Viewport(const BoundBox2f& box);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason behind commenting this out?

@@ -22,8 +22,6 @@ s32 DirectResource::getLoadDataAlignment() const
return 4;
}

void DirectResource::doCreate_(u8*, u32, Heap*) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change seems unrelated to the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants