Trait gfx::traits::FactoryExt
[−]
[src]
pub trait FactoryExt<R: Resources>: Factory<R> { fn create_vertex_buffer<T>(&mut self, vertices: &[T]) -> Buffer<R, T> where T: Copy + Structure<Format> { ... } fn create_vertex_buffer_with_slice<B, V>(&mut self, vertices: &[V], indices: B) -> (Buffer<R, V>, Slice<R>) where V: Copy + Structure<Format>, B: IntoIndexBuffer<R> { ... } fn create_constant_buffer<T>(&mut self, num: usize) -> Buffer<R, T> { ... } fn create_shader_set(&mut self, vs_code: &[u8], ps_code: &[u8]) -> Result<ShaderSet<R>, ProgramError> { ... } fn link_program(&mut self, vs_code: &[u8], ps_code: &[u8]) -> Result<Program<R>, ProgramError> { ... } fn create_pipeline_state<I: PipelineInit>(&mut self, shaders: &ShaderSet<R>, primitive: Primitive, rasterizer: Rasterizer, init: I) -> Result<PipelineState<R, I::Meta>, PipelineStateError> { ... } fn create_pipeline_from_program<I: PipelineInit>(&mut self, program: &Program<R>, primitive: Primitive, rasterizer: Rasterizer, init: I) -> Result<PipelineState<R, I::Meta>, PipelineStateError> { ... } fn create_pipeline_simple<I: PipelineInit>(&mut self, vs: &[u8], ps: &[u8], init: I) -> Result<PipelineState<R, I::Meta>, PipelineStateError> { ... } fn create_sampler_linear(&mut self) -> Sampler<R> { ... } }
This trait is responsible for creating and managing graphics resources, much like the Factory
trait in the gfx
crate. Every Factory
automatically implements FactoryExt
.
Provided Methods
fn create_vertex_buffer<T>(&mut self, vertices: &[T]) -> Buffer<R, T> where T: Copy + Structure<Format>
Create a vertex buffer from the supplied data. A Slice
will have to manually be
constructed.
fn create_vertex_buffer_with_slice<B, V>(&mut self, vertices: &[V], indices: B) -> (Buffer<R, V>, Slice<R>) where V: Copy + Structure<Format>, B: IntoIndexBuffer<R>
Shorthand for creating a new vertex buffer from the supplied vertices, together with a
Slice
from the supplied indices.
fn create_constant_buffer<T>(&mut self, num: usize) -> Buffer<R, T>
Create a constant buffer for num
identical elements of type T
.
fn create_shader_set(&mut self, vs_code: &[u8], ps_code: &[u8]) -> Result<ShaderSet<R>, ProgramError>
Creates a ShaderSet
from the supplied vertex and pixel shader source code.
fn link_program(&mut self, vs_code: &[u8], ps_code: &[u8]) -> Result<Program<R>, ProgramError>
Creates a basic shader Program
from the supplied vertex and pixel shader source code.
fn create_pipeline_state<I: PipelineInit>(&mut self, shaders: &ShaderSet<R>, primitive: Primitive, rasterizer: Rasterizer, init: I) -> Result<PipelineState<R, I::Meta>, PipelineStateError>
Similar to create_pipeline_from_program(..)
, but takes a ShaderSet
as opposed to a
shader Program
.
fn create_pipeline_from_program<I: PipelineInit>(&mut self, program: &Program<R>, primitive: Primitive, rasterizer: Rasterizer, init: I) -> Result<PipelineState<R, I::Meta>, PipelineStateError>
Creates a strongly typed PipelineState
from its Init
structure, a shader Program
, a
primitive type and a Rasterizer
.
fn create_pipeline_simple<I: PipelineInit>(&mut self, vs: &[u8], ps: &[u8], init: I) -> Result<PipelineState<R, I::Meta>, PipelineStateError>
Creates a strongly typed PipelineState
from its Init
structure. Automatically creates a
shader Program
from a vertex and pixel shader source, as well as a Rasterizer
capable
of rendering triangle faces without culling.
fn create_sampler_linear(&mut self) -> Sampler<R>
Create a linear sampler with clamping to border.