window size stretching fix
This commit is contained in:
@@ -92,7 +92,7 @@ fn main() {
|
||||
|
||||
let line_count = 30;
|
||||
vulkan::init(
|
||||
vec!["models/box.obj", "models/iski51.obj"],
|
||||
vec!["models/box.obj"],
|
||||
(-line_count..=line_count)
|
||||
.flat_map(|it| vec![
|
||||
LinePoint { position: [it as f32, -line_count as f32, 0.] },
|
||||
|
||||
@@ -277,14 +277,14 @@ pub fn init(mesh_paths: Vec<&str>, line_vertices: Vec<LinePoint>, game: &mut dyn
|
||||
previous_frame_end.cleanup_finished();
|
||||
|
||||
if recreate_swapchain {
|
||||
let dimensions = if let Some(dimensions) = window.get_inner_size() {
|
||||
data.dimensions = if let Some(dimensions) = window.get_inner_size() {
|
||||
let dimensions: (u32, u32) = dimensions.to_physical(window.get_hidpi_factor()).into();
|
||||
[dimensions.0, dimensions.1]
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
|
||||
let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(dimensions) {
|
||||
let (new_swapchain, new_images) = match swapchain.recreate_with_dimension(data.dimensions) {
|
||||
Ok(r) => r,
|
||||
// This error tends to happen when the user is manually resizing the window.
|
||||
// Simply restarting the loop is the easiest way to fix this issue.
|
||||
@@ -296,7 +296,6 @@ pub fn init(mesh_paths: Vec<&str>, line_vertices: Vec<LinePoint>, game: &mut dyn
|
||||
// Because framebuffers contains an Arc on the old swapchain, we need to
|
||||
// recreate framebuffers as well.
|
||||
framebuffers = window_size_dependent_setup(device.clone(), &new_images, render_pass.clone(), &mut dynamic_state);
|
||||
data.dimensions = images[0].dimensions();
|
||||
|
||||
recreate_swapchain = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user