fixed Log block endcap UV rotations
This commit is contained in:
@@ -100,9 +100,9 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
else -> null
|
||||
}
|
||||
|
||||
val bottomSquare = model { columnLidSquare() { it.rotate(rot(EAST) * 2 + rot(UP)) } }
|
||||
val bottomRoundSmall = model { columnLid(radiusSmall) { it.rotate(rot(EAST) * 2 + rot(UP)) } }
|
||||
val bottomRoundLarge = model { columnLid(radiusLarge) { it.rotate(rot(EAST) * 2 + rot(UP)) } }
|
||||
val bottomSquare = model { columnLidSquare() { it.rotate(rot(EAST) * 2 + rot(UP)).mirrorUV(true, true) } }
|
||||
val bottomRoundSmall = model { columnLid(radiusSmall) { it.rotate(rot(EAST) * 2 + rot(UP)).mirrorUV(true, true) } }
|
||||
val bottomRoundLarge = model { columnLid(radiusLarge) { it.rotate(rot(EAST) * 2 + rot(UP)).mirrorUV(true, true) } }
|
||||
inline fun flatBottom(type: QuadrantType) = when(type) {
|
||||
SMALL_RADIUS -> bottomRoundSmall.model
|
||||
LARGE_RADIUS -> bottomRoundLarge.model
|
||||
@@ -171,7 +171,6 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
rotation,
|
||||
blockContext.blockCenter,
|
||||
icon = sideTexture,
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
|
||||
@@ -227,8 +226,10 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
rotation,
|
||||
blockContext.blockCenter,
|
||||
icon = upIcon,
|
||||
rotateUV = { if (shouldRotateUp) idx else 0 },
|
||||
postProcess = noPost
|
||||
postProcess = { ctx, qi, q, vi, v ->
|
||||
rotateUV((if (shouldRotateUp) idx else 0) + (if (logAxis == Axis.X) 1 else 0))
|
||||
if (logAxis == Axis.X) mirrorUV(true, true)
|
||||
}
|
||||
)
|
||||
if (downModel != null) modelRenderer.render(
|
||||
renderer,
|
||||
@@ -236,8 +237,10 @@ abstract class AbstractRenderColumn(modId: String) : AbstractBlockRenderingHandl
|
||||
rotation,
|
||||
blockContext.blockCenter,
|
||||
icon = downIcon,
|
||||
rotateUV = { if (shouldRotateDown) 3 - idx else 0 },
|
||||
postProcess = noPost
|
||||
postProcess = { ctx, qi, q, vi, v ->
|
||||
rotateUV((if (shouldRotateDown) 3 - idx else 0) + (if (logAxis == Axis.X) 1 else 0))
|
||||
if (logAxis != Axis.Y) mirrorUV(true, true)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ class RenderAlgae : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
algaeModels[rand[2]],
|
||||
Rotation.identity,
|
||||
icon = { ctx, qi, q -> algaeIcons[rand[qi and 1]]!! },
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
icon = { ctx, qi, q -> when(qi) {
|
||||
0 -> icons.bottomTexture; 1 -> icons.topTexture; else -> icons.sideTexture
|
||||
} },
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
modelRenderer.render(
|
||||
@@ -82,7 +81,6 @@ class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
modelCross[ctx.random(0)],
|
||||
Rotation.identity,
|
||||
icon = { ctx, qi, q -> iconCross.icon!!},
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
modelRenderer.render(
|
||||
@@ -90,7 +88,6 @@ class RenderCactus : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
modelArm[ctx.random(1)],
|
||||
cactusArmRotation[ctx.random(2) % 4],
|
||||
icon = { ctx2, qi, q -> iconArm[ctx.random(3)]!!},
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
return true
|
||||
|
||||
@@ -63,7 +63,6 @@ class RenderCoral : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
coralModels[variation++],
|
||||
rotationFromUp[idx],
|
||||
icon = { ctx, qi, q -> if (qi == 4) crustIcons[variation]!! else coralIcons[variation + (qi and 1)]!!},
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
Rotation.identity,
|
||||
ctx.blockCenter,
|
||||
icon = { ctx, qi, q -> grassTopTexture },
|
||||
rotateUV = { 2 },
|
||||
postProcess = { ctx, qi, q, vi, v ->
|
||||
rotateUV(2)
|
||||
if (isSnowed) { if(!ctx.aoEnabled) setGrey(1.4f) }
|
||||
else if (ctx.aoEnabled) multiplyColor(blockColor)
|
||||
}
|
||||
@@ -101,7 +101,6 @@ class RenderGrass : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
icon = { ctx: ShadingContext, qi: Int, q: Quad ->
|
||||
if (Config.shortGrass.useGenerated) iconGen.icon!! else iconset[rand[qi and 1]]!!
|
||||
},
|
||||
rotateUV = { 0 },
|
||||
postProcess = { ctx, qi, q, vi, v -> if (isSnowed) setGrey(1.0f) else multiplyColor(grassInfo.overrideColor ?: blockColor) }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,8 +61,10 @@ class RenderLeaves : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
rotation,
|
||||
ctx.blockCenter + perturbs[rand[0]],
|
||||
icon = { ctx, qi, q -> leafInfo.roundLeafTexture },
|
||||
rotateUV = { q -> rand[1] },
|
||||
postProcess = { ctx, qi, q, vi, v -> multiplyColor(blockColor) }
|
||||
postProcess = { ctx, qi, q, vi, v ->
|
||||
rotateUV(rand[1])
|
||||
multiplyColor(blockColor)
|
||||
}
|
||||
)
|
||||
}
|
||||
if (isSnowed) modelRenderer.render(
|
||||
@@ -71,7 +73,6 @@ class RenderLeaves : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
Rotation.identity,
|
||||
ctx.blockCenter + perturbs[rand[0]],
|
||||
icon = { ctx, qi, q -> snowedIcon[rand[1]]!! },
|
||||
rotateUV = { 0 },
|
||||
postProcess = whitewash
|
||||
)
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ class RenderLilypad : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
ctx.blockCenter.add(perturbs[rand[2]]),
|
||||
forceFlat = true,
|
||||
icon = { ctx, qi, q -> rootIcon[rand[qi and 1]]!! },
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
}
|
||||
@@ -67,7 +66,6 @@ class RenderLilypad : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
ctx.blockCenter.add(perturbs[rand[4]]),
|
||||
forceFlat = true,
|
||||
icon = { ctx, qi, q -> flowerIcon[rand[0]]!! },
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ class RenderMycelium : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
Rotation.identity,
|
||||
ctx.blockCenter + (if (isSnowed) snowOffset else Double3.zero),
|
||||
icon = { ctx, qi, q -> myceliumIcon[rand[qi and 1]]!! },
|
||||
rotateUV = { 0 },
|
||||
postProcess = if (isSnowed) whitewash else noPost
|
||||
)
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ class RenderNetherrack : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID)
|
||||
netherrackModel[rand[0]],
|
||||
Rotation.identity,
|
||||
icon = { ctx, qi, q -> netherrackIcon[rand[qi and 1]]!! },
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ class RenderReeds : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) {
|
||||
Rotation.identity,
|
||||
forceFlat = true,
|
||||
icon = { ctx, qi, q -> reedIcons[iconVar]!! },
|
||||
rotateUV = { 0 },
|
||||
postProcess = noPost
|
||||
)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ class ModelRenderer() : ShadingContext() {
|
||||
trans: Double3 = blockContext.blockCenter,
|
||||
forceFlat: Boolean = false,
|
||||
icon: (ShadingContext, Int, Quad) -> TextureAtlasSprite?,
|
||||
rotateUV: (Quad) -> Int,
|
||||
postProcess: RenderVertex.(ShadingContext, Int, Quad, Int, Vertex) -> Unit
|
||||
) {
|
||||
rotation = rot
|
||||
@@ -44,13 +43,12 @@ class ModelRenderer() : ShadingContext() {
|
||||
model.quads.forEachIndexed { quadIdx, quad ->
|
||||
val drawIcon = icon(this, quadIdx, quad)
|
||||
if (drawIcon != null) {
|
||||
val uvRot = rotateUV(quad)
|
||||
quad.verts.forEachIndexed { vertIdx, vert ->
|
||||
temp.init(vert)
|
||||
temp.rotate(rotation).translate(trans).rotateUV(uvRot).setIcon(drawIcon)
|
||||
temp.init(vert).rotate(rotation).translate(trans)
|
||||
val shader = if (aoEnabled && !forceFlat) vert.aoShader else vert.flatShader
|
||||
shader.shade(this, temp)
|
||||
temp.postProcess(this, quadIdx, quad, vertIdx, vert)
|
||||
temp.setIcon(drawIcon)
|
||||
|
||||
worldRenderer
|
||||
.pos(temp.x, temp.y, temp.z)
|
||||
@@ -133,6 +131,10 @@ class RenderVertex() {
|
||||
else -> { return this }
|
||||
}
|
||||
}
|
||||
inline fun mirrorUV(mirrorU: Boolean, mirrorV: Boolean) {
|
||||
if (mirrorU) u = -u
|
||||
if (mirrorV) v = -v
|
||||
}
|
||||
inline fun setIcon(icon: TextureAtlasSprite): RenderVertex {
|
||||
u = (icon.maxU - icon.minU) * (u + 0.5) + icon.minU
|
||||
v = (icon.maxV - icon.minV) * (v + 0.5) + icon.minV
|
||||
|
||||
Reference in New Issue
Block a user