[−][src]Struct duku::Duku
The renderer context.
Entrypoint into the duku API
Example
let (mut duku, window) = Duku::builder() .build_window(500, 500) .build()?;
Fields
builtins: Builtins
Built-in resources
Implementations
impl Duku
[src]
pub const fn builder() -> DukuBuilder
[src]
Create builder for duku context
pub fn draw_on_window(
&mut self,
camera: Option<&Camera>,
draw_fn: impl Fn(&mut Target)
)
[src]
&mut self,
camera: Option<&Camera>,
draw_fn: impl Fn(&mut Target)
)
Start rendering on the window framebuffer
Note: if camera
is None
a default camera that fits the
framebuffer will be used.
Example
duku.draw_on_window(None, |target| { // record drawing commands });
pub fn draw(
&mut self,
framebuffer: &Handle<Framebuffer>,
camera: Option<&Camera>,
draw_fn: impl Fn(&mut Target)
)
[src]
&mut self,
framebuffer: &Handle<Framebuffer>,
camera: Option<&Camera>,
draw_fn: impl Fn(&mut Target)
)
Start rendering on a specified framebuffer
Note: if camera
is None
a default camera that fits the
framebuffer will be used.
Example
let frame = duku.create_framebuffer(640, 360)?; duku.draw(&frame, None, |target| { // 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_texture_color(
&mut self,
pixels: &[Color],
width: u32,
height: u32
) -> Result<Handle<Texture>>
[src]
&mut self,
pixels: &[Color],
width: u32,
height: u32
) -> Result<Handle<Texture>>
Create a texture from colors
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 combine_meshes(&mut self, meshes: &[Handle<Mesh>]) -> Handle<Mesh>
[src]
Combine multiple meshes into a new one
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_framebuffer(
&mut self,
width: u32,
height: u32
) -> Result<Handle<Framebuffer>>
[src]
&mut self,
width: u32,
height: u32
) -> Result<Handle<Framebuffer>>
Create a framebuffer
pub fn create_framebuffer_for_shader(
&mut self,
shader: &Handle<Shader>,
width: u32,
height: u32
) -> Result<Handle<Framebuffer>>
[src]
&mut self,
shader: &Handle<Shader>,
width: u32,
height: u32
) -> Result<Handle<Framebuffer>>
Create a framebuffer 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
Note: this should be used only if building a 3rd party shader compiler
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
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>,