pub fn send_layer_vertex_buffer(&mut self, layer_id: LayerHandle, render_index: usize) -> Vec<render::RenderAction> {
        let LayerHandle(layer_idx)  = layer_id;
        let layer_idx               = layer_idx as usize;

        // Remove the action from the layer
        let mut vertex_action = RenderEntity::Missing;
        mem::swap(&mut self.layer_definitions[layer_idx].render_order[render_index], &mut vertex_action);

        // The action we just removed should be a vertex buffer action
        match vertex_action {
            RenderEntity::VertexBuffer(vertices, intent) => {
                // Allocate a buffer
                let buffer_id = self.allocate_vertex_buffer();

                // Draw these buffers as the action at this position
                match intent {
                    VertexBufferIntent::Draw    => {
                        self.layer_definitions[layer_idx].render_order[render_index] = RenderEntity::DrawIndexed(render::VertexBufferId(buffer_id), render::IndexBufferId(buffer_id), vertices.indices.len());
                    }

                    VertexBufferIntent::Clip    => {
                        self.layer_definitions[layer_idx].render_order[render_index] = RenderEntity::EnableClipping(render::VertexBufferId(buffer_id), render::IndexBufferId(buffer_id), vertices.indices.len());
                    }
                }

                // Send the vertices and indices to the rendering engine
                vec![
                    render::RenderAction::CreateIndexBuffer(render::IndexBufferId(buffer_id), vertices.indices),
                    render::RenderAction::CreateVertex2DBuffer(render::VertexBufferId(buffer_id), vertices.vertices),
                ]
            }

            _ => panic!("send_vertex_buffer must be used on a vertex buffer item")
        }
    }
///
/// Returns the render actions required to send a vertex buffer (as a stack, so in reverse order)
///
Returns the render actions required to send a vertex buffer (as a stack, so in reverse order)
Returns the render actions required to send a vertex buffer ( as a stack so in reverse order )
pub fn send_layer_vertex_buffer(&mut self, layer_id: LayerHandle, render_index: usize) -> Vec<render::RenderAction> {
        let LayerHandle(layer_idx)  = layer_id;
        let layer_idx               = layer_idx as usize;
        // Remove the action from the layer
        let mut vertex_action = RenderEntity::Missing;
        mem::swap(&mut self.layer_definitions[layer_idx].render_order[render_index], &mut vertex_action);
        // The action we just removed should be a vertex buffer action
        match vertex_action {
            RenderEntity::VertexBuffer(vertices, intent) => {
                // Allocate a buffer
                let buffer_id = self.allocate_vertex_buffer();
                // Draw these buffers as the action at this position
                match intent {
                    VertexBufferIntent::Draw    => {
                        self.layer_definitions[layer_idx].render_order[render_index] = RenderEntity::DrawIndexed(render::VertexBufferId(buffer_id), render::IndexBufferId(buffer_id), vertices.indices.len());
                    }
                    VertexBufferIntent::Clip    => {
                        self.layer_definitions[layer_idx].render_order[render_index] = RenderEntity::EnableClipping(render::VertexBufferId(buffer_id), render::IndexBufferId(buffer_id), vertices.indices.len());
                    }
                }
                // Send the vertices and indices to the rendering engine
                vec![
                    render::RenderAction::CreateIndexBuffer(render::IndexBufferId(buffer_id), vertices.indices),
                    render::RenderAction::CreateVertex2DBuffer(render::VertexBufferId(buffer_id), vertices.vertices),
                ]
            }
            _ => panic!("send_vertex_buffer must be used on a vertex buffer item")
        }
    }
pub fn send_layer_vertex_buffer ( & mut self , layer_id : LayerHandle , render_index : usize ) -> Vec < render :: RenderAction > { let LayerHandle ( layer_idx ) = layer_id ; let layer_idx = layer_idx as usize ; // Remove the action from the layer let mut vertex_action = RenderEntity :: Missing ; mem :: swap ( & mut self . layer_definitions [ layer_idx ] . render_order [ render_index ] , & mut vertex_action ) ; // The action we just removed should be a vertex buffer action match vertex_action { RenderEntity :: VertexBuffer ( vertices , intent ) => { // Allocate a buffer let buffer_id = self . allocate_vertex_buffer ( ) ; // Draw these buffers as the action at this position match intent { VertexBufferIntent :: Draw => { self . layer_definitions [ layer_idx ] . render_order [ render_index ] = RenderEntity :: DrawIndexed ( render :: VertexBufferId ( buffer_id ) , render :: IndexBufferId ( buffer_id ) , vertices . indices . len ( ) ) ; } VertexBufferIntent :: Clip => { self . layer_definitions [ layer_idx ] . render_order [ render_index ] = RenderEntity :: EnableClipping ( render :: VertexBufferId ( buffer_id ) , render :: IndexBufferId ( buffer_id ) , vertices . indices . len ( ) ) ; } } // Send the vertices and indices to the rendering engine vec ! [ render RenderAction CreateIndexBuffer ( render IndexBufferId ( buffer_id ) vertices indices ) render RenderAction CreateVertex2DBuffer ( render VertexBufferId ( buffer_id ) vertices vertices ) ] } _ => panic ! ( " " ) } }
Returns the render actions required to send a vertex buffer (as a stack, so in reverse order)
Returns the render actions required to send a vertex buffer ( as a stack so in reverse order )
&mut self
layer_id
LayerHandle
render_index
usize