mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-08 14:59:16 -04:00
world mesh: fix wrong mesh order
This commit is contained in:
parent
0ce0f806c5
commit
f3becea60e
@ -1,4 +0,0 @@
|
||||
Cube uv:
|
||||
|
||||
bottom->top
|
||||
east->north->west->south
|
@ -55,7 +55,7 @@ class BakedFaceTest {
|
||||
|
||||
}
|
||||
|
||||
fun renderFull() {
|
||||
fun mixed() {
|
||||
val face = BakedFace(floatArrayOf(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f), floatArrayOf(-1f, -2f, -3f, -4f, -5f, -6f, -7f, -8f), 1.0f, -1, null, texture())
|
||||
|
||||
val mesh = mesh()
|
||||
@ -67,13 +67,38 @@ class BakedFaceTest {
|
||||
|
||||
val data = mesh.opaqueMesh!!.data.toArray()
|
||||
val expected = floatArrayOf(
|
||||
0f, 1f, 2f, -7f, -8f, texture, lightTint,
|
||||
9f, 10f, 11f, -1f, -2f, texture, lightTint,
|
||||
6f, 7f, 8f, -3f, -4f, texture, lightTint,
|
||||
3f, 4f, 5f, -5f, -6f, texture, lightTint,
|
||||
0f, 1f, 2f, -1f, -2f, texture, lightTint,
|
||||
9f, 10f, 11f, -7f, -8f, texture, lightTint,
|
||||
6f, 7f, 8f, -5f, -6f, texture, lightTint,
|
||||
3f, 4f, 5f, -3f, -4f, texture, lightTint,
|
||||
)
|
||||
|
||||
|
||||
assertEquals(data, expected)
|
||||
}
|
||||
|
||||
fun blockSouth() {
|
||||
val face = BakedFace(floatArrayOf(0f, 0f, 0f, 0f, 1f, 0f, 0f, 1f, 1f, 0f, 0f, 1f), floatArrayOf(0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f), 1.0f, -1, null, texture())
|
||||
|
||||
val mesh = mesh()
|
||||
|
||||
face.render(floatArrayOf(0.0f, 0.0f, 0.0f), mesh, byteArrayOf(0, 0, 0, 0, 0, 0, 0), null)
|
||||
|
||||
val texture = 0.buffer()
|
||||
val lightTint = 0xFFFFFF.buffer()
|
||||
|
||||
val data = mesh.opaqueMesh!!.data.toArray()
|
||||
val expected = floatArrayOf(
|
||||
0f, 0f, 0f, 0f, 0f, texture, lightTint,
|
||||
0f, 0f, 1f, 1f, 0f, texture, lightTint,
|
||||
0f, 1f, 1f, 1f, 1f, texture, lightTint,
|
||||
0f, 1f, 0f, 0f, 1f, texture, lightTint,
|
||||
)
|
||||
|
||||
|
||||
assertEquals(data, expected)
|
||||
}
|
||||
|
||||
|
||||
// TODO: triangle order
|
||||
}
|
||||
|
@ -46,6 +46,22 @@ class FullCubeBakeTest {
|
||||
baked.assertFace(Directions.EAST, positions(Directions.EAST, from, to), floatArrayOf(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f), 0.6f)
|
||||
}
|
||||
|
||||
fun cube2() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
|
||||
baked.assertFace(Directions.DOWN, floatArrayOf(0f, 0f, 0f, 0f, 0f, 1f, 1f, 0f, 1f, 1f, 0f, 0f), floatArrayOf(0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f), 0.5f)
|
||||
baked.assertFace(Directions.UP, floatArrayOf(0f, 1f, 0f, 1f, 1f, 0f, 1f, 1f, 1f, 0f, 1f, 1f), floatArrayOf(0f, 1f, 1f, 1f, 1f, 0f, 0f, 0f), 1.0f)
|
||||
baked.assertFace(Directions.NORTH, floatArrayOf(0f, 0f, 0f, 1f, 0f, 0f, 1f, 1f, 0f, 0f, 1f, 0f), floatArrayOf(1f, 0f, 0f, 0f, 0f, 1f, 1f, 1f), 0.8f)
|
||||
baked.assertFace(Directions.SOUTH, floatArrayOf(0f, 0f, 1f, 0f, 1f, 1f, 1f, 1f, 1f, 1f, 0f, 1f), floatArrayOf(0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f), 0.8f)
|
||||
baked.assertFace(Directions.WEST, floatArrayOf(0f, 0f, 0f, 0f, 1f, 0f, 0f, 1f, 1f, 0f, 0f, 1f), floatArrayOf(0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f), 0.6f)
|
||||
baked.assertFace(Directions.EAST, floatArrayOf(1f, 0f, 0f, 1f, 0f, 1f, 1f, 1f, 1f, 1f, 1f, 0f), floatArrayOf(1f, 0f, 0f, 0f, 0f, 1f, 1f, 1f), 0.6f)
|
||||
}
|
||||
|
||||
fun y90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user