RayTracing / gpu-tracing

Ray tracing on GPU systems
https://raytracing.github.io/gpu-tracing
Creative Commons Attribution 4.0 International
100 stars 6 forks source link

Listing 5 is very different to previous listings #14

Closed trevordblack closed 2 months ago

trevordblack commented 2 months ago

it goes from

 Event::WindowEvent { event, .. } => match event {
                WindowEvent::CloseRequested => control_handle.exit(),
                WindowEvent::RedrawRequested => {

to

    event_loop.run(move |event, _, control_flow| {
        *control_flow = ControlFlow::Poll;
        match event {
            Event::WindowEvent { event, .. } => match event {
                WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
                _ => (),
            },
            Event::RedrawRequested(_) => {
                // Wait for the next available frame buffer.
                let frame: wgpu::SurfaceTexture = surface
                    .get_current_texture()
                    .expect("failed to get current texture");

                // TODO: draw frame

                frame.present();
            }
            Event::MainEventsCleared => {
                // draw repeatedly
                window.request_redraw();
            }
            _ => (),
        }
trevordblack commented 2 months ago

These changes to the event code need to be highlighted

trevordblack commented 2 months ago

Actually, the complete code has the simpler WindowEvent code, so it's likely that listing 5 is just a mistake