From daeb3543b01362ff8c3b95f99d9b3948621a6ee6 Mon Sep 17 00:00:00 2001 From: Aaron Housh Date: Tue, 16 Jul 2019 12:14:54 -0700 Subject: [PATCH] Fix comments and rename to opaque subpass (#3) Rename default to opaque pass and add transparent as a separate subpass so the sprites will render --- src/render.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/render.rs b/src/render.rs index ed0f89a..04374cc 100644 --- a/src/render.rs +++ b/src/render.rs @@ -1,7 +1,7 @@ use amethyst::{ ecs::prelude::{ReadExpect, Resources, SystemData}, renderer::{ - pass::DrawFlat2DTransparentDesc, + pass::{DrawFlat2DDesc, DrawFlat2DTransparentDesc}, rendy::{ factory::Factory, graph::{ @@ -73,7 +73,16 @@ impl GraphCreator for RenderGraph { let depth = builder.create_image(window_kind, 1, Format::D32Sfloat, Some(clear_depth)); // Add additional draw groups here for things like UI - let pass = builder.add_node( + let opaque = builder.add_node( + SubpassBuilder::new() + // Draw sprites with flat subpass + .with_group(DrawFlat2DDesc::new().builder()) + .with_color(color) + .with_depth_stencil(depth) + .into_pass(), + ); + + let transparent = builder.add_node( SubpassBuilder::new() // Draw sprites with transparency .with_group(DrawFlat2DTransparentDesc::new().builder()) @@ -83,8 +92,11 @@ impl GraphCreator for RenderGraph { ); // Render the result to the surface - let present = PresentNode::builder(factory, surface, color).with_dependency(pass); - builder.add_node(present); + let _present = builder.add_node( + PresentNode::builder(factory, surface, color) + .with_dependency(opaque) + .with_dependency(transparent), + ); builder }