Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
IceSentry committed Jan 15, 2024
1 parent 0ce5230 commit b4c6477
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions examples/shader/custom_render_phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
});

// Spawn 3 cubes that use the custom draw command
// Each cube is at a different depth to show that the sorting works correctly
// Each cube is at a different depth to show the sorting

commands.spawn(CustomMaterialMeshBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
Expand Down Expand Up @@ -128,11 +128,14 @@ impl Plugin for CustomRenderPhasePlugin {
.add_systems(
Render,
(
// TODO
queue_mesh_custom_phase.in_set(RenderSet::Queue),
// This will automatically sort all items in the phase based on the [`PhaseItem::sort_key()`]
sort_phase_system::<CustomPhaseItem>.in_set(RenderSet::PhaseSort),
// TODO
batch_and_prepare_render_phase::<CustomPhaseItem, MeshPipeline>
.in_set(RenderSet::PrepareResources),
// TODO
prepare_custom_bind_group.in_set(RenderSet::PrepareBindGroups),
),
);
Expand All @@ -149,13 +152,10 @@ impl Plugin for CustomRenderPhasePlugin {
// Add the node that will render the custom phase
.add_render_graph_node::<ViewNodeRunner<CustomNode>>(CORE_3D, CustomNode::NAME)
// This will schedule the custom node to run after the main opaque pass
.add_render_graph_edges(
.add_render_graph_edge(
CORE_3D,
&[
CustomNode::NAME,
core_3d::graph::node::START_MAIN_PASS,
// core_3d::graph::node::END_MAIN_PASS,
],
core_3d::graph::node::START_MAIN_PASS,
CustomNode::NAME,
);
}

Expand Down Expand Up @@ -196,8 +196,6 @@ impl ViewNode for CustomNode {
return Ok(());
}

// println!("node running");

// The render pass that will be used by the draw commands of the render phase.
// A render phase can only use a single render pass.
// If you need multiple passes you'll need a separate phase.
Expand Down Expand Up @@ -449,7 +447,6 @@ fn queue_mesh_custom_phase(
)>,
msaa: Res<Msaa>,
) {
println!("queue mesh");
let draw_function = draw_functions.read().id::<DrawCustom>();

for (view, visible_entities, mut custom_phase) in views.iter_mut() {
Expand Down Expand Up @@ -483,7 +480,6 @@ fn queue_mesh_custom_phase(
// This will be used to sort the draw command
let distance =
rangefinder.distance_translation(&mesh_instance.transforms.transform.translation);
// println!("{}", mesh_instance.transforms.transform.translation);

// Add the draw command for the mesh to the custom phase
custom_phase.add(CustomPhaseItem {
Expand Down

0 comments on commit b4c6477

Please sign in to comment.