aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2021-01-16 22:56:25 +0100
committerladevieq <ladevie.quentin@gmail.com>2021-01-16 22:56:25 +0100
commit1a0aba5a41c7af5715a4b6d1405af12944a55c87 (patch)
treed6129931c004e68f7b7f18e47ae972e600e0a433 /src/main.cpp
parent2a0326f893e0bd6874fdc3a938a9bdb2c6b4cc8f (diff)
Rendering loop
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 08004d9..0a357f8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -107,11 +107,8 @@ int main() {
const uint32_t width = 400;
const uint32_t height = width / aspect_ratio;
- window wnd { width , height };
- vkrenderer renderer { wnd };
-
- const uint32_t samples_per_pixel = 25;
- const uint32_t max_depth = 25;
+ const uint32_t samples_per_pixel = 1;
+ const uint32_t max_depth = 50;
const vec3 camera_position{ 13.0, 2.0, 3.0 };
const vec3 camera_target{ 0.0, 0.0, 0.0 };
@@ -152,22 +149,24 @@ int main() {
// World hittable objects
random_scene(inputs.spheres);
- // To start a frame capture, call StartFrameCapture.
- // You can specify NULL, NULL for the device to capture on if you have only one device and
- // either no windows at all or only one window, and it will capture from that device.
- // See the documentation below for a longer explanation
- if(rdoc_api) rdoc_api->StartFrameCapture(NULL, NULL);
+ window wnd { width , height };
+ vkrenderer renderer { wnd, inputs };
- auto start = std::chrono::high_resolution_clock::now();
- renderer.compute(inputs, width, height);
- auto end = std::chrono::high_resolution_clock::now();
+ while(wnd.isOpen) {
+ // To start a frame capture, call StartFrameCapture.
+ // You can specify NULL, NULL for the device to capture on if you have only one device and
+ // either no windows at all or only one window, and it will capture from that device.
+ // See the documentation below for a longer explanation
+ if(rdoc_api) rdoc_api->StartFrameCapture(NULL, NULL);
- std::cerr << "Image generation took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl;
+ auto start = std::chrono::high_resolution_clock::now();
+ renderer.compute(width, height);
+ auto end = std::chrono::high_resolution_clock::now();
- // stop the capture
- if(rdoc_api) rdoc_api->EndFrameCapture(NULL, NULL);
+ std::cerr << "Image generation took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl;
- while(wnd.isOpen) {
+ // stop the capture
+ if(rdoc_api) rdoc_api->EndFrameCapture(NULL, NULL);
}
//-------------------------