aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/rtw/hit_record.zig
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2022-12-07 22:37:14 +0900
committernsfisis <nsfisis@gmail.com>2022-12-07 22:54:47 +0900
commit86914985b77ddf5d6d3a3dd6c13deed9d906a471 (patch)
treea523883d6524d55aee713bfd6400f044f8715d52 /src/rtw/hit_record.zig
parente264078ed9d94b5091a6d78f8128496ac49fbde4 (diff)
downloadRayTracingInOneWeekend.zig-86914985b77ddf5d6d3a3dd6c13deed9d906a471.tar.gz
RayTracingInOneWeekend.zig-86914985b77ddf5d6d3a3dd6c13deed9d906a471.tar.zst
RayTracingInOneWeekend.zig-86914985b77ddf5d6d3a3dd6c13deed9d906a471.zip
refactor: separate single main.zig
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,
+};