Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sky depth infinite #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ configurations {
}

dependencies {
provided 'se.llbit:chunky-core:2.4.2'
provided 'se.llbit:chunky-core:2.4.4'
Peregrine05 marked this conversation as resolved.
Show resolved Hide resolved
provided 'org.apache.commons:commons-math3:3.2'
provided 'it.unimi.dsi:fastutil:8.4.4'
bundled 'org.jocl:jocl:2.0.2'
}

javafx {
version = '11'
version = '11.0.2'
Peregrine05 marked this conversation as resolved.
Show resolved Hide resolved
modules = ['javafx.base', 'javafx.controls', 'javafx.fxml']
configuration = 'provided'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

public class DepthTracer implements RayTracer {
public static double NORMALIZATION_FACTOR = 100.0;
public static boolean INFINITE_SKY_DISTANCE = true;

private DepthTracer() {}

Expand All @@ -50,7 +51,8 @@ public static void register() {
@Override
public void trace(Scene scene, WorkerState state) {
Ray ray = state.ray;
double distance = 0.0;
double distance = INFINITE_SKY_DISTANCE ? Double.longBitsToDouble(0x7fe0000000000000L) : 0.0;
Peregrine05 marked this conversation as resolved.
Show resolved Hide resolved

if (PreviewRayTracer.nextIntersection(scene, ray)) {
distance = ray.distance;
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/dev/thatredox/chunkyaov/ui/ChunkyAovTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class ChunkyAovTab implements RenderControlsTab {
private final SimpleBooleanProperty nmPositive = new SimpleBooleanProperty(NormalTracer.MAP_POSITIVE);
private final SimpleBooleanProperty nmWaterDisplacement = new SimpleBooleanProperty(NormalTracer.WATER_DISPLACEMENT);
private final SimpleDoubleProperty depthNormFactor = new SimpleDoubleProperty(DepthTracer.NORMALIZATION_FACTOR);
private final SimpleBooleanProperty infiniteSkyDepth = new SimpleBooleanProperty(DepthTracer.INFINITE_SKY_DISTANCE);

public ChunkyAovTab() {
nmPositive.addListener((observable, oldValue, newValue) -> {
Expand All @@ -64,6 +65,13 @@ public ChunkyAovTab() {
scene.refresh();
}
});
infiniteSkyDepth.addListener((observable, oldValue, newValue) -> {
DepthTracer.INFINITE_SKY_DISTANCE = newValue;
if (scene != null) {
scene.setAdditionalData("aov_infinite_sky_depth", Json.of(newValue));
scene.refresh();
}
});

box.setPadding(new Insets(10.0, 10.0, 10.0, 10.0));

Expand All @@ -86,6 +94,10 @@ public ChunkyAovTab() {
depthNormAdjuster.setRange(1.0, 1000.0);
depthNormAdjuster.clampMin();
box.getChildren().add(depthNormAdjuster);

CheckBox enableInfiniteSkyDepth = new CheckBox("Infinite Sky Depth");
enableInfiniteSkyDepth.selectedProperty().bindBidirectional(infiniteSkyDepth);
box.getChildren().add(enableInfiniteSkyDepth);
}

@Override
Expand All @@ -94,6 +106,7 @@ public void update(Scene scene) {
nmPositive.set(scene.getAdditionalData("aov_normal_positive").boolValue(nmPositive.get()));
nmWaterDisplacement.set(scene.getAdditionalData("aov_normal_water_displacement").boolValue(nmWaterDisplacement.get()));
depthNormFactor.set(scene.getAdditionalData("aov_depth_normalization").doubleValue(depthNormFactor.get()));
infiniteSkyDepth.set(scene.getAdditionalData("aov_infinite_sky_depth").boolValue(infiniteSkyDepth.get()));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Chunky AOV",
"author": "Redox",
"main": "dev.thatredox.chunkyaov.ChunkyAOV",
"version": "0.0.1",
"targetVersion": "2.4.2",
"version": "0.0.2",
"targetVersion": "2.4.4",
Peregrine05 marked this conversation as resolved.
Show resolved Hide resolved
"description": "Arbitrary output variable renderers for Chunky."
}