dont evaluate derivatives for empty slant palettes

This commit is contained in:
dfsek
2021-12-22 02:55:56 -07:00
parent 7307b58696
commit a461a57f0d
2 changed files with 5 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ public final class PaletteUtil {
public static Palette getPalette(int x, int y, int z, Sampler3D sampler, PaletteInfo paletteInfo) {
SlantHolder slant = paletteInfo.slantHolder();
if(slant != null) {
if(!slant.isEmpty()) {
double slope = derivative(sampler, x, y, z);
if(slope > slant.getMinSlope()) {
return slant.getPalette(slope).getPalette(y);

View File

@@ -20,6 +20,10 @@ public class SlantHolder {
this.minSlope = minSlope;
}
public boolean isEmpty() {
return layers.isEmpty();
}
public PaletteHolder getPalette(double slope) {
return layers.floorEntry(slope).getValue();
}