Struct dzahui::simulation::dzahui_window::DzahuiWindow
source · pub struct DzahuiWindow {Show 19 fields
context: ContextWrapper<PossiblyCurrent, Window>,
pub(crate) geometry_shader: Shader,
event_loop: Option<EventLoop<()>>,
mouse_coordinates: Point2<f32>,
initial_time_step: Option<f64>,
character_set: CharacterSet,
integration_iteration: usize,
pub(crate) height: u32,
pub(crate) width: u32,
vertex_selector: Cone,
text_shader: Shader,
window_text_scale: f32,
pub timer: Instant,
camera: Camera,
solver: Solver,
time_step: f64,
mesh: Mesh,
write_location: String,
file_prefix: String,
}
Expand description
General Information
DzahuiWindow holds every important component to create an instancec of a simulator. Only one instance should be active at once.
Fields
context
- Holds an instance of OpenGL. This normally means that all configuration associated with rendering is stored here. Only one context is allowedgeometry_shader
- Geometry_shaders to compile and use. Responsible for mesh drawingevent_loop
- To obtain user input in window and refresh windowmouse_coordinates
- Current coordinates of mouseinitial_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 frameratecharacter_set
- Set of characters to draw on screenintegration_iteration
- Amount of terms to approximate integralheight
- Height of window createdwidth
- Width of window createdvertex_selector
- A cone to interact with the screen using the mousetext_shader
- Text shaders to compile and use. Responsible for text renderingwindow_text_scale
- Scale of text in front of window. This text does not change with camera viewtimer
- Gives current time since creation of window. Call withtimer.elapsed()
camera
- Camera configuration creates view and projetion matrices, which directly tells OpenGL what to and not to rendersolver
- Solver enum representing the kind of equation to simmulatetime_step
- How much to forward a time-dependent solutionmesh
- A mesh to draw to screen. Represents an object tessellated into triangles/traingular prismswrite_location
- Where to write values from solved equation of neededfile_prefix
- If writing files require a prefix to identify them
Fields§
§context: ContextWrapper<PossiblyCurrent, Window>
§geometry_shader: Shader
§event_loop: Option<EventLoop<()>>
§mouse_coordinates: Point2<f32>
§initial_time_step: Option<f64>
§character_set: CharacterSet
§integration_iteration: usize
§height: u32
§width: u32
§vertex_selector: Cone
§text_shader: Shader
§window_text_scale: f32
§timer: Instant
§camera: Camera
§solver: Solver
§time_step: f64
§mesh: Mesh
§write_location: String
§file_prefix: String
Implementations§
source§impl DzahuiWindow
impl DzahuiWindow
sourcepub fn builder<F>(location: F) -> DzahuiWindowBuilderwhere
F: AsRef<str>,
pub fn builder<F>(location: F) -> DzahuiWindowBuilderwhere
F: AsRef<str>,
Creates a new default builder.
sourcepub fn restart_timer(&mut self)
pub fn restart_timer(&mut self)
To restart timer of window in case is needed.
sourcepub fn update_mouse_coordinates(&mut self, x: f32, y: f32)
pub fn update_mouse_coordinates(&mut self, x: f32, y: f32)
Callback to change mouse coordinates.
sourcefn activate_view_change(&mut self, state: ElementState)
fn activate_view_change(&mut self, state: ElementState)
Callback that changes wether camera can be edited by user input or not.
sourcefn get_selected_vertex(&mut self) -> Result<(), Error>
fn get_selected_vertex(&mut self) -> Result<(), Error>
Callback to obtain vertex intersection with click produced cone.
sourcefn change_camera_view(&mut self, x: f32, y: f32)
fn change_camera_view(&mut self, x: f32, y: f32)
Callback to change camera view matrix based on user motion.
sourcefn resize_window(&mut self, new_size: PhysicalSize<u32>)
fn resize_window(&mut self, new_size: PhysicalSize<u32>)
Callback to resize window.
sourcefn send_vertex_info(&self, info: Vec<f64>, sender: &SyncSender<Vec<f64>>)
fn send_vertex_info(&self, info: Vec<f64>, sender: &SyncSender<Vec<f64>>)
Send information of vertices to be written
sourcepub fn run(self)
pub fn run(self)
General Information
Run window with a mesh and an event loop. Consumes every object. Generates actual solver based on solver enum. Sets mesh and text.
Parameters
mut self
- A window instance.