|
raytracer
Parallel Ray Tracer written from scratch (no graphics API).
|
Classes | |
| class | Image |
| struct | Complex |
| struct | Point |
| struct | Vec3 |
Functions | |
| double | diff_images (const Image &img1, const Image &img2, unsigned short downsampling_factor=4) |
| void | reportException (const std::exception &err) noexcept |
| void | reportUnknownException () noexcept |
| NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE (Point, x, y) | |
| bool | set_seed (unsigned new_seed) |
| bool | remove_seed () |
| Vec3 | random_unit () |
| std::mt19937 & | get_generator () |
| std::ostream & | get_nullout () |
| void | clear_current_row (std::ostream &out) |
| void | display_percentage (std::ostream &out, int current, int total, const std::string &qty, int width=20) |
| std::ostream & | operator<< (std::ostream &os, Vec3 const &v) |
| std::byte | doubleToColorByte (const double value, const int channels) |
| void | write_n_bytes (std::vector< std::byte > &vec, const int n, const int data) |
Variables | |
| constexpr unsigned | TEST_SEED = 123 |
| void raytracer::common::clear_current_row | ( | std::ostream & | out | ) |
Writes an ANSI sequence to clear the current row from a terminal display.
| out | The std::ostream to write to. |

| double raytracer::common::diff_images | ( | const Image & | img1, |
| const Image & | img2, | ||
| unsigned short | downsampling_factor = 4 ) |
Computes the average distance between the color vectors of each pixel in two images.
| std::invalid_argument | If the images don't have the same width and height, or if the factor is zero. |
| img1 | The first image. |
| img2 | The second image. |
| downsampling_factor | How many pixels a side of the box has. Four means a 4x4 box filter is applied (colors are averaged over each 4x4 area). |

| void raytracer::common::display_percentage | ( | std::ostream & | out, |
| int | current, | ||
| int | total, | ||
| const std::string & | qty, | ||
| int | width = 20 ) |
Write a progress bar to the terminal.
| out | The std::ostream to write to. |
| current | The number of completed tasks. |
| total | The total amount of tasks to complete. |
| qty | What the percentage is measured for (used as a label). |
| width | The width of the progress bar in characters. |

| std::byte raytracer::common::doubleToColorByte | ( | const double | value, |
| const int | channels ) |

| std::mt19937 & raytracer::common::get_generator | ( | ) |
Returns a reference to the thread-local RNG.

|
inline |
Returns a reference to a std::ostream that does nothing. Used for tests.
| raytracer::common::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE | ( | Point | , |
| x | , | ||
| y | ) |
|
inline |
| Vec3 raytracer::common::random_unit | ( | ) |
Returns a random 3D vector of length 1.


| bool raytracer::common::remove_seed | ( | ) |
Resets the global seed so the generator will use a random device instead, if the seed is not frozen.
|
noexcept |
Logs that an exception occurred.
| err | The exception to log. |

|
noexcept |
Logs that an unknown exception occurred.

| bool raytracer::common::set_seed | ( | unsigned | new_seed | ) |
Sets the global RNG seed to the new value, if it is not frozen.
| new_seed | The new global seed. |
| void raytracer::common::write_n_bytes | ( | std::vector< std::byte > & | vec, |
| const int | n, | ||
| const int | data ) |

|
constexpr |