pub struct Context { /* private fields */ }Expand description
The application context.
Implementations§
source§impl Context
impl Context
sourcepub fn plan_to_close(&self)
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.
sourcepub fn set_min_delta_time(&mut self, delta: f32)
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.
sourcepub fn set_frame_parameters(&self, params: FrameParameters)
pub fn set_frame_parameters(&self, params: FrameParameters)
Sets context’s frame parameters via FrameParameters struct.
sourcepub fn globals_builder(&self) -> GlobalsBuilder<'_>
pub fn globals_builder(&self) -> GlobalsBuilder<'_>
Creates a globals builder.
sourcepub fn lights_builder(&self) -> LightsBuilder<'_>
pub fn lights_builder(&self) -> LightsBuilder<'_>
Creates a lights builder.
sourcepub fn spaces_builder(&self) -> SpacesBuilder<'_>
pub fn spaces_builder(&self) -> SpacesBuilder<'_>
Creates a spaces builder.
sourcepub fn textures_builder(&self) -> TexturesBuilder<'_>
pub fn textures_builder(&self) -> TexturesBuilder<'_>
Creates a textures builder.
sourcepub fn posteffect_builder(&self) -> PostEffectBuilder<'_>
pub fn posteffect_builder(&self) -> PostEffectBuilder<'_>
Creates a post-effect builder.
sourcepub fn create_scheme<S>(&self) -> Scheme<S>where
S: Shader,
pub fn create_scheme<S>(&self) -> Scheme<S>where S: Shader,
Creates a new shader scheme.
sourcepub fn create_layer<S, T>(&self) -> Layer<S, T>where
S: Shader,
T: Topology,
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.
sourcepub fn create_layer_with<S, T>(&self) -> LayerBuilder<'_, S, T>
pub fn create_layer_with<S, T>(&self) -> LayerBuilder<'_, S, T>
Creates a layer builder with custom parameters.
sourcepub fn create_instances(&self, models: &[ModelTransform]) -> Instance
pub fn create_instances(&self, models: &[ModelTransform]) -> Instance
Creates new instances.
sourcepub fn create_instances_color(&self, models: &[ModelColor]) -> InstanceColor
pub fn create_instances_color(&self, models: &[ModelColor]) -> InstanceColor
Creates new color instances.
sourcepub fn create_mesh<V, T>(&self, data: &MeshData<'_, V, T>) -> Mesh<V, T>where
V: Vertex,
T: Topology,
pub fn create_mesh<V, T>(&self, data: &MeshData<'_, V, T>) -> Mesh<V, T>where V: Vertex, T: Topology,
Creates a new mesh.
sourcepub fn create_texture(&self, data: TextureData<'_>) -> Texture
pub fn create_texture(&self, data: TextureData<'_>) -> Texture
Creates a new texture.