Struct dunge::Context

source ·
pub struct Context { /* private fields */ }
Expand description

The application context.

Implementations§

source§

impl Context

source

pub fn window(&self) -> &Window

Returns the window.

source

pub fn info(&self) -> &Info

Returns the render info.

source

pub fn fps(&self) -> u32

Returns the number of rendered frames per second.

source

pub fn plan_to_close(&self)

Plans the main loop to close.

Calling this function dosn’t guarantee closing. It triggers the close_requested function in the Loop, which can handle the closing event.

source

pub fn size(&self) -> (u32, u32)

Returns the canvas size.

source

pub fn set_min_delta_time(&mut self, delta: f32)

Sets a minimal time between two frames in seconds.

The context will draw the next frame no earlier than the specified time.

source

pub fn set_frame_parameters(&self, params: FrameParameters)

Sets context’s frame parameters via FrameParameters struct.

source

pub fn globals_builder(&self) -> GlobalsBuilder<'_>

Creates a globals builder.

source

pub fn lights_builder(&self) -> LightsBuilder<'_>

Creates a lights builder.

source

pub fn spaces_builder(&self) -> SpacesBuilder<'_>

Creates a spaces builder.

source

pub fn textures_builder(&self) -> TexturesBuilder<'_>

Creates a textures builder.

source

pub fn posteffect_builder(&self) -> PostEffectBuilder<'_>

Creates a post-effect builder.

source

pub fn create_scheme<S>(&self) -> Scheme<S>where S: Shader,

Creates a new shader scheme.

source

pub fn create_layer<S, T>(&self) -> Layer<S, T>where S: Shader, T: Topology,

Creates a new layer with default parameters.

This is a shortcut for context.create_layer_with().build(scheme) with an automatically generated shader scheme. Use the create_layer_with function to create a custom layer.

source

pub fn create_layer_with<S, T>(&self) -> LayerBuilder<'_, S, T>

Creates a layer builder with custom parameters.

source

pub fn create_instances(&self, models: &[ModelTransform]) -> Instance

Creates new instances.

source

pub fn create_instances_color(&self, models: &[ModelColor]) -> InstanceColor

Creates new color instances.

source

pub fn create_mesh<V, T>(&self, data: &MeshData<'_, V, T>) -> Mesh<V, T>where V: Vertex, T: Topology,

Creates a new mesh.

source

pub fn create_texture(&self, data: TextureData<'_>) -> Texture

Creates a new texture.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for Twhere T: Send,

§

impl<T> WasmNotSync for Twhere T: Sync,