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
6 changes: 2 additions & 4 deletions src/esp/gfx/GenericDrawable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,8 @@ void GenericDrawable::draw(const Mn::Matrix4& transformationMatrix,
// fragment shader
.setObjectId(
static_cast<RenderCamera&>(camera).useDrawableIds() ? drawableId_
: ((((flags_ & Mn::Shaders::PhongGL::Flag::InstancedObjectId) ==
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.

(flags_ >= Mn::Shaders::PhongGL::Flag::ObjectIdTexture)))
? 0
: node_.getSemanticId())
.setTransformationMatrix(transformationMatrix)
Expand Down
Loading