pub struct QuadGl { /* private fields */ }
Implementations§
source§impl QuadGl
impl QuadGl
pub fn new(ctx: &mut dyn RenderingBackend) -> QuadGl
pub fn make_pipeline( &mut self, ctx: &mut dyn RenderingBackend, shader: ShaderSource<'_>, params: PipelineParams, uniforms: Vec<(String, UniformType)>, 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 fn get_active_render_pass(&self) -> Option<RenderPass>
pub 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)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
fn tree(gl: &mut QuadGl, time: f64, deep: u32, angle: f32, tall: f32) {
if deep >= 8 {
return;
}
// we can use normal macroquad drawing API here
draw_rectangle(-0.01 / 2., 0., 0.01, tall, DARKGRAY);
// and we can also modify internal macroquad render state with "gl" reference
gl.push_model_matrix(glam::Mat4::from_translation(glam::vec3(0., tall, 0.)));
// right leaf
gl.push_model_matrix(glam::Mat4::from_rotation_z(angle + time.sin() as f32 * 0.1));
tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
gl.pop_model_matrix();
// left leaf
gl.push_model_matrix(glam::Mat4::from_rotation_z(
-angle - time.cos() as f32 * 0.1,
));
tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
gl.pop_model_matrix();
gl.pop_model_matrix();
}
sourcepub fn pop_model_matrix(&mut self)
pub fn pop_model_matrix(&mut self)
Examples found in repository?
examples/tree.rs (line 17)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
fn tree(gl: &mut QuadGl, time: f64, deep: u32, angle: f32, tall: f32) {
if deep >= 8 {
return;
}
// we can use normal macroquad drawing API here
draw_rectangle(-0.01 / 2., 0., 0.01, tall, DARKGRAY);
// and we can also modify internal macroquad render state with "gl" reference
gl.push_model_matrix(glam::Mat4::from_translation(glam::vec3(0., tall, 0.)));
// right leaf
gl.push_model_matrix(glam::Mat4::from_rotation_z(angle + time.sin() as f32 * 0.1));
tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
gl.pop_model_matrix();
// left leaf
gl.push_model_matrix(glam::Mat4::from_rotation_z(
-angle - time.cos() as f32 * 0.1,
));
tree(gl, time, deep + 1, angle * 0.7, tall * 0.8);
gl.pop_model_matrix();
gl.pop_model_matrix();
}
pub fn pipeline(&mut self, pipeline: Option<GlPipeline>)
pub fn draw_mode(&mut self, mode: DrawMode)
pub fn geometry( &mut self, vertices: &[impl Into<([f32; 3], [f32; 2], [f32; 4])> + Copy], 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_texture( &mut self, pipeline: GlPipeline, name: &str, texture: Texture2D )
Auto Trait Implementations§
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