Struct dzahui::simulation::dzahui_window::DzahuiWindowBuilder
source · pub struct DzahuiWindowBuilder {Show 20 fields
geometry_fragment_shader: Option<String>,
geometry_vertex_shader: Option<String>,
text_fragment_shader: Option<String>,
text_vertex_shader: Option<String>,
height_multiplier: Option<f64>,
integration_iteration: Option<usize>,
opengl_version: Option<(u8, u8)>,
initial_time_step: Option<f64>,
window_text_scale: Option<f32>,
mesh_dimension: MeshDimension,
character_set: Option<String>,
vertex_selector: Option<f32>,
time_step: Option<f64>,
camera: CameraBuilder,
height: Option<u32>,
width: Option<u32>,
mesh: MeshBuilder,
solver: Solver,
write_location: Option<String>,
file_prefix: Option<String>,
}
Expand description
General Information
The window builder. When using function builder
in DzahuiWindow without parameters a sensible default is obtained.
Fields
geometry_fragment_shader
- Shader used to render triangulated 3D and 2D meshes. Defaults to assets/geometry_fragment_shader.fsgeometry_vertex_shader
- Shader used to render text. Defaults to assets/geometry_vertex_shader.vstext_fragment_shader
- Shader used to render triangulated 3D and 2D meshes. Defaults to assets/text_fragment_shader.fstext_vertex_shader
- Shader used to render text. Defaults to assets/text_vertex_shader.vsheight_multiplier
- Makes height of mesh bigger. Useful for 1D mesh.integration_iteration
- Amount of elements to sum to approximate integralopengl_version
- opengl version to use. Tested with 3.3, latter versions should work tooinitial_time_step
- When solving a time-dependent problem and not specifiying a time, an initial time should be given while enough information is collected to use frameratewindow_text_scale
- Scale of text in front of window. This text does not change with camera viewmesh_dimension
- Dimension of mesh to build. Used to process certain elements of solutioncharacter_set
- Set of characters to draw on screenvertex_selector
- Angle for the cone that casts mouse coordinates to 3d world and selects verticestime_step
- How much to advance a time-dependent solutioncamera
- A CameraBuilder. Certain properties can be changend via this structure’s methodsheight
- Height of window. Defaults to 600 px.width
- Width of window. Defaults to 800 px.mesh
- A MeshBuilder. Certain properties can be changed via this structre’s methodssolver
- An enum representing the equation to be solvedwrite_location
- Where to write values from solved equation of needed. Will be chosen automatically if Nonefile_prefix
- If writing files require a prefix to identify them. Will be chosen automatically if None
Fields§
§geometry_fragment_shader: Option<String>
§geometry_vertex_shader: Option<String>
§text_fragment_shader: Option<String>
§text_vertex_shader: Option<String>
§height_multiplier: Option<f64>
§integration_iteration: Option<usize>
§opengl_version: Option<(u8, u8)>
§initial_time_step: Option<f64>
§window_text_scale: Option<f32>
§mesh_dimension: MeshDimension
§character_set: Option<String>
§vertex_selector: Option<f32>
§time_step: Option<f64>
§camera: CameraBuilder
§height: Option<u32>
§width: Option<u32>
§mesh: MeshBuilder
§solver: Solver
§write_location: Option<String>
§file_prefix: Option<String>
Implementations§
source§impl DzahuiWindowBuilder
impl DzahuiWindowBuilder
sourcepub fn with_geometry_shader<A, B>(
self,
vertex_shader: A,
fragment_shader: B
) -> Selfwhere
A: AsRef<str>,
B: AsRef<str>,
pub fn with_geometry_shader<A, B>(
self,
vertex_shader: A,
fragment_shader: B
) -> Selfwhere
A: AsRef<str>,
B: AsRef<str>,
Changes geometry shader.
sourcepub fn with_text_shader<A, B>(self, vertex_shader: A, fragment_shader: B) -> Selfwhere
A: AsRef<str>,
B: AsRef<str>,
pub fn with_text_shader<A, B>(self, vertex_shader: A, fragment_shader: B) -> Selfwhere
A: AsRef<str>,
B: AsRef<str>,
Changes text shader.
sourcepub fn enable_height_multiplier(self, height_multiplier: f64) -> Self
pub fn enable_height_multiplier(self, height_multiplier: f64) -> Self
Makes height larger for 1D mesh
sourcepub fn with_height_and_width(self, height: u32, width: u32) -> Self
pub fn with_height_and_width(self, height: u32, width: u32) -> Self
Changes height and width.
sourcepub fn with_opengl_version(self, opengl_version: (u8, u8)) -> Self
pub fn with_opengl_version(self, opengl_version: (u8, u8)) -> Self
Changes opengl version.
sourcepub fn with_vertex_angle(self, angle: f32) -> Self
pub fn with_vertex_angle(self, angle: f32) -> Self
Changes angle to determine selected vertex.
sourcepub fn change_distance_from_camera_to_object(self, radius: f32) -> Self
pub fn change_distance_from_camera_to_object(self, radius: f32) -> Self
Changes distance (radius) to object centered
sourcepub fn camera_with_target(self, x: f32, y: f32, z: f32) -> Self
pub fn camera_with_target(self, x: f32, y: f32, z: f32) -> Self
Changes object being targeted
sourcepub fn with_camera_position(self, theta: f32, phi: f32) -> Self
pub fn with_camera_position(self, theta: f32, phi: f32) -> Self
Changes camera position in a sphere with center camera_target
sourcepub fn with_sensitivity(self, sensitivity: f32) -> Self
pub fn with_sensitivity(self, sensitivity: f32) -> Self
Changes camera movement arround object being targeted
sourcepub fn with_mesh_in_3d(self) -> Self
pub fn with_mesh_in_3d(self) -> Self
Changes mesh dimension to 3D (originally in 2D)
sourcepub fn with_mesh_in_1d(self) -> Self
pub fn with_mesh_in_1d(self) -> Self
Changes mesh dimension to 1D (originally in 2D)
sourcepub fn solve_1d_diffussion(self, params: DiffussionParamsTimeIndependent) -> Self
pub fn solve_1d_diffussion(self, params: DiffussionParamsTimeIndependent) -> Self
Makes diffusion solver simulation
sourcepub fn solve_1d_time_dependent_diffussion(
self,
params: DiffussionParamsTimeDependent
) -> Self
pub fn solve_1d_time_dependent_diffussion(
self,
params: DiffussionParamsTimeDependent
) -> Self
Makes time-dependant diffusion solver simulation
sourcepub fn solve_1d_stokes(self, params: StokesParams1D) -> Self
pub fn solve_1d_stokes(self, params: StokesParams1D) -> Self
Makes Stokes time-independent solver simulation
sourcepub fn solve_static_pressure(self, params: StokesParams1D) -> Self
pub fn solve_static_pressure(self, params: StokesParams1D) -> Self
Makes Stokes time-independent solver simulation with alias StaticPressureSolver
sourcepub fn with_integration_iteration(self, integration_iteration: usize) -> Self
pub fn with_integration_iteration(self, integration_iteration: usize) -> Self
Sets integration iteration
sourcepub fn with_time_step(self, time_step: f64) -> Self
pub fn with_time_step(self, time_step: f64) -> Self
Sets time step for time-dependant solutions
sourcepub fn with_window_text_scale(self, window_text_scale: f32) -> Self
pub fn with_window_text_scale(self, window_text_scale: f32) -> Self
Size of text present on screen. Default is chosen otherwise, which may not be good for every scenario
sourcepub fn with_initial_time_step(self, initial_time_step: f64) -> Self
pub fn with_initial_time_step(self, initial_time_step: f64) -> Self
Initial time step when simulation on real time
sourcepub fn set_file_location<A: AsRef<str>>(self, write_location: A) -> Self
pub fn set_file_location<A: AsRef<str>>(self, write_location: A) -> Self
Set file location. If let None, a predetermined will be chosen later
sourcepub fn set_file_prefix<A: AsRef<str>>(self, file_prefix: A) -> Self
pub fn set_file_prefix<A: AsRef<str>>(self, file_prefix: A) -> Self
Set file prefix. If let None, a predetermined will be chosen later
sourcepub fn build(self) -> DzahuiWindow
pub fn build(self) -> DzahuiWindow
General Information
Builds DzahuiWindow from parameters given or sensible defaults.
Details
First it generates a window builder with title ‘Dzahui’, size according to builder and always resizable. Then an OpenGL version is assigned based on builder. Event loop is generated and, alongside window, made current context. OpenGL functions are made available and viewport for OpenGL is set. Geometry and Text shaders are created. A new instance of Mesh is created for later use. A new camera is created based on mesh (unless overriden). A timer is created. An instance of DzahuiWindow is created.
Parameters
self
- All configuration required is within self. Default shaders are hardcoded in here.