summaryrefslogtreecommitdiff
path: root/main_simple_scanner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main_simple_scanner.cpp')
-rw-r--r--main_simple_scanner.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/main_simple_scanner.cpp b/main_simple_scanner.cpp
index 99e166c..e6b6bca 100644
--- a/main_simple_scanner.cpp
+++ b/main_simple_scanner.cpp
@@ -21,12 +21,10 @@
// Select the scene to render
//#define SCENE_DIFFUSE
//#define SCENE_REFLECT
-#define SCENE_DIALECT
-
-//#define OVERRIDE_FOV
+//#define SCENE_DIALECT
+#define SCENE_FOV
static constexpr uint64_t default_diffuse_seed = 123456789012345678ULL;
-static constexpr double fov_override = 90*(M_PI/180);
// T: color depth, V: pos
template<typename T, typename V>
@@ -42,13 +40,13 @@ void generate_image(uint16_t image_width, uint16_t image_height, double viewport
double r = 1.0 * image_width / image_height;
hitlist world;
-#ifndef OVERRIDE_FOV
+#ifndef SCENE_FOV
////////////////
// noaa rendering
bias_ctx no_bias{};
basic_viewport<T, V> vp_noaa{
- vec3<V>::zero(), // camera position as the coordinate origin
- vec3d{0, 0, -focal_length},
+ {-2, 2, 1}, // camera position as the coordinate origin
+ {0, 0, -1},
image_width, image_height,
viewport_width / 2.0, ((double) image_height / image_width) * viewport_width / 2.0,
world
@@ -58,22 +56,24 @@ void generate_image(uint16_t image_width, uint16_t image_height, double viewport
////////////////
// aa rendering
aa_viewport<T, V> vp_aa{
- vec3<V>::zero(), // camera position as the coordinate origin
- vec3d{0, 0, -focal_length},
+ {-2, 2, 1}, // camera position as the coordinate origin
+ {0, 0, -1},
image_width, image_height,
viewport_width / 2.0, ((double) image_height / image_width) * viewport_width / 2.0,
world, samples
};
////////////////
#else
+ // This scene needs custom viewport setting
+ const auto fov_h = 2 * asin((double)1.0 / 3.0);
////////////////
// noaa rendering
bias_ctx no_bias{};
basic_viewport<T, V> vp_noaa{
- vec3<V>::zero(), // camera position as the coordinate origin
- vec3d{0, 0, -focal_length},
+ {0, 0, 1}, // camera position as the coordinate origin
+ {0, 0, 0},
image_width, image_height,
- fov_override,
+ fov_h,
world
};
////////////////
@@ -81,15 +81,17 @@ void generate_image(uint16_t image_width, uint16_t image_height, double viewport
////////////////
// aa rendering
aa_viewport<T, V> vp_aa{
- vec3<V>::zero(), // camera position as the coordinate origin
- vec3d{0, 0, -focal_length},
+ {0, 0, 1}, // camera position as the coordinate origin
+ {0, 0, 0},
image_width, image_height,
- fov_override,
+ fov_h,
world, samples
};
////////////////
-#endif
+ material_diffuse_lambertian materi{0.5};
+ world.add_object(std::make_shared<sphere>(vec3d{0, 0, -2}, 1, materi));
+#endif
#ifdef SCENE_DIFFUSE
material_diffuse_lambertian materi{0.5};
world.add_object(std::make_shared<sphere>(