fn builder(
        &mut self,
        factory: &mut Factory<DefaultBackend>,
        res: &Resources,
    ) -> GraphBuilder<DefaultBackend, Resources> {
        use amethyst::renderer::rendy::{
            graph::present::PresentNode,
            hal::command::{ClearDepthStencil, ClearValue},
        };

        self.dirty = false;

        // Retrieve a reference to the target window, which is created by the WindowBundle
        let window = <ReadExpect<'_, Window>>::fetch(res);
        let dimensions = self.dimensions.as_ref().unwrap();
        let window_kind = Kind::D2(dimensions.width() as u32, dimensions.height() as u32, 1, 1);

        // Create a new drawing surface in our window
        let surface = factory.create_surface(&window);
        let surface_format = factory.get_surface_format(&surface);

        // Begin building our RenderGraph
        let mut graph_builder = GraphBuilder::new();
        let color = graph_builder.create_image(
            window_kind,
            1,
            surface_format,
            // clear screen to black
            Some(ClearValue::Color([0.0, 0.0, 0.0, 1.0].into())),
        );

        let depth = graph_builder.create_image(
            window_kind,
            1,
            Format::D32Sfloat,
            Some(ClearValue::DepthStencil(ClearDepthStencil(1.0, 0))),
        );

        // Create our single `Subpass`, which is the DrawFlat2D pass.
        // We pass the subpass builder a description of our pass for construction
        let sprite = graph_builder.add_node(
            SubpassBuilder::new()
                .with_group(DrawFlat2DDesc::default().builder())
                .with_color(color)
                .with_depth_stencil(depth)
                .into_pass(),
        );

        // Finally, add the pass to the graph
        let _present = graph_builder
            .add_node(PresentNode::builder(factory, surface, color).with_dependency(sprite));

        graph_builder
    }
// This is the core of a RenderGraph, which is building the actual graph with subpasses and target
// images.
This is the core of a RenderGraph, which is building the actual graph with subpasses and target
images.
This is the core of a RenderGraph which is building the actual graph with subpasses and target images .
fn builder(
        &mut self,
        factory: &mut Factory<DefaultBackend>,
        res: &Resources,
    ) -> GraphBuilder<DefaultBackend, Resources> {
        use amethyst::renderer::rendy::{
            graph::present::PresentNode,
            hal::command::{ClearDepthStencil, ClearValue},
        };
        self.dirty = false;
        // Retrieve a reference to the target window, which is created by the WindowBundle
        let window = <ReadExpect<'_, Window>>::fetch(res);
        let dimensions = self.dimensions.as_ref().unwrap();
        let window_kind = Kind::D2(dimensions.width() as u32, dimensions.height() as u32, 1, 1);
        // Create a new drawing surface in our window
        let surface = factory.create_surface(&window);
        let surface_format = factory.get_surface_format(&surface);
        // Begin building our RenderGraph
        let mut graph_builder = GraphBuilder::new();
        let color = graph_builder.create_image(
            window_kind,
            1,
            surface_format,
            // clear screen to black
            Some(ClearValue::Color([0.0, 0.0, 0.0, 1.0].into())),
        );
        let depth = graph_builder.create_image(
            window_kind,
            1,
            Format::D32Sfloat,
            Some(ClearValue::DepthStencil(ClearDepthStencil(1.0, 0))),
        );
        // Create our single `Subpass`, which is the DrawFlat2D pass.
        // We pass the subpass builder a description of our pass for construction
        let sprite = graph_builder.add_node(
            SubpassBuilder::new()
                .with_group(DrawFlat2DDesc::default().builder())
                .with_color(color)
                .with_depth_stencil(depth)
                .into_pass(),
        );
        // Finally, add the pass to the graph
        let _present = graph_builder
            .add_node(PresentNode::builder(factory, surface, color).with_dependency(sprite));
        graph_builder
    }
fn builder ( & mut self , factory : & mut Factory < DefaultBackend > , res : & Resources , ) -> GraphBuilder < DefaultBackend , Resources > { use amethyst :: renderer :: rendy :: { graph :: present :: PresentNode , hal :: command :: { ClearDepthStencil , ClearValue } , } ; self . dirty = false ; // Retrieve a reference to the target window, which is created by the WindowBundle let window = < ReadExpect < ' _ , Window > > :: fetch ( res ) ; let dimensions = self . dimensions . as_ref ( ) . unwrap ( ) ; let window_kind = Kind :: D2 ( dimensions . width ( ) as u32 , dimensions . height ( ) as u32 , 1 , 1 ) ; // Create a new drawing surface in our window let surface = factory . create_surface ( & window ) ; let surface_format = factory . get_surface_format ( & surface ) ; // Begin building our RenderGraph let mut graph_builder = GraphBuilder :: new ( ) ; let color = graph_builder . create_image ( window_kind , 1 , surface_format , // clear screen to black Some ( ClearValue :: Color ( [ 0.0 , 0.0 , 0.0 , 1.0 ] . into ( ) ) ) , ) ; let depth = graph_builder . create_image ( window_kind , 1 , Format :: D32Sfloat , Some ( ClearValue :: DepthStencil ( ClearDepthStencil ( 1.0 , 0 ) ) ) , ) ; // Create our single `Subpass`, which is the DrawFlat2D pass. // We pass the subpass builder a description of our pass for construction let sprite = graph_builder . add_node ( SubpassBuilder :: new ( ) . with_group ( DrawFlat2DDesc :: default ( ) . builder ( ) ) . with_color ( color ) . with_depth_stencil ( depth ) . into_pass ( ) , ) ; // Finally, add the pass to the graph let _present = graph_builder . add_node ( PresentNode :: builder ( factory , surface , color ) . with_dependency ( sprite ) ) ; graph_builder }
This is the core of a RenderGraph, which is building the actual graph with subpasses and target
images.
This is the core of a RenderGraph which is building the actual graph with subpasses and target images .
&mut self
factory
&mut Factory<DefaultBackend>
res
&Resources
&mut self
factory
&mut Factory<DefaultBackend>
res
&Resources