Add multithreaded ray tracer implementation

This commit is contained in:
2026-02-17 01:29:10 +05:30
parent ab057ea279
commit 250403809b
14 changed files with 765 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#ifndef HITTABLE_H
#define HITTABLE_H
#include "ray.h"
class material;
class hit_record {
public:
point3 p;
vec3 normal;
double t;
shared_ptr<material> mat;
bool front_face;
void set_face_normal(const ray& r, const vec3& outward_normal){
// Sets the hit record normal vector.
// NOTE: the parameter `outward_normal` is assumed to have unit length.
front_face = dot(r.direction(), outward_normal) < 0;
normal = front_face ? outward_normal : -outward_normal;
}
};
class hittable {
public:
virtual ~hittable() = default;
virtual bool hit(const ray& r, interval ray_t, hit_record& rec) const = 0;
};
#endif