mirror of
https://github.com/Manoj-HV30/multithreaded-raytracer.git
synced 2026-05-16 19:35:24 +00:00
Add multithreaded ray tracer implementation
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#ifndef RTWEEKEND_H
|
||||
#define RTWEEKEND_H
|
||||
|
||||
#include <cmath>
|
||||
#include <random>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
|
||||
// C++ Std Usings
|
||||
|
||||
using std::make_shared;
|
||||
using std::shared_ptr;
|
||||
|
||||
// Constants
|
||||
|
||||
const double infinity = std::numeric_limits<double>::infinity();
|
||||
const double pi = 3.1415926535897932385;
|
||||
|
||||
// Utility Functions
|
||||
|
||||
inline double degrees_to_radians(double degrees) {
|
||||
return degrees * pi / 180.0;
|
||||
}
|
||||
inline double random_double() {
|
||||
thread_local static std::mt19937 generator(std::random_device{}());
|
||||
thread_local static std::uniform_real_distribution<double> distribution(0.0, 1.0);
|
||||
return distribution(generator);
|
||||
}
|
||||
|
||||
|
||||
inline double random_double(double min, double max) {
|
||||
// Returns a random real in [min,max).
|
||||
return min + (max-min)*random_double();
|
||||
}
|
||||
|
||||
// Common Headers
|
||||
|
||||
#include "color.h"
|
||||
#include "interval.h"
|
||||
#include "ray.h"
|
||||
#include "vec3.h"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user