pub struct QuadGl { /* private fields */ }
Implementations§
Source§impl QuadGl
impl QuadGl
pub fn new( ctx: &mut dyn RenderingBackend, max_vertices: usize, max_indices: usize, ) -> QuadGl
pub fn make_pipeline( &mut self, ctx: &mut dyn RenderingBackend, shader: ShaderSource<'_>, params: PipelineParams, uniforms: Vec<UniformDesc>, textures: Vec<String>, ) -> Result<GlPipeline, Error>
Sourcepub fn clear_draw_calls(&mut self)
pub fn clear_draw_calls(&mut self)
Reset only draw calls state
pub fn draw(&mut self, ctx: &mut dyn RenderingBackend, projection: Mat4)
pub fn get_projection_matrix(&self) -> Mat4
pub const fn get_active_render_pass(&self) -> Option<RenderPass>
pub const fn is_depth_test_enabled(&self) -> bool
pub fn render_pass(&mut self, render_pass: Option<RenderPass>)
pub fn depth_test(&mut self, enable: bool)
pub fn texture(&mut self, texture: Option<&Texture2D>)
pub fn scissor(&mut self, clip: Option<(i32, i32, i32, i32)>)
pub fn viewport(&mut self, viewport: Option<(i32, i32, i32, i32)>)
pub fn get_viewport(&self) -> (i32, i32, i32, i32)
Sourcepub fn push_model_matrix(&mut self, matrix: Mat4)
pub fn push_model_matrix(&mut self, matrix: Mat4)
Examples found in repository?
examples/tree.rs (line 12)
3fn tree(gl: &mut QuadGl, time: f64, deep: u32, angle: f32, tall: f32) {
4 if deep >= 8 {
5 return;
6 }
7
8 // we can use normal macroquad drawing API here
9 draw_rectangle(-0.01 / 2., 0., 0.01, tall, DARKGRAY);
10
11 // and we can also modify internal macroquad render state with "gl" reference
12 gl.push_model_matrix(glam::Mat4::from_translation(glam::vec3(0., tall, 0.)));
13
14 // right leaf
15 gl.push_model_matrix(glam::Mat4::from_rotation_z(angle + time.sin() as f32 * 0.1));
16 tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
17 gl.pop_model_matrix();
18
19 // left leaf
20 gl.push_model_matrix(glam::Mat4::from_rotation_z(
21 -angle - time.cos() as f32 * 0.1,
22 ));
23 tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
24 gl.pop_model_matrix();
25
26 gl.pop_model_matrix();
27}
Sourcepub fn pop_model_matrix(&mut self)
pub fn pop_model_matrix(&mut self)
Examples found in repository?
examples/tree.rs (line 17)
3fn tree(gl: &mut QuadGl, time: f64, deep: u32, angle: f32, tall: f32) {
4 if deep >= 8 {
5 return;
6 }
7
8 // we can use normal macroquad drawing API here
9 draw_rectangle(-0.01 / 2., 0., 0.01, tall, DARKGRAY);
10
11 // and we can also modify internal macroquad render state with "gl" reference
12 gl.push_model_matrix(glam::Mat4::from_translation(glam::vec3(0., tall, 0.)));
13
14 // right leaf
15 gl.push_model_matrix(glam::Mat4::from_rotation_z(angle + time.sin() as f32 * 0.1));
16 tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
17 gl.pop_model_matrix();
18
19 // left leaf
20 gl.push_model_matrix(glam::Mat4::from_rotation_z(
21 -angle - time.cos() as f32 * 0.1,
22 ));
23 tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
24 gl.pop_model_matrix();
25
26 gl.pop_model_matrix();
27}
pub fn pipeline(&mut self, pipeline: Option<GlPipeline>)
pub fn draw_mode(&mut self, mode: DrawMode)
pub fn geometry(&mut self, vertices: &[Vertex], indices: &[u16])
pub fn delete_pipeline(&mut self, pipeline: GlPipeline)
pub fn set_uniform<T>(&mut self, pipeline: GlPipeline, name: &str, uniform: T)
pub fn set_uniform_array<T: ToBytes>( &mut self, pipeline: GlPipeline, name: &str, uniform: &[T], )
pub fn set_texture( &mut self, pipeline: GlPipeline, name: &str, texture: Texture2D, )
Auto Trait Implementations§
impl Freeze for QuadGl
impl RefUnwindSafe for QuadGl
impl Send for QuadGl
impl Sync for QuadGl
impl Unpin for QuadGl
impl UnwindSafe for QuadGl
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