rendering: fix one more problem regarding rotation about the wrong axis

This commit is contained in:
Lukas 2021-02-12 21:37:18 +01:00
parent 2ce1f233af
commit d8eda49ac4
3 changed files with 11 additions and 11 deletions

View File

@ -60,7 +60,7 @@ open class BlockModel(val parent: BlockModel? = null, json: JsonObject) {
val modelMatrix = Mat4().translate(Vec3(position.x, position.y, position.z)) val modelMatrix = Mat4().translate(Vec3(position.x, position.y, position.z))
.rotate(rotation.z, Vec3(0, 0, -1)) .rotate(rotation.z, Vec3(0, 0, -1))
.rotate(rotation.y, Vec3(0, -1, 0)) .rotate(rotation.y, Vec3(0, -1, 0))
.rotate(rotation.x, Vec3(-1, 0, 0)) .rotate(rotation.x, Vec3(1, 0, 0))
// ToDo: this should be made easier/more efficient // ToDo: this should be made easier/more efficient
for (direction in Directions.DIRECTIONS) { for (direction in Directions.DIRECTIONS) {

View File

@ -160,12 +160,12 @@ open class BlockModelElement(data: JsonObject) {
} }
when (realDirection) { when (realDirection) {
Directions.DOWN -> createQuad(drawPositions, face.texturLeftDown, face.texturLeftUp, face.texturRightUp, face.texturRightDown) Directions.DOWN -> createQuad(drawPositions, face.textureLeftDown, face.textureLeftUp, face.textureRightUp, face.textureRightDown)
Directions.UP -> createQuad(drawPositions, face.texturLeftDown, face.texturLeftUp, face.texturRightUp, face.texturRightDown) Directions.UP -> createQuad(drawPositions, face.textureLeftDown, face.textureLeftUp, face.textureRightUp, face.textureRightDown)
Directions.NORTH -> createQuad(drawPositions, face.texturRightDown, face.texturRightUp, face.texturLeftUp, face.texturLeftDown) Directions.NORTH -> createQuad(drawPositions, face.textureRightDown, face.textureRightUp, face.textureLeftUp, face.textureLeftDown)
Directions.SOUTH -> createQuad(drawPositions, face.texturLeftDown, face.texturLeftUp, face.texturRightUp, face.texturRightDown) Directions.SOUTH -> createQuad(drawPositions, face.textureLeftDown, face.textureLeftUp, face.textureRightUp, face.textureRightDown)
Directions.WEST -> createQuad(drawPositions, face.texturRightUp, face.texturRightDown, face.texturLeftDown, face.texturLeftUp) Directions.WEST -> createQuad(drawPositions, face.textureRightUp, face.textureRightDown, face.textureLeftDown, face.textureLeftUp)
Directions.EAST -> createQuad(drawPositions, face.texturLeftUp, face.texturLeftDown, face.texturRightDown, face.texturRightUp) Directions.EAST -> createQuad(drawPositions, face.textureLeftUp, face.textureLeftDown, face.textureRightDown, face.textureRightUp)
} }
} }

View File

@ -25,10 +25,10 @@ class BlockModelFace(data: JsonObject) {
} }
} }
val texturLeftDown = Vec2(uvToFloat(textureStart.x), uvToFloat(textureStart.y)) val textureLeftDown = Vec2(uvToFloat(textureStart.x), uvToFloat(textureStart.y))
val texturLeftUp = Vec2(uvToFloat(textureStart.x), uvToFloat(textureEnd.y)) val textureLeftUp = Vec2(uvToFloat(textureStart.x), uvToFloat(textureEnd.y))
val texturRightUp = Vec2(uvToFloat(textureEnd.x), uvToFloat(textureEnd.y)) val textureRightUp = Vec2(uvToFloat(textureEnd.x), uvToFloat(textureEnd.y))
val texturRightDown = Vec2(uvToFloat(textureEnd.x), uvToFloat(textureStart.y)) val textureRightDown = Vec2(uvToFloat(textureEnd.x), uvToFloat(textureStart.y))
companion object { companion object {