|
|
|
@ -51,14 +51,13 @@ public class Examples {
|
|
|
|
|
public static @NotNull Example getSimpleScene(int height) {
|
|
|
|
|
if (height <= 0) height = 675;
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
getSkyBox(),
|
|
|
|
|
new Scene(getSkyBox(), List.of(
|
|
|
|
|
new Sphere(new Vec3(0, -100.5, -1.0), 100.0, new LambertianMaterial(new Color(0.8, 0.8, 0.0))),
|
|
|
|
|
new Sphere(new Vec3(0, 0, -1.2), 0.5, new LambertianMaterial(new Color(0.1, 0.2, 0.5))),
|
|
|
|
|
new Sphere(new Vec3(-1.0, 0, -1.2), 0.5, new DielectricMaterial(1.5)),
|
|
|
|
|
new Sphere(new Vec3(-1.0, 0, -1.2), 0.4, new DielectricMaterial(1 / 1.5)),
|
|
|
|
|
new Sphere(new Vec3(1.0, 0, -1.2), 0.5, new MetallicMaterial(new Color(0.8, 0.6, 0.2), 0.0))
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height * 16 / 9, height)
|
|
|
|
|
.build()
|
|
|
|
@ -119,14 +118,13 @@ public class Examples {
|
|
|
|
|
public static @NotNull Example getSquares(int height) {
|
|
|
|
|
if (height <= 0) height = 600;
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
getSkyBox(),
|
|
|
|
|
new Scene(getSkyBox(), List.of(
|
|
|
|
|
new Parallelogram(new Vec3(-3, -2, 5), new Vec3(0, 0, -4), new Vec3(0, 4, 0), new LambertianMaterial(new Color(1.0, 0.2, 0.2))),
|
|
|
|
|
new Parallelogram(new Vec3(-2, -2, 0), new Vec3(4, 0, 0), new Vec3(0, 4, 0), new LambertianMaterial(new Color(0.2, 1.0, 0.2))),
|
|
|
|
|
new Parallelogram(new Vec3(3, -2, 1), new Vec3(0, 0, 4), new Vec3(0, 4, 0), new LambertianMaterial(new Color(0.2, 0.2, 1.0))),
|
|
|
|
|
new Parallelogram(new Vec3(-2, 3, 1), new Vec3(4, 0, 0), new Vec3(0, 0, 4), new LambertianMaterial(new Color(1.0, 0.5, 0.0))),
|
|
|
|
|
new Parallelogram(new Vec3(-2, -3, 5), new Vec3(4, 0, 0), new Vec3(0, 0, -4), new LambertianMaterial(new Color(0.2, 0.8, 0.8)))
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height, height)
|
|
|
|
|
.withFieldOfView(Math.toRadians(80))
|
|
|
|
@ -139,12 +137,12 @@ public class Examples {
|
|
|
|
|
public static @NotNull Example getLight(int height) {
|
|
|
|
|
if (height <= 0) height = 225;
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
new Scene(List.of(
|
|
|
|
|
new Sphere(new Vec3(0, -1000, 0), 1000, new LambertianMaterial(new Color(0.2, 0.2, 0.2))),
|
|
|
|
|
new Sphere(new Vec3(0, 2, 0), 2, new LambertianMaterial(new Color(0.2, 0.2, 0.2))),
|
|
|
|
|
new Parallelogram(new Vec3(3, 1, -2), new Vec3(2, 0, 0), new Vec3(0, 2, 0), new DiffuseLight(new Color(4.0, 4.0, 4.0))),
|
|
|
|
|
new Sphere(new Vec3(0, 7, 0), 2, new DiffuseLight(new Color(4.0, 4.0, 4.0)))
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height * 16 / 9, height)
|
|
|
|
|
.withFieldOfView(Math.toRadians(20))
|
|
|
|
@ -163,7 +161,7 @@ public class Examples {
|
|
|
|
|
var light = new DiffuseLight(new Color(15.0, 15.0, 15.0));
|
|
|
|
|
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
new Scene(List.of(
|
|
|
|
|
new Box(
|
|
|
|
|
new AABB(new Vec3(0, 0, 0), new Vec3(555, 555, 555)),
|
|
|
|
|
white, white, red, green, white, null
|
|
|
|
@ -171,7 +169,7 @@ public class Examples {
|
|
|
|
|
new Parallelogram(new Vec3(343, 554, 332), new Vec3(-130, 0, 0), new Vec3(0, 0, -105), light),
|
|
|
|
|
new Box(new Vec3(0, 0, 0), new Vec3(165, 330, 165), white).rotateY(Math.toRadians(15)).translate(new Vec3(265, 0, 295)),
|
|
|
|
|
new Box(new Vec3(0, 0, 0), new Vec3(165, 165, 165), white).rotateY(Math.toRadians(-18)).translate(new Vec3(130, 0, 65))
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height, height)
|
|
|
|
|
.withFieldOfView(Math.toRadians(40))
|
|
|
|
@ -189,7 +187,7 @@ public class Examples {
|
|
|
|
|
var light = new DiffuseLight(new Color(7.0, 7.0, 7.0));
|
|
|
|
|
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
new Scene(List.of(
|
|
|
|
|
new Box(
|
|
|
|
|
new AABB(new Vec3(0, 0, 0), new Vec3(555, 555, 555)),
|
|
|
|
|
white, white, red, green, white, null
|
|
|
|
@ -203,7 +201,7 @@ public class Examples {
|
|
|
|
|
new Box(new Vec3(0, 0, 0), new Vec3(165, 165, 165), white).rotateY(Math.toRadians(-18)).translate(new Vec3(130, 0, 65)),
|
|
|
|
|
0.01, new IsotropicMaterial(Color.WHITE)
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height, height)
|
|
|
|
|
.withFieldOfView(Math.toRadians(40))
|
|
|
|
@ -223,19 +221,19 @@ public class Examples {
|
|
|
|
|
var aluminum = new MetallicMaterial(new Color(0.8, 0.85, 0.88));
|
|
|
|
|
var glass = new DielectricMaterial(1.5);
|
|
|
|
|
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
new Box(
|
|
|
|
|
var room = new Box(
|
|
|
|
|
new AABB(new Vec3(0, 0, 0), new Vec3(555, 555, 555)),
|
|
|
|
|
white, white, red, green, white, null
|
|
|
|
|
),
|
|
|
|
|
new Parallelogram(new Vec3(343, 554, 332), new Vec3(-130, 0, 0), new Vec3(0, 0, -105), light),
|
|
|
|
|
new Box(
|
|
|
|
|
);
|
|
|
|
|
var lamp = new Parallelogram(new Vec3(343, 554, 332), new Vec3(-130, 0, 0), new Vec3(0, 0, -105), light);
|
|
|
|
|
var box = new Box(
|
|
|
|
|
new AABB(new Vec3(0, 0, 0), new Vec3(165, 330, 165)),
|
|
|
|
|
white, white, white, white, white, aluminum
|
|
|
|
|
).rotateY(Math.toRadians(15)).translate(new Vec3(265, 0, 295)),
|
|
|
|
|
new Sphere(new Vec3(190, 90, 190), 90, glass)
|
|
|
|
|
),
|
|
|
|
|
).rotateY(Math.toRadians(15)).translate(new Vec3(265, 0, 295));
|
|
|
|
|
var sphere = new Sphere(new Vec3(190, 90, 190), 90, glass);
|
|
|
|
|
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(List.of(room, box), List.of(lamp, sphere)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height, height)
|
|
|
|
|
.withFieldOfView(Math.toRadians(40))
|
|
|
|
@ -297,10 +295,9 @@ public class Examples {
|
|
|
|
|
if (height <= 0) height = 450;
|
|
|
|
|
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
getSkyBox(),
|
|
|
|
|
new Scene(getSkyBox(), List.of(
|
|
|
|
|
new Sphere(Vec3.ZERO, 2, new LambertianMaterial(new ImageTexture("/earthmap.jpg")))
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height * 16 / 9, height)
|
|
|
|
|
.withFieldOfView(Math.toRadians(20))
|
|
|
|
@ -316,11 +313,10 @@ public class Examples {
|
|
|
|
|
var material = new LambertianMaterial(new PerlinTexture(4));
|
|
|
|
|
|
|
|
|
|
return new Example(
|
|
|
|
|
new Scene(
|
|
|
|
|
getSkyBox(),
|
|
|
|
|
new Scene(getSkyBox(), List.of(
|
|
|
|
|
new Sphere(new Vec3(0, -1000, 0), 1000, material),
|
|
|
|
|
new Sphere(new Vec3(0, 2, 0), 2, material)
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
.withImage(height * 16 / 9, height)
|
|
|
|
|
.withFieldOfView(Math.toRadians(20))
|
|
|
|
|