const Point3 = @import("vec3.zig").Point3; const Vec3 = @import("vec3.zig").Vec3; const Ray = @import("ray.zig").Ray; pub const HitRecord = struct { p: Point3, normal: Vec3, t: f32, front_face: bool, pub fn setFaceNormal(hit: *HitRecord, ray: Ray, outward_normal: Vec3) void { const front_face = Vec3.dot(ray.direction, outward_normal) < 0; hit.*.front_face = front_face; if (front_face) { hit.*.normal = outward_normal; } else { const origin = Vec3{}; hit.*.normal = origin.sub(outward_normal); } } };