rendering: fix rotations wrong way

This commit is contained in:
Lukas 2021-04-10 18:03:07 +02:00
parent f79096f3e0
commit c1fa6d5829
2 changed files with 11 additions and 13 deletions

View File

@ -51,9 +51,8 @@ class TintColorCalculator(val world: World) {
for (z in blendStart.z until blendEnd.z) { for (z in blendStart.z until blendEnd.z) {
for (y in blendStart.y until blendEnd.y) {
for (x in blendStart.x until blendEnd.x) { for (x in blendStart.x until blendEnd.x) {
val blendBlockPosition = Vec3i(x, y, z) val blendBlockPosition = Vec3i(x, blockPosition.y, z)
getTint(world.getBiome(blendBlockPosition), blockState, blendBlockPosition)?.let { getTint(world.getBiome(blendBlockPosition), blockState, blendBlockPosition)?.let {
totalRed += it.red totalRed += it.red
totalGreen += it.green totalGreen += it.green
@ -63,7 +62,6 @@ class TintColorCalculator(val world: World) {
} }
} }
} }
}
if ((totalRed == 0L && totalGreen == 0L && totalBlue == 0L) || count == 0) { if ((totalRed == 0L && totalGreen == 0L && totalBlue == 0L) || count == 0) {
return null return null

View File

@ -133,18 +133,18 @@ class ElementRenderer(
if (rotation == VecUtil.EMPTY_VEC3) { if (rotation == VecUtil.EMPTY_VEC3) {
return direction return direction
} }
var rotatedDirectionVector = direction.floatDirectionVector.rotate(rotation.x, Axes.X) var rotatedDirectionVector = direction.floatDirectionVector.rotate(-rotation.x, Axes.X)
rotatedDirectionVector = rotatedDirectionVector.rotate(rotation.y, Axes.Y) rotatedDirectionVector = rotatedDirectionVector.rotate(rotation.y, Axes.Y)
return Directions.byDirection(rotatedDirectionVector.rotate(rotation.z, Axes.Z)) return Directions.byDirection(rotatedDirectionVector.rotate(-rotation.z, Axes.Z))
} }
fun rotatePositionsAxes(positions: Array<Vec3>, angles: Vec3, rescale: Boolean) { fun rotatePositionsAxes(positions: Array<Vec3>, angles: Vec3, rescale: Boolean) {
if (angles == VecUtil.EMPTY_VEC3) { if (angles == VecUtil.EMPTY_VEC3) {
return return
} }
BlockModelElement.rotatePositions(positions, Axes.X, angles.x, VecUtil.EMPTY_VEC3, rescale) BlockModelElement.rotatePositions(positions, Axes.X, -angles.x, VecUtil.EMPTY_VEC3, rescale)
BlockModelElement.rotatePositions(positions, Axes.Y, angles.y, VecUtil.EMPTY_VEC3, rescale) BlockModelElement.rotatePositions(positions, Axes.Y, angles.y, VecUtil.EMPTY_VEC3, rescale)
BlockModelElement.rotatePositions(positions, Axes.Z, angles.z, VecUtil.EMPTY_VEC3, rescale) BlockModelElement.rotatePositions(positions, Axes.Z, -angles.z, VecUtil.EMPTY_VEC3, rescale)
} }
val POSITION_1 = Vec3(-0.5f, -0.5f, -0.5f) val POSITION_1 = Vec3(-0.5f, -0.5f, -0.5f)