pub(crate) fn build(self, fac: &mut Factory, size: (u32, u32)) -> Result<(String, Target)> {
        use gfx::Factory;

        let size = self.custom_size.unwrap_or(size);

        let color_bufs = (0..self.num_color_bufs)
            .into_iter()
            .map(|_| {
                let (w, h) = (size.0 as u16, size.1 as u16);
                let (_, res, rt) = fac.create_render_target(w, h)?;
                Ok(ColorBuffer {
                    as_input: Some(res),
                    as_output: rt,
                })
            })
            .collect::<Result<_>>()?;

        let depth_buf = if self.has_depth_buf {
            let (w, h) = (size.0 as u16, size.1 as u16);
            let (_, res, dt) = fac.create_depth_stencil(w, h)?;
            let depth = DepthBuffer {
                as_input: Some(res),
                as_output: dt,
            };
            Some(depth)
        } else {
            None
        };

        let target = Target {
            color_bufs: color_bufs,
            depth_buf: depth_buf,
            size: size,
        };

        Ok((self.name, target))
    }
/// Builds and returns the new render target.
Builds and returns the new render target.
Builds and returns the new render target .
pub(crate) fn build(self, fac: &mut Factory, size: (u32, u32)) -> Result<(String, Target)> {
        use gfx::Factory;
        let size = self.custom_size.unwrap_or(size);
        let color_bufs = (0..self.num_color_bufs)
            .into_iter()
            .map(|_| {
                let (w, h) = (size.0 as u16, size.1 as u16);
                let (_, res, rt) = fac.create_render_target(w, h)?;
                Ok(ColorBuffer {
                    as_input: Some(res),
                    as_output: rt,
                })
            })
            .collect::<Result<_>>()?;
        let depth_buf = if self.has_depth_buf {
            let (w, h) = (size.0 as u16, size.1 as u16);
            let (_, res, dt) = fac.create_depth_stencil(w, h)?;
            let depth = DepthBuffer {
                as_input: Some(res),
                as_output: dt,
            };
            Some(depth)
        } else {
            None
        };
        let target = Target {
            color_bufs: color_bufs,
            depth_buf: depth_buf,
            size: size,
        };
        Ok((self.name, target))
    }
pub ( crate ) fn build ( self , fac : & mut Factory , size : ( u32 , u32 ) ) -> Result < ( String , Target ) > { use gfx :: Factory ; let size = self . custom_size . unwrap_or ( size ) ; let color_bufs = ( 0 .. self . num_color_bufs ) . into_iter ( ) . map ( | _ | { let ( w , h ) = ( size . 0 as u16 , size . 1 as u16 ) ; let ( _ , res , rt ) = fac . create_render_target ( w , h ) ? ; Ok ( ColorBuffer { as_input : Some ( res ) , as_output : rt , } ) } ) . collect :: < Result < _ > > ( ) ? ; let depth_buf = if self . has_depth_buf { let ( w , h ) = ( size . 0 as u16 , size . 1 as u16 ) ; let ( _ , res , dt ) = fac . create_depth_stencil ( w , h ) ? ; let depth = DepthBuffer { as_input : Some ( res ) , as_output : dt , } ; Some ( depth ) } else { None } ; let target = Target { color_bufs : color_bufs , depth_buf : depth_buf , size : size , } ; Ok ( ( self . name , target ) ) }
Builds and returns the new render target.
Builds and returns the new render target .
self
fac
&mut Factory
size
(u32, u32)
self
fac
&mut Factory
size
(u32, u32)