tangled
alpha
login
or
join now
altagos.dev
/
rayray
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
rename
altagos.dev
2 years ago
f81139a6
751b3fa6
+18
-8
7 changed files
expand all
collapse all
unified
split
src
camera.zig
hittable
sphere.zig
hittable.zig
interval.zig
material.zig
rayray.zig
tracer.zig
+1
-1
src/camera.zig
···
5
5
const color = zigimg.color;
6
6
const zm = @import("zmath");
7
7
8
8
-
pub const Ray = @import("ray.zig");
8
8
+
pub const Ray = @import("Ray.zig");
9
9
const util = @import("util.zig");
10
10
11
11
const log = std.log.scoped(.camera);
+2
-2
src/hittable.zig
···
4
4
5
5
const IntervalF32 = @import("interval.zig").IntervalF32;
6
6
const Material = @import("material.zig").Material;
7
7
-
const Ray = @import("ray.zig");
7
7
+
const Ray = @import("Ray.zig");
8
8
9
9
// Hittable Objects
10
10
-
pub const Sphere = @import("hittable/sphere.zig");
10
10
+
pub const Sphere = @import("hittable/Sphere.zig");
11
11
12
12
pub const HitRecord = struct {
13
13
p: zm.Vec,
+1
-1
src/hittable/sphere.zig
···
1
1
const zm = @import("zmath");
2
2
3
3
const IntervalF32 = @import("../interval.zig").IntervalF32;
4
4
-
const Ray = @import("../ray.zig");
4
4
+
const Ray = @import("../Ray.zig");
5
5
const HitRecord = @import("../hittable.zig").HitRecord;
6
6
const Material = @import("../material.zig").Material;
7
7
+10
src/interval.zig
···
96
96
return x;
97
97
}
98
98
99
99
+
pub fn expand(self: *const Self, delta: T) Interval {
100
100
+
const padding = delta / 2;
101
101
+
return .{ .min = self.min - padding, .max = self.max + padding };
102
102
+
}
103
103
+
99
104
pub fn iter(self: *const Self) Iterator {
100
105
return Iterator{
101
106
.interval = self.*,
···
131
136
if (x < self.min) return self.min;
132
137
if (x > self.max) return self.max;
133
138
return x;
139
139
+
}
140
140
+
141
141
+
pub fn expand(self: *const Self, delta: T) Interval {
142
142
+
const padding = delta / 2;
143
143
+
return .{ .min = self.min - padding, .max = self.max + padding };
134
144
}
135
145
};
136
146
}
+1
-1
src/material.zig
···
3
3
const zm = @import("zmath");
4
4
5
5
const hittable = @import("hittable.zig");
6
6
-
const Ray = @import("ray.zig");
6
6
+
const Ray = @import("Ray.zig");
7
7
const util = @import("util.zig");
8
8
9
9
pub const Material = union(enum) {
+1
-1
src/rayray.zig
···
4
4
const zigimg = @import("zigimg");
5
5
const color = zigimg.color;
6
6
7
7
-
pub const Camera = @import("camera.zig");
7
7
+
pub const Camera = @import("Camera.zig");
8
8
pub const hittable = @import("hittable.zig");
9
9
const IntervalUsize = @import("interval.zig").IntervalUsize;
10
10
pub const material = @import("material.zig");
+2
-2
src/tracer.zig
···
4
4
const zigimg = @import("zigimg");
5
5
const zm = @import("zmath");
6
6
7
7
-
const Camera = @import("camera.zig");
7
7
+
const Camera = @import("Camera.zig");
8
8
const hittable = @import("hittable.zig");
9
9
const material = @import("material.zig");
10
10
-
const Ray = @import("ray.zig");
10
10
+
const Ray = @import("Ray.zig");
11
11
const util = @import("util.zig");
12
12
13
13
const interval = @import("interval.zig");