[−][src]Struct duku::Duku
The renderer context.
Entrypoint into the duku API
Examples
let (mut duku, window) = Duku::windowed(500, 500).unwrap();
Fields
builtins: Builtins
Built-in resources
Implementations
impl Duku
[src]
pub const fn builder() -> DukuBuilder
[src]
Create builder for duku context
pub fn draw(&mut self, camera: Option<&Camera>, draw_fn: impl Fn(&mut Target))
[src]
Start rendering on the window canvas
If camera
is None
a default camera that fits the
canvas will be used.
Examples
duku.draw(None, |t| { // record drawing commands });
pub fn draw_on_canvas(
&mut self,
canvas: &Handle<Canvas>,
camera: Option<&Camera>,
draw_fn: impl Fn(&mut Target)
)
[src]
&mut self,
canvas: &Handle<Canvas>,
camera: Option<&Camera>,
draw_fn: impl Fn(&mut Target)
)
Start rendering on a specified canvas
If camera
is None
a default camera that fits the
canvas will be used.
Examples
let canvas = duku.create_canvas(640, 360).unwrap(); duku.draw_on_canvas(&canvas, None, |t| { // record drawing commands });
pub fn create_texture(
&mut self,
data: Vec<u8>,
format: Format,
mips: Mips,
width: u32,
height: u32
) -> Result<Handle<Texture>>
[src]
&mut self,
data: Vec<u8>,
format: Format,
mips: Mips,
width: u32,
height: u32
) -> Result<Handle<Texture>>
Create a texture from byte data
pub fn create_cubemap(
&mut self,
format: Format,
size: u32,
sides: CubemapSides<Vec<u8>>
) -> Result<Handle<Cubemap>>
[src]
&mut self,
format: Format,
size: u32,
sides: CubemapSides<Vec<u8>>
) -> Result<Handle<Cubemap>>
Create a cubemap from byte data
pub fn create_mesh(&mut self) -> Handle<Mesh>
[src]
Create a mesh
pub fn create_mesh_cube(&mut self) -> Handle<Mesh>
[src]
Create a cube mesh
pub fn create_mesh_sphere_ico(&mut self, detail: u32) -> Handle<Mesh>
[src]
Create an ico-sphere mesh
pub fn create_mesh_sphere_uv(
&mut self,
meridians: u32,
parallels: u32
) -> Handle<Mesh>
[src]
&mut self,
meridians: u32,
parallels: u32
) -> Handle<Mesh>
Create a uv-sphere mesh
pub fn create_model(&mut self) -> Handle<Model>
[src]
Create a model
pub fn create_material(&mut self) -> Result<Handle<Material>>
[src]
Create a material
pub fn create_material_pbr(&mut self) -> Result<Handle<Material>>
[src]
Create a material with PBR defaults
pub fn create_canvas(
&mut self,
width: u32,
height: u32
) -> Result<Handle<Canvas>>
[src]
&mut self,
width: u32,
height: u32
) -> Result<Handle<Canvas>>
Create a canvas
pub fn create_canvas_for_shader(
&mut self,
shader: &Handle<Shader>,
width: u32,
height: u32
) -> Result<Handle<Canvas>>
[src]
&mut self,
shader: &Handle<Shader>,
width: u32,
height: u32
) -> Result<Handle<Canvas>>
Create a canvas with configuration based on a shader
pub fn create_shader_spirv(
&mut self,
path: impl AsRef<Path>
) -> Result<Handle<Shader>>
[src]
&mut self,
path: impl AsRef<Path>
) -> Result<Handle<Shader>>
Create a shader from a SPIR-V file
pub fn create_shader_spirv_bytes(
&mut self,
bytes: &[u8]
) -> Result<Handle<Shader>>
[src]
&mut self,
bytes: &[u8]
) -> Result<Handle<Shader>>
Create a shader from SPIR-V bytes
pub fn create_shader_bytes(
&mut self,
vert: &[u8],
frag: &[u8],
bytes: [u8; 4]
) -> Result<Handle<Shader>>
[src]
&mut self,
vert: &[u8],
frag: &[u8],
bytes: [u8; 4]
) -> Result<Handle<Shader>>
Create a shader
This should be used only if building a 3rd party shader compiler
pub fn create_font(&mut self, data: FontData<'_>) -> Result<Handle<Font>>
[src]
Create a font
This should be used only if building a 3rd party font support
pub fn stats(&self) -> Stats
[src]
Get last render's statistics
pub const fn delta_time(&self) -> f32
[src]
Get time between frames
pub const fn fps(&self) -> u32
[src]
Get current FPS
impl Duku
[src]
pub fn windowed(width: u32, height: u32) -> Result<(Duku, Window)>
[src]
Create Duku with a basic window
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Duku
impl !Send for Duku
impl !Sync for Duku
impl Unpin for Duku
impl UnwindSafe for Duku
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,