|
|
@ -55,7 +55,7 @@ public record AABB(@NotNull Vec3 min, @NotNull Vec3 max) {
|
|
|
|
return new AABB(Vec3.min(this.min, box.min), Vec3.max(this.max, box.max));
|
|
|
|
return new AABB(Vec3.min(this.min, box.min), Vec3.max(this.max, box.max));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hit(@NotNull Ray ray) {
|
|
|
|
public boolean hit(@NotNull Ray ray, @NotNull Range range) {
|
|
|
|
var origin = ray.origin();
|
|
|
|
var origin = ray.origin();
|
|
|
|
var direction = ray.direction();
|
|
|
|
var direction = ray.direction();
|
|
|
|
var invDirection = direction.inv();
|
|
|
|
var invDirection = direction.inv();
|
|
|
@ -82,7 +82,7 @@ public record AABB(@NotNull Vec3 min, @NotNull Vec3 max) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tlmax < tumin;
|
|
|
|
return tlmax < tumin && tumin >= range.min() && tlmax <= range.max();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static double @NotNull[] intersect(@NotNull Vec3 corner, @NotNull Vec3 origin, @NotNull Vec3 invDirection) {
|
|
|
|
public static double @NotNull[] intersect(@NotNull Vec3 corner, @NotNull Vec3 origin, @NotNull Vec3 invDirection) {
|
|
|
|