aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/rtw/hit_record.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtw/hit_record.zig')
-rw-r--r--src/rtw/hit_record.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rtw/hit_record.zig b/src/rtw/hit_record.zig
new file mode 100644
index 0000000..f71904e
--- /dev/null
+++ b/src/rtw/hit_record.zig
@@ -0,0 +1,21 @@
+const vec = @import("vec.zig");
+const material = @import("material.zig");
+const Vec3 = vec.Vec3;
+const Point3 = vec.Point3;
+const Material = material.Material;
+
+pub const HitRecord = struct {
+ // The point where the ray and the hittable hits.
+ p: Point3,
+ // The normal of the hittable at p.
+ normal: Vec3,
+ // The material at p.
+ material: *const Material,
+ // p = ray.at(t)
+ t: f64,
+ // The coordinate of the surface where the ray intersects.
+ u: f64,
+ v: f64,
+ // True if the ray hits the hittable from the front face, i.e., outside of it.
+ front_face: bool,
+};