Skip to content

Commit 6f8e403

Browse files
mweatherleymockersf
authored andcommitted
Incorporate OIT into MeshPipelineKey used by the LineGizmoPipeline (#17946)
Fixes #17945 Check if the view being extracted has OIT enabled and incorporate the associated bit into the mesh pipeline key. I basically have no idea what's going on in the renderer, so let me know if I missed something, which is extraordinarily possible. I modified the `order_independent_transparency` example to put everything on the default render layer and render a gizmo at the origin. Previously, this would cause the application to panic.
1 parent 8628545 commit 6f8e403

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/bevy_gizmos/src/pipeline_3d.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::{
77
use bevy_app::{App, Plugin};
88
use bevy_core_pipeline::{
99
core_3d::{Transparent3d, CORE_3D_DEPTH_FORMAT},
10+
oit::OrderIndependentTransparencySettings,
1011
prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass},
1112
};
1213

@@ -294,6 +295,7 @@ fn queue_line_gizmos_3d(
294295
Has<DepthPrepass>,
295296
Has<MotionVectorPrepass>,
296297
Has<DeferredPrepass>,
298+
Has<OrderIndependentTransparencySettings>,
297299
),
298300
)>,
299301
) {
@@ -304,7 +306,7 @@ fn queue_line_gizmos_3d(
304306
view,
305307
msaa,
306308
render_layers,
307-
(normal_prepass, depth_prepass, motion_vector_prepass, deferred_prepass),
309+
(normal_prepass, depth_prepass, motion_vector_prepass, deferred_prepass, oit),
308310
) in &mut views
309311
{
310312
let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else {
@@ -332,6 +334,10 @@ fn queue_line_gizmos_3d(
332334
view_key |= MeshPipelineKey::DEFERRED_PREPASS;
333335
}
334336

337+
if oit {
338+
view_key |= MeshPipelineKey::OIT_ENABLED;
339+
}
340+
335341
for (entity, main_entity, config) in &line_gizmos {
336342
if !config.render_layers.intersects(render_layers) {
337343
continue;

0 commit comments

Comments
 (0)