|
|
|
@ -82,8 +82,9 @@ public record Box(@NotNull AABB box, @NotNull Material material) implements Hitt
|
|
|
|
|
var side = frontFace ? entry : exit;
|
|
|
|
|
var normal = frontFace ? side.normal : side.normal.neg();
|
|
|
|
|
var position = ray.at(t);
|
|
|
|
|
var u = side.getTextureU(box, position);
|
|
|
|
|
var v = side.getTextureV(box, position);
|
|
|
|
|
var uv = material().texture().isUVRequired();
|
|
|
|
|
var u = uv ? side.getTextureU(box, position) : Double.NaN;
|
|
|
|
|
var v = uv ? side.getTextureV(box, position) : Double.NaN;
|
|
|
|
|
return Optional.of(new HitResult(t, position, normal, material, u, v, frontFace));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|