pub struct Model3DOpenGL {}
Implementations§
Source§impl Model3DOpenGL
impl Model3DOpenGL
pub fn new() -> Self
Sourcepub fn compile_and_link_program(
&self,
vertex_src: String,
fragment_src: String,
named_attrs: Vec<(String, VertexAttr)>,
named_uniforms: Vec<(String, UniformId)>,
named_uniform_buffers: HashMap<String, usize>,
named_textures: Vec<(String, TextureId, usize)>,
) -> Result<<Self as Gl>::Program, String>
pub fn compile_and_link_program( &self, vertex_src: String, fragment_src: String, named_attrs: Vec<(String, VertexAttr)>, named_uniforms: Vec<(String, UniformId)>, named_uniform_buffers: HashMap<String, usize>, named_textures: Vec<(String, TextureId, usize)>, ) -> Result<<Self as Gl>::Program, String>
Create a program from a list of compiled shaders
Trait Implementations§
Source§impl Debug for Model3DOpenGL
impl Debug for Model3DOpenGL
Source§impl Default for Model3DOpenGL
impl Default for Model3DOpenGL
Source§impl Gl for Model3DOpenGL
impl Gl for Model3DOpenGL
Source§fn use_program(&self, program: Option<&Self::Program>)
fn use_program(&self, program: Option<&Self::Program>)
Use the program
Source§fn program_use_texture(
&mut self,
program: &<Self as Gl>::Program,
texture_id: TextureId,
gl_texture: &<Self as Gl>::Texture,
)
fn program_use_texture( &mut self, program: &<Self as Gl>::Program, texture_id: TextureId, gl_texture: &<Self as Gl>::Texture, )
Requires the program to be ‘used’
type Program = Program
type Buffer = Buffer
type Vao = Vao
type Texture = Texture
type PipelineDesc<'a> = PipelineDesc
fn create_pipeline<F: Fn(&str) -> Result<String, String>>( &mut self, read_src: &F, pipeline_desc: Box<Self::PipelineDesc<'_>>, ) -> Result<Self::Program, String>
Source§fn init_buffer_of_indices(
&mut self,
buffer: &mut <Self as Gl>::Buffer,
view: &BufferIndexAccessor<'_, Self>,
)
fn init_buffer_of_indices( &mut self, buffer: &mut <Self as Gl>::Buffer, view: &BufferIndexAccessor<'_, Self>, )
Create the OpenGL ELEMENT_ARRAY_BUFFER buffer using STATIC_DRAW - this copies the data in to OpenGL
Source§fn vao_create_from_indices(
&mut self,
indices: &IndexBuffer<Self>,
) -> Result<Vao, ()>
fn vao_create_from_indices( &mut self, indices: &IndexBuffer<Self>, ) -> Result<Vao, ()>
Create a VAO, add the indices as its element array buffer, and
leave it bound
Source§fn buffer_bind_to_vao_attr(
&mut self,
buffer: &<Self as Gl>::Buffer,
attr_id: &<Program as GlProgram>::GlAttrId,
count: u32,
ele_type: BufferElementType,
byte_offset: u32,
stride: u32,
)
fn buffer_bind_to_vao_attr( &mut self, buffer: &<Self as Gl>::Buffer, attr_id: &<Program as GlProgram>::GlAttrId, count: u32, ele_type: BufferElementType, byte_offset: u32, stride: u32, )
With the currently bound VAO add this view of the specified
buffer as an attribute of the program, if the program has that
attribute
fn program_set_uniform_mat4( &mut self, program: &Program, id: UniformId, mat4: &Mat4, )
fn program_set_uniform_floats_4( &mut self, program: &Self::Program, id: UniformId, floats: &[f32], )
fn program_bind_uniform_index( &mut self, program: &<Self as Gl>::Program, uniform_buffer_id: usize, gl_uindex: u32, ) -> Result<(), ()>
Source§fn draw_primitive(&mut self, vaos: &[Vao], primitive: &Primitive)
fn draw_primitive(&mut self, vaos: &[Vao], primitive: &Primitive)
Draw the specified primitive using its VAO index into the vaos slice
fn bind_vao(&mut self, vao: Option<&Self::Vao>)
Source§fn uniform_buffer_create<F: Sized>(
&mut self,
data: &[F],
is_dynamic: bool,
) -> Result<UniformBuffer<Self>, ()>
fn uniform_buffer_create<F: Sized>( &mut self, data: &[F], is_dynamic: bool, ) -> Result<UniformBuffer<Self>, ()>
Create a uniform buffer (a GlBuffer in the GPU bound to GlUniformBuffer) Read more
Source§fn uniform_buffer_update_data<F: Debug>(
&mut self,
uniform_buffer: &UniformBuffer<Self>,
data: &[F],
byte_offset: u32,
)
fn uniform_buffer_update_data<F: Debug>( &mut self, uniform_buffer: &UniformBuffer<Self>, data: &[F], byte_offset: u32, )
Update (a portion) of a uniform GlBuffer
Source§fn uniform_index_of_range(
&mut self,
uniform_buffer: &UniformBuffer<Self>,
gl_uindex: u32,
byte_offset: usize,
byte_length: usize,
)
fn uniform_index_of_range( &mut self, uniform_buffer: &UniformBuffer<Self>, gl_uindex: u32, byte_offset: usize, byte_length: usize, )
Set the GPU’s UniformBlockMatrix index N to a range of a UniformBuffer
Source§impl Renderable for Model3DOpenGL
impl Renderable for Model3DOpenGL
Source§fn init_buffer_desc_client(
&mut self,
_client: &mut Self::Descriptor,
_buffer_desc: &BufferDescriptor<'_, Self>,
)
fn init_buffer_desc_client( &mut self, _client: &mut Self::Descriptor, _buffer_desc: &BufferDescriptor<'_, Self>, )
Initialize a buffer descriptor client - it will have been created using default()
Source§fn init_buffer_data_client(
&mut self,
client: &mut Self::Buffer,
buffer_data: &BufferData<'_, Self>,
)
fn init_buffer_data_client( &mut self, client: &mut Self::Buffer, buffer_data: &BufferData<'_, Self>, )
Initialize a BufferData client
This may be called multiple times for the same [BufferData]; if the gl buffer is 0 then create, else it already exists with the same data
Source§fn init_index_accessor_client(
&mut self,
client: &mut Self::IndexAccessor,
buffer_view: &BufferIndexAccessor<'_, Self>,
)
fn init_index_accessor_client( &mut self, client: &mut Self::IndexAccessor, buffer_view: &BufferIndexAccessor<'_, Self>, )
Initialize an accessor of indices
Source§fn init_data_accessor_client(
&mut self,
client: &mut Self::DataAccessor,
buffer_data_accessor: &BufferDataAccessor<'_, Self>,
)
fn init_data_accessor_client( &mut self, client: &mut Self::DataAccessor, buffer_data_accessor: &BufferDataAccessor<'_, Self>, )
Initialize the client side of a BufferDataAccessor (for a particular vertex attr)
Source§type Buffer = Buffer
type Buffer = Buffer
The renderer’s type that reflects a BufferData Read more
Source§type IndexAccessor = BufferView<Model3DOpenGL>
type IndexAccessor = BufferView<Model3DOpenGL>
The renderer’s type that reflects a BufferIndexAccessor Read more
Source§type DataAccessor = BufferView<Model3DOpenGL>
type DataAccessor = BufferView<Model3DOpenGL>
The renderer’s type that reflects a BufferDataAccessor Read more
Source§type Texture = Texture
type Texture = Texture
The renderer’s type that represents a texture; this is
supplied to material creation, and hence is less a product of
the renderer and more an input to the 3D model library
Source§type Material = Material
type Material = Material
The renderer’s type that reflects a Material; this is expected
to be an extraction of the aspects of a material that the
renderer pipelines can apply.
Source§type Vertices = Vertices<Model3DOpenGL>
type Vertices = Vertices<Model3DOpenGL>
The renderer’s type that reflects a [BufferAccessor] of indices
and the associated [BufferAccessor]s of attributes supported by a
particular pipeline within the renderer
Source§type Descriptor = Descriptor
type Descriptor = Descriptor
The renderer’s type that reflects a BufferDescriptor Read more
Source§fn create_vertices_client(
&mut self,
vertices: &Vertices<'_, Self>,
) -> Self::Vertices
fn create_vertices_client( &mut self, vertices: &Vertices<'_, Self>, ) -> Self::Vertices
Create a client
Source§fn create_texture_client(
&mut self,
texture: &Texture<'_, Self>,
) -> Self::Texture
fn create_texture_client( &mut self, texture: &Texture<'_, Self>, ) -> Self::Texture
Create a client
Auto Trait Implementations§
impl Freeze for Model3DOpenGL
impl RefUnwindSafe for Model3DOpenGL
impl Send for Model3DOpenGL
impl Sync for Model3DOpenGL
impl Unpin for Model3DOpenGL
impl UnwindSafe for Model3DOpenGL
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more