move nVidia compatibility to a config option
This commit is contained in:
@@ -8,6 +8,7 @@ import net.minecraft.world.biome.Biome
|
|||||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent
|
import net.minecraftforge.fml.client.event.ConfigChangedEvent
|
||||||
import net.minecraftforge.fml.relauncher.Side
|
import net.minecraftforge.fml.relauncher.Side
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly
|
import net.minecraftforge.fml.relauncher.SideOnly
|
||||||
|
import org.lwjgl.opengl.GL11
|
||||||
|
|
||||||
// BetterFoliage-specific property delegates
|
// BetterFoliage-specific property delegates
|
||||||
private val OBSOLETE = ObsoleteConfigProperty()
|
private val OBSOLETE = ObsoleteConfigProperty()
|
||||||
@@ -30,6 +31,7 @@ private fun Biome.filterClass(vararg name: String) = name.any { it in this.javaC
|
|||||||
object Config : DelegatingConfig(BetterFoliageMod.MOD_ID, BetterFoliageMod.DOMAIN) {
|
object Config : DelegatingConfig(BetterFoliageMod.MOD_ID, BetterFoliageMod.DOMAIN) {
|
||||||
|
|
||||||
var enabled by boolean(true)
|
var enabled by boolean(true)
|
||||||
|
var nVidia by boolean(GL11.glGetString(GL11.GL_VENDOR).toLowerCase().contains("nvidia"))
|
||||||
|
|
||||||
object blocks {
|
object blocks {
|
||||||
val leavesClasses = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "LeavesBlocksDefault.cfg")
|
val leavesClasses = ConfigurableBlockMatcher(BetterFoliageMod.DOMAIN, "LeavesBlocksDefault.cfg")
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ const val chamferAffinity = 0.9f
|
|||||||
/** Amount to shrink column extension bits to stop Z-fighting. */
|
/** Amount to shrink column extension bits to stop Z-fighting. */
|
||||||
val zProtectionScale: Double3 get() = Double3(Config.roundLogs.zProtection, 1.0, Config.roundLogs.zProtection)
|
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 }) {
|
fun Model.columnSide(radius: Double, yBottom: Double, yTop: Double, transform: (Quad) -> Quad = { it }) {
|
||||||
val halfRadius = radius * 0.5
|
val halfRadius = radius * 0.5
|
||||||
listOf(
|
listOf(
|
||||||
@@ -96,14 +93,14 @@ fun Model.columnLid(radius: Double, transform: (Quad)->Quad = { it }) {
|
|||||||
1 -> EdgeInterpolateFallback(UP, SOUTH, 0.0)
|
1 -> EdgeInterpolateFallback(UP, SOUTH, 0.0)
|
||||||
else -> vertex.aoShader
|
else -> vertex.aoShader
|
||||||
})}
|
})}
|
||||||
.cycleVertices(if (nVidia) 0 else 1)
|
.cycleVertices(if (Config.nVidia) 0 else 1)
|
||||||
val q2 = Quad(v1, v4, v5, v6).setAoShader(faceOrientedAuto(overrideFace = UP, corner = cornerAo(Axis.Y)))
|
val q2 = Quad(v1, v4, v5, v6).setAoShader(faceOrientedAuto(overrideFace = UP, corner = cornerAo(Axis.Y)))
|
||||||
.transformVI { vertex, idx -> vertex.copy(aoShader = when(idx) {
|
.transformVI { vertex, idx -> vertex.copy(aoShader = when(idx) {
|
||||||
0 -> FaceCenter(UP)
|
0 -> FaceCenter(UP)
|
||||||
3 -> EdgeInterpolateFallback(UP, EAST, 0.0)
|
3 -> EdgeInterpolateFallback(UP, EAST, 0.0)
|
||||||
else -> vertex.aoShader
|
else -> vertex.aoShader
|
||||||
})}
|
})}
|
||||||
.cycleVertices(if (nVidia) 0 else 1)
|
.cycleVertices(if (Config.nVidia) 0 else 1)
|
||||||
listOf(q1, q2).forEach { transform(it.setFlatShader(FaceFlat(UP))).add() }
|
listOf(q1, q2).forEach { transform(it.setFlatShader(FaceFlat(UP))).add() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user