aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.cpp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2021-06-19 17:54:16 +0200
committerladevieq <ladevie.quentin@gmail.com>2021-06-19 17:55:13 +0200
commitdf7dc0f1069e6ed8ea24c152eb4c3a5a97e80b91 (patch)
tree14cdd713b35911fbec90307c5ad08a89682f7dbb /src/utils.cpp
parent9f71d88c35c04685c9d482588befad34759e0b7a (diff)
Split on the largest axis on BVH generation
Diffstat (limited to 'src/utils.cpp')
-rw-r--r--src/utils.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/utils.cpp b/src/utils.cpp
index 6db101c..a754b1d 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -59,34 +59,34 @@ uint32_t random_scene(sphere *world) {
uint32_t world_sphere_index = 1;
int32_t spheres_count = 11;
- // for (int a = -spheres_count; a < spheres_count; a++) {
- // for (int b = -spheres_count; b < spheres_count; b++) {
- // auto choose_mat = randd();
- // point3 center(a + 0.9 * randd(), 0.2, b + 0.9 * randd());
+ for (int a = -spheres_count; a < spheres_count; a++) {
+ for (int b = -spheres_count; b < spheres_count; b++) {
+ auto choose_mat = randd();
+ point3 center(a + 0.9 * randd(), 0.2, b + 0.9 * randd());
- // if ((center - point3{ 4, 0.2, 0 }).length() > 0.9) {
- // material sphere_material = {};
+ if ((center - point3{ 4, 0.2, 0 }).length() > 0.9) {
+ material sphere_material = {};
- // if (choose_mat < 0.8) {
- // // diffuse
- // sphere_material.albedo = color::random() * color::random();
- // sphere_material.type = MATERIAL_TYPE::LAMBERTIAN;
- // } else if (choose_mat < 0.95) {
- // // metal
- // sphere_material.albedo = color::random(0.5, 1);
- // sphere_material.fuzz = randd(0, 0.5);
- // sphere_material.type = MATERIAL_TYPE::METAL;
- // } else {
- // // glass
- // sphere_material.ior = 1.5;
- // sphere_material.type = MATERIAL_TYPE::DIELECTRIC;
- // }
+ if (choose_mat < 0.8) {
+ // diffuse
+ sphere_material.albedo = color::random() * color::random();
+ sphere_material.type = MATERIAL_TYPE::LAMBERTIAN;
+ } else if (choose_mat < 0.95) {
+ // metal
+ sphere_material.albedo = color::random(0.5, 1);
+ sphere_material.fuzz = randd(0, 0.5);
+ sphere_material.type = MATERIAL_TYPE::METAL;
+ } else {
+ // glass
+ sphere_material.ior = 1.5;
+ sphere_material.type = MATERIAL_TYPE::DIELECTRIC;
+ }
- // world[world_sphere_index] = { center, sphere_material, 0.2 };
- // world_sphere_index++;
- // }
- // }
- // }
+ world[world_sphere_index] = { center, sphere_material, 0.2 };
+ world_sphere_index++;
+ }
+ }
+ }
material material1 = {};
material1.ior = 1.5;