|
|
|
@ -246,50 +246,43 @@ pub fn render_test(
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// let mut imgui_context = &mut imgui_context.lock().unwrap().context;
|
|
|
|
|
// let mut imgui_platform = &mut imgui_platform.lock().unwrap().platform;
|
|
|
|
|
//
|
|
|
|
|
// //imgui_state.context.io_mut().update_delta_time(Duration::new(0,160));
|
|
|
|
|
// imgui_platform
|
|
|
|
|
// .prepare_frame(imgui_context.io_mut(), &winit_window)
|
|
|
|
|
// .expect("Failed to prepare frame");
|
|
|
|
|
//
|
|
|
|
|
// // get the frame and build a ui window
|
|
|
|
|
// let ui = imgui_context.frame();
|
|
|
|
|
// let window = imgui::Window::new(im_str!("Hello too"));
|
|
|
|
|
// window
|
|
|
|
|
// .size([400.0, 200.0], Condition::FirstUseEver)
|
|
|
|
|
// .position([400.0, 200.0], Condition::FirstUseEver)
|
|
|
|
|
// .build(&ui, || {
|
|
|
|
|
// ui.text(im_str!("Frametime: {:?}", 10.0));
|
|
|
|
|
// });
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// //ui.show_demo_window(&mut demo_open);
|
|
|
|
|
// imgui_platform.prepare_render(&ui, &winit_window);
|
|
|
|
|
//
|
|
|
|
|
// let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
|
|
|
|
// label: None,
|
|
|
|
|
// color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
|
|
|
|
// attachment: &frame.output.view,
|
|
|
|
|
// resolve_target: None,
|
|
|
|
|
// ops: wgpu::Operations {
|
|
|
|
|
// load: wgpu::LoadOp::Clear(wgpu::Color {
|
|
|
|
|
// r: 0.1,
|
|
|
|
|
// g: 0.2,
|
|
|
|
|
// b: 0.3,
|
|
|
|
|
// a: 1.0,
|
|
|
|
|
// }),
|
|
|
|
|
// store: true,
|
|
|
|
|
// },
|
|
|
|
|
// }],
|
|
|
|
|
// depth_stencil_attachment: None,
|
|
|
|
|
// });
|
|
|
|
|
// renderer.imgui_renderer
|
|
|
|
|
// .render(ui.render(), &renderer.queue, &renderer.device, &mut rpass)
|
|
|
|
|
// .expect("Rendering failed");
|
|
|
|
|
//
|
|
|
|
|
let mut imgui_context = &mut imgui_context.lock().unwrap().context;
|
|
|
|
|
let mut imgui_platform = &mut imgui_platform.lock().unwrap().platform;
|
|
|
|
|
|
|
|
|
|
//imgui_state.context.io_mut().update_delta_time(Duration::new(0,160));
|
|
|
|
|
imgui_platform
|
|
|
|
|
.prepare_frame(imgui_context.io_mut(), &winit_window)
|
|
|
|
|
.expect("Failed to prepare frame");
|
|
|
|
|
|
|
|
|
|
// get the frame and build a ui window
|
|
|
|
|
let ui = imgui_context.frame();
|
|
|
|
|
let window = imgui::Window::new(im_str!("Hello too"));
|
|
|
|
|
window
|
|
|
|
|
.size([400.0, 100.0], Condition::FirstUseEver)
|
|
|
|
|
.position([50.0, 50.0], Condition::FirstUseEver)
|
|
|
|
|
.build(&ui, || {
|
|
|
|
|
ui.text(im_str!("Frametime: {:?}", 10.0));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ui.show_demo_window(&mut demo_open);
|
|
|
|
|
imgui_platform.prepare_render(&ui, &winit_window);
|
|
|
|
|
|
|
|
|
|
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
|
|
|
|
label: None,
|
|
|
|
|
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
|
|
|
|
attachment: &frame.output.view,
|
|
|
|
|
resolve_target: None,
|
|
|
|
|
ops: wgpu::Operations {
|
|
|
|
|
load: wgpu::LoadOp::Load,
|
|
|
|
|
store: true,
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
depth_stencil_attachment: None,
|
|
|
|
|
});
|
|
|
|
|
renderer.imgui_renderer
|
|
|
|
|
.render(ui.render(), &renderer.queue, &renderer.device, &mut rpass)
|
|
|
|
|
.expect("Rendering failed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|