|
|
@ -1,11 +1,25 @@
|
|
|
|
package eu.jonahbauer.raytracing.scene;
|
|
|
|
package eu.jonahbauer.raytracing.scene;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import eu.jonahbauer.raytracing.math.Range;
|
|
|
|
|
|
|
|
import eu.jonahbauer.raytracing.math.Ray;
|
|
|
|
import eu.jonahbauer.raytracing.math.Vec3;
|
|
|
|
import eu.jonahbauer.raytracing.math.Vec3;
|
|
|
|
import eu.jonahbauer.raytracing.render.material.Material;
|
|
|
|
import eu.jonahbauer.raytracing.render.material.Material;
|
|
|
|
|
|
|
|
import eu.jonahbauer.raytracing.render.texture.Texture;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The result of a {@linkplain Hittable#hit(Ray, Range) hit}.
|
|
|
|
|
|
|
|
* @param t the {@code t} value at which the hit occurs
|
|
|
|
|
|
|
|
* @param position the position of the hit
|
|
|
|
|
|
|
|
* @param normal the surface normal at the hit position
|
|
|
|
|
|
|
|
* @param target the hit target (for debug purposes only)
|
|
|
|
|
|
|
|
* @param material the material of the surface
|
|
|
|
|
|
|
|
* @param u the texture u coordinate (or {@code Double.NaN} if the {@linkplain Material#texture() material's texture} does {@linkplain Texture#isUVRequired() not depend} on the uv-coordinates)
|
|
|
|
|
|
|
|
* @param v the texture v coordinate (or {@code Double.NaN} if the {@linkplain Material#texture() material's texture} does {@linkplain Texture#isUVRequired() not depend} on the uv-coordinates)
|
|
|
|
|
|
|
|
* @param isFrontFace whether the front or the back of the surface was it
|
|
|
|
|
|
|
|
*/
|
|
|
|
public record HitResult(
|
|
|
|
public record HitResult(
|
|
|
|
double t, @NotNull Vec3 position, @NotNull Vec3 normal, @NotNull Hittable target,
|
|
|
|
double t, @NotNull Vec3 position, @NotNull Vec3 normal, @NotNull Hittable target,
|
|
|
|
@NotNull Material material, double u, double v, boolean isFrontFace
|
|
|
|
@NotNull Material material, double u, double v, boolean isFrontFace
|
|
|
|