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

--[PBR Update 1 of 3] Map materials' extension/layer data to Drawables cache #2112

Merged
merged 10 commits into from
May 18, 2023

Conversation

jturner65
Copy link
Contributor

Motivation and Context

This PR is the first of 3 (or possibly 4) PRs to implement Habitat's new PBR materials extension support, drawn from the original WIP found here.

In this PR the gltf extension data present in the Magnum material are loaded into each drawable's existing cache structure, to be more easily accessed each draw. No changes to the shader are present in this PR.

How Has This Been Tested

Existing C++ and python tests pass locally.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label May 18, 2023
@jturner65 jturner65 requested review from aclegg3, Skylion007 and 0mdc May 18, 2023 17:12
.addSource(flags_ & Flag::ObjectId ? "#define OBJECT_ID\n" : "")
.addSource(flags_ & Flag::ClearCoatLayer ? "#define CLEAR_COAT\n" : "")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops one flag got past me as I cherry picked this. If this antagonizes anyone 😁 I'll get rid of it, but it's going to be added in the next PR anyway.

@jturner65 jturner65 requested a review from mosra May 18, 2023 17:19
src/esp/gfx/PbrDrawable.cpp Outdated Show resolved Hide resolved
src/esp/gfx/PbrDrawable.cpp Show resolved Hide resolved
src/esp/gfx/PbrDrawable.cpp Outdated Show resolved Hide resolved
src/esp/gfx/PbrDrawable.h Outdated Show resolved Hide resolved
src/esp/gfx/PbrShader.h Show resolved Hide resolved
Copy link
Contributor

@eundersander eundersander left a comment

Choose a reason for hiding this comment

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

I left some comments! I'll let others weigh in on the enum usage concerns before approving.

Mn::Shaders::PhongGL::Flag::InstancedObjectId) ||
((flags_ & Mn::Shaders::PhongGL::Flag::ObjectIdTexture)) ==
Mn::Shaders::PhongGL::Flag::ObjectIdTexture))
: (((flags_ >= Mn::Shaders::PhongGL::Flag::InstancedObjectId) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we compare flags with >=? Isn't flags basically a bitfield?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's how magnum compares multi-bit flags

Copy link
Collaborator

Choose a reason for hiding this comment

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

Docs for reference, >= is chosen because it looks close to a ⊇, a symbol for a superset.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok so, what the heck do these lines mean? :) Is it testing whether flags_ includes InstanceObjectId?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it testing whether flags_ includes InstanceObjectId?

Yes. It's a shorthand for (a & other) == other, as the docs say. It does exactly what it did before -- checking if one set of bits is a superset of the other set -- just in a more concise way.

src/esp/gfx/PbrDrawable.cpp Outdated Show resolved Hide resolved
src/esp/gfx/PbrDrawable.cpp Outdated Show resolved Hide resolved
src/esp/gfx/PbrShader.h Outdated Show resolved Hide resolved
src/esp/gfx/PbrShader.h Show resolved Hide resolved
@jturner65 jturner65 merged commit 957e419 into main May 18, 2023
@jturner65 jturner65 deleted the PBR_MaterialsToDrawablesCache branch May 18, 2023 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants