adopt AO calculation tweak from Indigo

This commit is contained in:
octarine-noise
2021-05-16 12:02:42 +02:00
parent 512cd786f7
commit a2c07d368e
2 changed files with 8 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ org.gradle.daemon=false
group = com.github.octarine-noise
jarName = BetterFoliage-Forge
version = 2.6.1
version = 2.6.3
mcVersion = 1.15.2
forgeVersion = 31.2.44

View File

@@ -23,6 +23,10 @@ data class LightingData(
}
}
// Vanilla has a very suspicious-looking offset here, which Indigo gets rid of and calls it a fix
// Naturally, we're going to believe Indigo, it's a hardcoded option for now
const val OCCLUSION_OFFSET_FIX = true
/**
* Replacement for [BlockModelRenderer.AmbientOcclusionFace]
* This gets called on a LOT, so object instantiation is avoided.
@@ -87,9 +91,9 @@ class VanillaAoCalculator {
sideHelper.sides.forEachIndexed { sideIdx, sideDir ->
// record light data in the block 1 step to the side
probe.position { setPos(lightOrigin).move(sideDir) }.writeTo(sideAo[sideIdx])
// side is considered occluded if the block 1 step to that side and
// 1 step forward (in the lightface direction) is not fully transparent
isOccluded[sideIdx] = probe.position { move(lightFace) }.isNonTransparent
// side is considered occluded if the block 1 step to that side is not fully transparent
if (!OCCLUSION_OFFSET_FIX) probe.position { move(lightFace) }
isOccluded[sideIdx] = probe.isNonTransparent
}
// AO Calculation for the 4 corners