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