|
|
@ -30,6 +30,7 @@ public class Examples {
|
|
|
|
register("LIGHT", Examples::getLight);
|
|
|
|
register("LIGHT", Examples::getLight);
|
|
|
|
register("CORNELL", Examples::getCornellBox);
|
|
|
|
register("CORNELL", Examples::getCornellBox);
|
|
|
|
register("CORNELL_SMOKE", Examples::getCornellBoxSmoke);
|
|
|
|
register("CORNELL_SMOKE", Examples::getCornellBoxSmoke);
|
|
|
|
|
|
|
|
register("DIAGRAMM", Examples::getDiagramm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static @NotNull IntFunction<Example> getByName(@NotNull String name) {
|
|
|
|
public static @NotNull IntFunction<Example> getByName(@NotNull String name) {
|
|
|
@ -202,6 +203,54 @@ public class Examples {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static @NotNull Example getDiagramm(int height) {
|
|
|
|
|
|
|
|
if (height <= 0) height = 450;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
record Partei(String name, Color color, double stimmen) { }
|
|
|
|
|
|
|
|
var data = List.of(
|
|
|
|
|
|
|
|
new Partei("CDU", new Color(0x00, 0x4B, 0x76), 18.9),
|
|
|
|
|
|
|
|
new Partei("SPD", new Color(0xC0, 0x00, 0x3C), 25.7),
|
|
|
|
|
|
|
|
new Partei("AfD", new Color(0x80, 0xCD, 0xEC), 10.3),
|
|
|
|
|
|
|
|
new Partei("FDP", new Color(0xF7, 0xBB, 0x3D), 11.5),
|
|
|
|
|
|
|
|
new Partei("DIE LINKE", new Color(0x5F, 0x31, 0x6E), 4.9),
|
|
|
|
|
|
|
|
new Partei("GRÜNE", new Color(0x00, 0x85, 0x4A), 14.8),
|
|
|
|
|
|
|
|
new Partei("CSU", new Color(0x00, 0x77, 0xB6), 5.2)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
var white = new LambertianMaterial(new Color(.99, .99, .99));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var count = data.size();
|
|
|
|
|
|
|
|
var size = 75d;
|
|
|
|
|
|
|
|
var spacing = 50d;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var x = (count + 1) * spacing + count * size + 1000;
|
|
|
|
|
|
|
|
var y = 500 + 1000;
|
|
|
|
|
|
|
|
var z = 2 * spacing + size + 1000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var objects = new ArrayList<Hittable>();
|
|
|
|
|
|
|
|
objects.add(new Parallelogram(new Vec3(0, 0, 0), new Vec3(x, 0, 0), new Vec3(0, y, 0), white));
|
|
|
|
|
|
|
|
objects.add(new Parallelogram(new Vec3(0, 0, 0), new Vec3(0, 0, z), new Vec3(x, 0, 0), white));
|
|
|
|
|
|
|
|
objects.add(new Parallelogram(new Vec3(0, 0, 0), new Vec3(0, y, 0), new Vec3(0, 0, z), white));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
|
|
|
var partei = data.get(i);
|
|
|
|
|
|
|
|
objects.add(Hittables.box(
|
|
|
|
|
|
|
|
new Vec3((i + 1) * spacing + i * size, 0, spacing),
|
|
|
|
|
|
|
|
new Vec3((i + 1) * spacing + (i + 1) * size, partei.stimmen() * 15, spacing + size),
|
|
|
|
|
|
|
|
new DielectricMaterial(1.5, partei.color())
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new Example(
|
|
|
|
|
|
|
|
new Scene(new Color(1.25, 1.25, 1.25), objects),
|
|
|
|
|
|
|
|
SimpleCamera.builder()
|
|
|
|
|
|
|
|
.withImage(height * 16 / 9, height)
|
|
|
|
|
|
|
|
.withPosition(new Vec3(700, 250, 800))
|
|
|
|
|
|
|
|
.withTarget(new Vec3(500, 200, 0))
|
|
|
|
|
|
|
|
.withFieldOfView(Math.toRadians(40))
|
|
|
|
|
|
|
|
.build()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static @NotNull SkyBox getSkyBox() {
|
|
|
|
private static @NotNull SkyBox getSkyBox() {
|
|
|
|
return SkyBox.gradient(new Color(0.5, 0.7, 1.0), Color.WHITE);
|
|
|
|
return SkyBox.gradient(new Color(0.5, 0.7, 1.0), Color.WHITE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|