bevy/examples/3d
Robert Swain f4aa3284a8 bevy_pbr2: Add support for not casting/receiving shadows (#2726)
# Objective

Allow marking meshes as not casting / receiving shadows.

## Solution

- Added `NotShadowCaster` and `NotShadowReceiver` zero-sized type components.
- Extract these components into `bool`s in `ExtractedMesh`
- Only generate `DrawShadowMesh` `Drawable`s for meshes _without_ `NotShadowCaster`
- Add a `u32` bit `flags` member to `MeshUniform` with one flag indicating whether the mesh is a shadow receiver
- If a mesh does _not_ have the `NotShadowReceiver` component, then it is a shadow receiver, and so the bit in the `MeshUniform` is set, otherwise it is not set.
- Added an example illustrating the functionality.

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 add `ShadowCaster` and `ShadowReceiver` components, but I also really don't like the double negatives the `Not*` approach incurs. What do you think?

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-08-25 19:44:20 +00:00
..
3d_scene.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
3d_scene_pipelined.rs bevy_pbr2: Improve lighting units and documentation (#2704) 2021-08-23 23:48:11 +00:00
cornell_box_pipelined.rs remove .system from pipelined code (#2538) 2021-07-26 23:44:23 +00:00
load_gltf.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
load_gltf_pipelined.rs Port bevy_gltf to pipelined-rendering (#2537) 2021-07-30 03:37:34 +00:00
msaa.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
orthographic.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
parenting.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
pbr.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
pbr_pipelined.rs omni light -> point light 2021-07-24 16:43:37 -07:00
render_to_texture.rs SubGraphs, Views, Shadows, and more 2021-07-24 16:43:37 -07:00
shadow_biases_pipelined.rs remove .system from pipelined code (#2538) 2021-07-26 23:44:23 +00:00
shadow_caster_receiver_pipelined.rs bevy_pbr2: Add support for not casting/receiving shadows (#2726) 2021-08-25 19:44:20 +00:00
spawner.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
texture.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
texture_pipelined.rs remove .system from pipelined code (#2538) 2021-07-26 23:44:23 +00:00
update_gltf_scene.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
wireframe.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00
z_sort_debug.rs pipelined rendering proof of concept 2021-07-24 16:43:37 -07:00