snoopy/include/hit_record.h

24 lines
534 B
C++

#pragma once
#include <cmath>
#include <cstdlib>
#include <limits>
#include <memory>
class material;
struct hit_record
{
point3 p;
vec3 normal;
std::shared_ptr<material> mat_ptr;
double t;
bool front_face;
inline void set_face_normal(const ray& r, const vec3& outward_normal)
{
front_face = dot(r.direction(), outward_normal) < 0;
normal = front_face ? outward_normal : -outward_normal;
}
};