diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-08-27 12:14:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-09-09 13:41:04 +0900 |
| commit | 88715e4b6eb27f6e99333c3fa6aa4c39c5af9306 (patch) | |
| tree | 2e440060d277fa897b6dfd6219d14c32a9f7995e /src/main.zig | |
| parent | 2a31861d7ce865e7b01d524461322b0fa1912ffb (diff) | |
| download | RayTracingInOneWeekend.zig-88715e4b6eb27f6e99333c3fa6aa4c39c5af9306.tar.gz RayTracingInOneWeekend.zig-88715e4b6eb27f6e99333c3fa6aa4c39c5af9306.tar.zst RayTracingInOneWeekend.zig-88715e4b6eb27f6e99333c3fa6aa4c39c5af9306.zip | |
8.2
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig index 75f3161..7ffd9b7 100644 --- a/src/main.zig +++ b/src/main.zig @@ -295,8 +295,18 @@ fn generateCornellBox(allocator: anytype) !Hittable { try hittable_objects.append(.{ .xzRect = .{ .x0 = 0, .x1 = 555, .z0 = 0, .z1 = 555, .k = 555, .material = white.clone() } }); try hittable_objects.append(.{ .xyRect = .{ .x0 = 0, .x1 = 555, .y0 = 0, .y1 = 555, .k = 555, .material = white.clone() } }); - try hittable_objects.append(try Hittable.makeBox(.{ .x = 130, .y = 0, .z = 65 }, .{ .x = 295, .y = 165, .z = 230 }, white.clone(), allocator)); - try hittable_objects.append(try Hittable.makeBox(.{ .x = 265, .y = 0, .z = 295 }, .{ .x = 430, .y = 330, .z = 460 }, white.clone(), allocator)); + var box1 = try Rc(Hittable).init(allocator); + var box1r = try Rc(Hittable).init(allocator); + var box2 = try Rc(Hittable).init(allocator); + 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 })); + + 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 })); return .{ .list = .{ .objects = hittable_objects } }; } |
