[Merged by Bors] - bevy_pbr2: Add support for not casting/receiving shadows #2726
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.
Objective
Allow marking meshes as not casting / receiving shadows.
Solution
NotShadowCaster
andNotShadowReceiver
zero-sized type components.bool
s inExtractedMesh
DrawShadowMesh
Drawable
s for meshes withoutNotShadowCaster
u32
bitflags
member toMeshUniform
with one flag indicating whether the mesh is a shadow receiverNotShadowReceiver
component, then it is a shadow receiver, and so the bit in theMeshUniform
is set, otherwise it is not set.NOTE: I wanted to have the default state of a mesh as being a shadow caster and shadow receiver, hence the
Not*
components. However, I am on the fence about this. I don't want to have a negative performance impact, nor have people wondering why their custom meshes don't have shadows because they forgot to addShadowCaster
andShadowReceiver
components, but I also really don't like the double negatives theNot*
approach incurs. What do you think?