diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-05-16 21:35:47 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-05-16 21:35:47 +0200 |
| commit | b715df2c21dbb8656fc01d5a64605ac18cb5c6e4 (patch) | |
| tree | cf99f55f9fd4efb647f4c6826648876410f2cfb8 /src/utils.cpp | |
| parent | a7707f730cd28853dc750b72ec882f07dba85406 (diff) | |
Wip BVH + BVH debugging tools
Diffstat (limited to 'src/utils.cpp')
| -rw-r--r-- | src/utils.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/utils.cpp b/src/utils.cpp index 6467563..bbf8ea4 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -106,12 +106,12 @@ uint32_t random_scene(sphere *world) { material material4 = {}; material4.albedo = color{ 0.0, 0.0, 0.0 }; - material4.emissive = color{ 1.0, 1.0, 1.0 } * 100.0; + material4.emissive = color{ 1.0, 1.0, 1.0 } * 100000.0; material4.fuzz = 0.0; material4.type = MATERIAL_TYPE::EMISSIVE; world[world_sphere_index + 3] = { { 2, 1.5, 2 }, material4, 0.5 }; - return world_sphere_index + 3; + return world_sphere_index + 4; } struct input_data create_inputs(uint32_t width, uint32_t height) { @@ -141,6 +141,7 @@ struct input_data create_inputs(uint32_t width, uint32_t height) { .height = height, .sample_index = 0, + .debug_bvh = false, }; // World hittable objects @@ -148,7 +149,13 @@ struct input_data create_inputs(uint32_t width, uint32_t height) { inputs.spheres_count = spheres_count; - inputs.nodes[0] = { inputs.spheres, 0, spheres_count, inputs.nodes, 1 }; + bvh builder; + builder.build(inputs.spheres, spheres_count); + builder.exporter(); + + for (uint32_t idx = 0; idx < builder.nodes.size(); idx++) { + inputs.nodes[idx] = builder.nodes[idx]; + } return inputs; } |
