aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-04-20 19:22:50 +0900
committernsfisis <nsfisis@gmail.com>2025-04-20 19:22:50 +0900
commitc64077509a2a5e7af8816653e4ea22c4bbeeaff2 (patch)
tree14d7ae5fd968bd5cf8f804ff74a2e8660ee51eb4 /src
parent42f06f1841d70a97bad48084cc3360209589196f (diff)
downloadRayTracingInOneWeekend.zig-c64077509a2a5e7af8816653e4ea22c4bbeeaff2.tar.gz
RayTracingInOneWeekend.zig-c64077509a2a5e7af8816653e4ea22c4bbeeaff2.tar.zst
RayTracingInOneWeekend.zig-c64077509a2a5e7af8816653e4ea22c4bbeeaff2.zip
feat: update zig to 0.14.0
Diffstat (limited to 'src')
-rw-r--r--src/main.zig10
-rw-r--r--src/rtw/hittable.zig8
-rw-r--r--src/rtw/rand.zig2
3 files changed, 10 insertions, 10 deletions
diff --git a/src/main.zig b/src/main.zig
index d6b1131..2dd208a 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -301,12 +301,12 @@ fn generateCornellBox(allocator: anytype) !Hittable {
var box2r = try Rc(Hittable).init(allocator);
box1.get_mut().* = try Hittable.makeBox(.{ .x = 0, .y = 0, .z = 0 }, .{ .x = 165, .y = 330, .z = 165 }, white.clone(), allocator);
- box1r.get_mut().* = Hittable.rotateY(box1, deg2rad(15));
- try hittable_objects.append(Hittable.translate(box1r, .{ .x = 265, .y = 0, .z = 295 }));
+ box1r.get_mut().* = Hittable.makeRotateY(box1, deg2rad(15));
+ try hittable_objects.append(Hittable.makeTranslate(box1r, .{ .x = 265, .y = 0, .z = 295 }));
box2.get_mut().* = try Hittable.makeBox(.{ .x = 0, .y = 0, .z = 0 }, .{ .x = 165, .y = 165, .z = 165 }, white.clone(), allocator);
- box2r.get_mut().* = Hittable.rotateY(box2, deg2rad(-18));
- try hittable_objects.append(Hittable.translate(box2r, .{ .x = 130, .y = 0, .z = 65 }));
+ box2r.get_mut().* = Hittable.makeRotateY(box2, deg2rad(-18));
+ try hittable_objects.append(Hittable.makeTranslate(box2r, .{ .x = 130, .y = 0, .z = 65 }));
return .{ .list = .{ .objects = hittable_objects } };
}
@@ -316,7 +316,7 @@ pub fn main() !void {
const allocator = gpa.allocator();
defer debug.assert(gpa.deinit() == .ok);
- var rng_ = std.rand.DefaultPrng.init(42);
+ var rng_ = std.Random.DefaultPrng.init(42);
const rng = rng_.random();
// Image
diff --git a/src/rtw/hittable.zig b/src/rtw/hittable.zig
index c47d9ff..3816b4a 100644
--- a/src/rtw/hittable.zig
+++ b/src/rtw/hittable.zig
@@ -54,11 +54,11 @@ pub const Hittable = union(HittableTag) {
return .{ .box = try Box.init(p0, p1, material, allocator) };
}
- pub fn translate(obj: Rc(Self), offset: Vec3) Self {
+ pub fn makeTranslate(obj: Rc(Self), offset: Vec3) Self {
return .{ .translate = .{ .object = obj, .offset = offset } };
}
- pub fn rotateY(obj: Rc(Self), angle: f64) Self {
+ pub fn makeRotateY(obj: Rc(Self), angle: f64) Self {
return .{ .rotateY = RotateY.init(obj, angle) };
}
@@ -225,11 +225,11 @@ const MovingSphere = struct {
const o0 = sphere.center(time0);
const o1 = sphere.center(time1);
const r = sphere.radius;
- const box0 = .{
+ const box0: Aabb = .{
.min = o0.sub(.{ .x = r, .y = r, .z = r }),
.max = o0.add(.{ .x = r, .y = r, .z = r }),
};
- const box1 = .{
+ const box1: Aabb = .{
.min = o1.sub(.{ .x = r, .y = r, .z = r }),
.max = o1.add(.{ .x = r, .y = r, .z = r }),
};
diff --git a/src/rtw/rand.zig b/src/rtw/rand.zig
index 47a8d61..dcc2aa1 100644
--- a/src/rtw/rand.zig
+++ b/src/rtw/rand.zig
@@ -2,7 +2,7 @@ const std = @import("std");
const Vec3 = @import("vec.zig").Vec3;
-pub const Random = std.rand.Random;
+pub const Random = std.Random;
// [min, max)
pub fn randomInt(comptime T: type, rand: Random, min: T, max: T) T {