diff --git a/src/main/kotlin/mods/betterfoliage/client/render/ModelColumn.kt b/src/main/kotlin/mods/betterfoliage/client/render/ModelColumn.kt index 7ff2bdc..d971791 100644 --- a/src/main/kotlin/mods/betterfoliage/client/render/ModelColumn.kt +++ b/src/main/kotlin/mods/betterfoliage/client/render/ModelColumn.kt @@ -6,6 +6,7 @@ import mods.octarinecore.client.render.* import mods.octarinecore.common.Double3 import mods.octarinecore.exchange import net.minecraft.util.EnumFacing.* +import org.lwjgl.opengl.GL11 /** Weight of the same-side AO values on the outer edges of the 45deg chamfered column faces. */ const val chamferAffinity = 0.9f @@ -13,6 +14,9 @@ const val chamferAffinity = 0.9f /** Amount to shrink column extension bits to stop Z-fighting. */ val zProtectionScale: Double3 get() = Double3(Config.roundLogs.zProtection, 1.0, Config.roundLogs.zProtection) +/** nVidia does it different... */ +val nVidia = GL11.glGetString(GL11.GL_VENDOR).toLowerCase().contains("nvidia") + fun Model.columnSide(radius: Double, yBottom: Double, yTop: Double, transform: (Quad) -> Quad = { it }) { val halfRadius = radius * 0.5 listOf( @@ -92,12 +96,14 @@ fun Model.columnLid(radius: Double, transform: (Quad)->Quad = { it }) { 1 -> EdgeInterpolateFallback(UP, SOUTH, 0.0) else -> vertex.aoShader })} + .cycleVertices(if (nVidia) 0 else 1) val q2 = Quad(v1, v4, v5, v6).setAoShader(faceOrientedAuto(overrideFace = UP, corner = cornerAo(Axis.Y))) .transformVI { vertex, idx -> vertex.copy(aoShader = when(idx) { 0 -> FaceCenter(UP) 3 -> EdgeInterpolateFallback(UP, EAST, 0.0) else -> vertex.aoShader })} + .cycleVertices(if (nVidia) 0 else 1) listOf(q1, q2).forEach { transform(it.setFlatShader(FaceFlat(UP))).add() } } diff --git a/src/main/kotlin/mods/octarinecore/client/render/Model.kt b/src/main/kotlin/mods/octarinecore/client/render/Model.kt index 44f3032..a1ff3f3 100644 --- a/src/main/kotlin/mods/octarinecore/client/render/Model.kt +++ b/src/main/kotlin/mods/octarinecore/client/render/Model.kt @@ -81,6 +81,12 @@ data class Quad(val v1: Vertex, val v2: Vertex, val v3: Vertex, val v4: Vertex) fun setFlatShader(shader: Shader) = transformVI { vertex, idx -> vertex.copy(flatShader = shader) } val flipped: Quad get() = Quad(v4, v3, v2, v1) + fun cycleVertices(n: Int) = when(n % 4) { + 1 -> Quad(v2, v3, v4, v1) + 2 -> Quad(v3, v4, v1, v2) + 3 -> Quad(v4, v1, v2, v3) + else -> this.copy() + } } /**