bevy/crates/bevy_pbr/src
Patrick Walton 26f7313212
Allow phase items not associated with meshes to be binned. (#14029)
As reported in #14004, many third-party plugins, such as Hanabi, enqueue
entities that don't have meshes into render phases. However, the
introduction of indirect mode added a dependency on mesh-specific data,
breaking this workflow. This is because GPU preprocessing requires that
the render phases manage indirect draw parameters, which don't apply to
objects that aren't meshes. The existing code skips over binned entities
that don't have indirect draw parameters, which causes the rendering to
be skipped for such objects.

To support this workflow, this commit adds a new field,
`non_mesh_items`, to `BinnedRenderPhase`. This field contains a simple
list of (bin key, entity) pairs. After drawing batchable and unbatchable
objects, the non-mesh items are drawn one after another. Bevy itself
doesn't enqueue any items into this list; it exists solely for the
application and/or plugins to use.

Additionally, this commit switches the asset ID in the standard bin keys
to be an untyped asset ID rather than that of a mesh. This allows more
flexibility, allowing bins to be keyed off any type of asset.

This patch adds a new example, `custom_phase_item`, which simultaneously
serves to demonstrate how to use this new feature and to act as a
regression test so this doesn't break again.

Fixes #14004.

## Changelog

### Added

* `BinnedRenderPhase` now contains a `non_mesh_items` field for plugins
to add custom items to.
2024-06-27 19:41:42 +02:00
..
cluster Rename "point light" to "clusterable object" in cluster contexts. (#13654) 2024-06-04 11:01:13 +00:00
deferred Revert "Make FOG_ENABLED a shader_def instead of material flag (#13783)" (#13803) 2024-06-11 02:01:14 +02:00
light Rename "point light" to "clusterable object" in cluster contexts. (#13654) 2024-06-04 11:01:13 +00:00
light_probe Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
lightmap Generate MeshUniforms on the GPU via compute shader where available. (#12773) 2024-04-10 05:33:32 +00:00
meshlet Fix incorrect computation of mips for cluster occlusion lookup (#14042) 2024-06-27 19:41:42 +02:00
prepass Allow phase items not associated with meshes to be binned. (#14029) 2024-06-27 19:41:42 +02:00
render Allow phase items not associated with meshes to be binned. (#14029) 2024-06-27 19:41:42 +02:00
ssao Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
ssr Implement opt-in sharp screen-space reflections for the deferred renderer, with improved raymarching code. (#13418) 2024-05-27 13:43:40 +00:00
volumetric_fog Adds back in way to convert color to u8 array, implemented for the two RGB color types, also renames Color::linear to Color::to_linear. (#13759) 2024-06-10 19:31:41 +02:00
bundle.rs Implement clone for most bundles. (#12993) 2024-04-16 16:37:09 +00:00
extended_material.rs Add missing Default impl to ExtendedMaterial. (#13008) 2024-04-18 12:57:14 +00:00
fog.rs Adds back in way to convert color to u8 array, implemented for the two RGB color types, also renames Color::linear to Color::to_linear. (#13759) 2024-06-10 19:31:41 +02:00
lib.rs Meshlet misc (#13761) 2024-06-10 19:31:41 +02:00
material.rs Allow phase items not associated with meshes to be binned. (#14029) 2024-06-27 19:41:42 +02:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Revert "Make FOG_ENABLED a shader_def instead of material flag (#13783)" (#13803) 2024-06-11 02:01:14 +02:00
wireframe.rs Use WireframeColor to override global color (#13034) 2024-04-20 13:59:12 +00:00