mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 10:25:06 -04:00
fix some uvlock issues
This commit is contained in:
parent
b54bf50cef
commit
3840519d44
@ -13,7 +13,6 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.models
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.minosoft.data.direction.Directions
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
||||
@ -162,12 +161,12 @@ class BlockModelTest {
|
||||
from = Vec3(0, 0, 0),
|
||||
to = Vec3(1, 1, 1),
|
||||
faces = mapOf(
|
||||
Directions.DOWN to ModelFace("#down", FaceUV(Vec2(0, 1), Vec2(1, 0)), 0, -1),
|
||||
Directions.UP to ModelFace("#up", FaceUV(Vec2(0, 1), Vec2(1, 0)), 0, -1),
|
||||
Directions.NORTH to ModelFace("#north", FaceUV(Vec2(0, 1), Vec2(1, 0)), 0, -1),
|
||||
Directions.SOUTH to ModelFace("#south", FaceUV(Vec2(0, 1), Vec2(1, 0)), 0, -1),
|
||||
Directions.WEST to ModelFace("#west", FaceUV(Vec2(0, 1), Vec2(1, 0)), 0, -1),
|
||||
Directions.EAST to ModelFace("#east", FaceUV(Vec2(0, 1), Vec2(1, 0)), 0, -1),
|
||||
Directions.DOWN to ModelFace("#down", null, 0, -1),
|
||||
Directions.UP to ModelFace("#up", null, 0, -1),
|
||||
Directions.NORTH to ModelFace("#north", null, 0, -1),
|
||||
Directions.SOUTH to ModelFace("#south", null, 0, -1),
|
||||
Directions.WEST to ModelFace("#west", null, 0, -1),
|
||||
Directions.EAST to ModelFace("#east", null, 0, -1),
|
||||
),
|
||||
shade = true,
|
||||
rotation = null,
|
||||
|
@ -13,14 +13,12 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.models.baked
|
||||
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.forceSet
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.assets.MemoryAssetsManager
|
||||
import de.bixilon.minosoft.data.direction.Directions
|
||||
import de.bixilon.minosoft.gui.rendering.Rendering
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.element.face.ModelFace
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.element.face.ModelFace.Companion.fallbackUV
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.BakedModel
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.TextureManager
|
||||
import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
|
||||
@ -43,11 +41,11 @@ object BakedModelTestUtil {
|
||||
return rendering.context.textures
|
||||
}
|
||||
|
||||
fun createFaces(from: Vec3, to: Vec3, rotation: Int = 0, texture: String = "#test"): Map<Directions, ModelFace> {
|
||||
fun createFaces(rotation: Int = 0, texture: String = "#test"): Map<Directions, ModelFace> {
|
||||
val map: MutableMap<Directions, ModelFace> = mutableMapOf()
|
||||
|
||||
for (direction in Directions) {
|
||||
map[direction] = ModelFace(texture, fallbackUV(direction, from, to), rotation = rotation)
|
||||
map[direction] = ModelFace(texture, null, rotation = rotation)
|
||||
}
|
||||
|
||||
return map
|
||||
|
@ -36,7 +36,7 @@ class CuboidBakeTest {
|
||||
val from = Vec3(6, 0, 6) / BLOCK_SIZE
|
||||
val to = Vec3(10, 16, 16) / BLOCK_SIZE
|
||||
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
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"))!!
|
||||
|
||||
@ -52,7 +52,7 @@ class CuboidBakeTest {
|
||||
fun cuboidY90_1() {
|
||||
val from = Vec3(1, 0, 0) / BLOCK_SIZE
|
||||
val to = Vec3(16, 16, 16) / BLOCK_SIZE
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -68,7 +68,7 @@ class CuboidBakeTest {
|
||||
fun cuboidY90() {
|
||||
val from = Vec3(1, 2, 3) / BLOCK_SIZE
|
||||
val to = Vec3(16, 15, 14) / BLOCK_SIZE
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -84,7 +84,7 @@ class CuboidBakeTest {
|
||||
fun x90y90() {
|
||||
val from = Vec3(1, 2, 3) / BLOCK_SIZE
|
||||
val to = Vec3(16, 15, 14) / BLOCK_SIZE
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
|
@ -37,7 +37,7 @@ class FaceRotationTest {
|
||||
fun rotation1() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to, rotation = 1))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(rotation = 1))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -54,7 +54,7 @@ class FaceRotationTest {
|
||||
fun rotation1Y90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to, rotation = 1))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(rotation = 1))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -71,7 +71,7 @@ class FaceRotationTest {
|
||||
fun rotation3() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to, rotation = 3))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(rotation = 3))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
|
@ -37,7 +37,7 @@ class FullCubeBakeTest {
|
||||
fun cube() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
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"))!!
|
||||
|
||||
@ -53,7 +53,7 @@ class FullCubeBakeTest {
|
||||
fun y90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -70,7 +70,7 @@ class FullCubeBakeTest {
|
||||
fun y180() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), y = 2)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), y = 2)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -87,7 +87,7 @@ class FullCubeBakeTest {
|
||||
fun y270() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), y = 3)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), y = 3)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -104,7 +104,7 @@ class FullCubeBakeTest {
|
||||
fun x90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -120,7 +120,7 @@ class FullCubeBakeTest {
|
||||
fun x180() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 2)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 2)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -136,7 +136,7 @@ class FullCubeBakeTest {
|
||||
fun x270() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 3)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 3)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -152,7 +152,7 @@ class FullCubeBakeTest {
|
||||
fun x90y90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -168,7 +168,7 @@ class FullCubeBakeTest {
|
||||
fun x90y180() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 2)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 2)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -184,7 +184,7 @@ class FullCubeBakeTest {
|
||||
fun x90y270() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 3)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 3)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -200,7 +200,7 @@ class FullCubeBakeTest {
|
||||
fun x180y90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 2, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 2, y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -216,7 +216,7 @@ class FullCubeBakeTest {
|
||||
fun x180y180() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 2, y = 2)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 2, y = 2)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -232,7 +232,7 @@ class FullCubeBakeTest {
|
||||
fun x180y270() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 2, y = 3)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 2, y = 3)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -248,7 +248,7 @@ class FullCubeBakeTest {
|
||||
fun x270y90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 3, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 3, y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -264,7 +264,7 @@ class FullCubeBakeTest {
|
||||
fun x270y180() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 3, y = 2)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 3, y = 2)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -280,7 +280,7 @@ class FullCubeBakeTest {
|
||||
fun x270y270() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 3, y = 3)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 3, y = 3)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
|
@ -51,7 +51,7 @@ class LightIndexTest {
|
||||
fun cube() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
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"))!!
|
||||
|
||||
@ -63,7 +63,7 @@ class LightIndexTest {
|
||||
fun smallerCube() {
|
||||
val from = Vec3(0.1f)
|
||||
val to = Vec3(0.9f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
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"))!!
|
||||
|
||||
@ -75,7 +75,7 @@ class LightIndexTest {
|
||||
fun rotatedCube() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -87,7 +87,7 @@ class LightIndexTest {
|
||||
fun smallerCubeOddSize() {
|
||||
val from = Vec3(0.1f, 0.0f, 0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
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"))!!
|
||||
|
||||
@ -102,7 +102,7 @@ class LightIndexTest {
|
||||
fun smallerCubeOddSizeRotated() {
|
||||
val from = Vec3(0.1f, 0.0f, 0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
|
@ -38,7 +38,7 @@ class UVLockTest {
|
||||
fun y90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1, uvLock = true)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), y = 1, uvLock = true)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -53,7 +53,7 @@ class UVLockTest {
|
||||
fun y90Rotation1() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to, rotation = 1))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1, uvLock = true)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(rotation = 1))), textures = mapOf("test" to minecraft("block/test").texture())), y = 1, uvLock = true)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -68,7 +68,7 @@ class UVLockTest {
|
||||
fun x90() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, uvLock = true)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, uvLock = true)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -84,7 +84,7 @@ class UVLockTest {
|
||||
fun `half cube without rotation`() {
|
||||
val from = Vec3(0.0f, 0.5f, 0.0f)
|
||||
val to = Vec3(1.0f, 1.0f, 0.5f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), uvLock = true)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), uvLock = true)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -95,7 +95,7 @@ class UVLockTest {
|
||||
fun `half cube with y=90`() {
|
||||
val from = Vec3(0.0f, 0.5f, 0.0f)
|
||||
val to = Vec3(1.0f, 1.0f, 0.5f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), uvLock = true, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), uvLock = true, y = 1)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
@ -106,11 +106,11 @@ class UVLockTest {
|
||||
fun `half cube with y=270`() {
|
||||
val from = Vec3(0.0f, 0.5f, 0.0f)
|
||||
val to = Vec3(1.0f, 1.0f, 0.5f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), uvLock = true, y = 3)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), uvLock = true, y = 3)
|
||||
|
||||
val baked = model.bake(createTextureManager("block/test"))!!
|
||||
|
||||
baked.assertFace(Directions.DOWN, positions(Directions.DOWN, from, Vec3(0.5f, 1.0f, 1.0f)), block(0, 16, 0, 0, 8, 0, 8, 16), 0.5f)
|
||||
baked.assertFace(Directions.UP, positions(Directions.UP, from, Vec3(0.5f, 1.0f, 1.0f)), block(0, 0, 8, 0, 8, 16, 16, 0), 1.0f)
|
||||
baked.assertFace(Directions.UP, positions(Directions.UP, from, Vec3(0.5f, 1.0f, 1.0f)), block(0, 0, 8, 0, 8, 16, 0, 16), 1.0f)
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import de.bixilon.minosoft.gui.rendering.models.block.state.apply.WeightedBlockS
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.BakedModel
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.state.render.WeightedBlockRender
|
||||
import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
|
||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.EMPTY
|
||||
import org.testng.Assert.assertEquals
|
||||
import org.testng.annotations.Test
|
||||
import java.util.*
|
||||
@ -88,9 +87,9 @@ class WeightedModelTest {
|
||||
}
|
||||
|
||||
|
||||
private val A = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(1), Vec3(10), faces = createFaces(Vec3.EMPTY, Vec3.EMPTY))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
private val B = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(2), Vec3(10), faces = createFaces(Vec3.EMPTY, Vec3.EMPTY))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
private val C = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(3), Vec3(10), faces = createFaces(Vec3.EMPTY, Vec3.EMPTY))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
private val D = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(4), Vec3(10), faces = createFaces(Vec3.EMPTY, Vec3.EMPTY))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
private val A = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(1), Vec3(10), faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
private val B = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(2), Vec3(10), faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
private val C = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(3), Vec3(10), faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
private val D = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(Vec3(4), Vec3(10), faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class XRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.DOWN to createFaces(from, to)[Directions.DOWN]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.DOWN to createFaces()[Directions.DOWN]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -51,7 +51,7 @@ class XRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.UP to createFaces(from, to)[Directions.UP]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.UP to createFaces()[Directions.UP]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -65,7 +65,7 @@ class XRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.NORTH to createFaces(from, to)[Directions.NORTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.NORTH to createFaces()[Directions.NORTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -79,7 +79,7 @@ class XRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.SOUTH to createFaces(from, to)[Directions.SOUTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.SOUTH to createFaces()[Directions.SOUTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -93,7 +93,7 @@ class XRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.WEST to createFaces(from, to)[Directions.WEST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.WEST to createFaces()[Directions.WEST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -109,7 +109,7 @@ class XRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.EAST to createFaces(from, to)[Directions.EAST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.EAST to createFaces()[Directions.EAST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), x = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class XYRotationTest {
|
||||
val from = Vec3(6, 0, 6) / ModelElement.BLOCK_SIZE
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 1)
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
baked.assertFace(Directions.DOWN, block(0, 6, 6, 0, 6, 10, 16, 6, 10, 16, 6, 6))
|
||||
@ -49,7 +49,7 @@ class XYRotationTest {
|
||||
val from = Vec3(6, 0, 6) / ModelElement.BLOCK_SIZE
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 3)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = createFaces())), textures = mapOf("test" to minecraft("block/test").texture())), x = 1, y = 3)
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
baked.assertFace(Directions.DOWN, block(0, 6, 6, 0, 6, 10, 16, 6, 10, 16, 6, 6))
|
||||
|
@ -37,7 +37,7 @@ class YRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.DOWN to createFaces(from, to)[Directions.DOWN]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.DOWN to createFaces()[Directions.DOWN]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -54,7 +54,7 @@ class YRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.UP to createFaces(from, to)[Directions.UP]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.UP to createFaces()[Directions.UP]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -71,7 +71,7 @@ class YRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.NORTH to createFaces(from, to)[Directions.NORTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.NORTH to createFaces()[Directions.NORTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -88,7 +88,7 @@ class YRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.SOUTH to createFaces(from, to)[Directions.SOUTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.SOUTH to createFaces()[Directions.SOUTH]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -105,7 +105,7 @@ class YRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.WEST to createFaces(from, to)[Directions.WEST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.WEST to createFaces()[Directions.WEST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
@ -122,7 +122,7 @@ class YRotationTest {
|
||||
val to = Vec3(10, 16, 16) / ModelElement.BLOCK_SIZE
|
||||
|
||||
fun bake(rotation: Int): BakedModel {
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.EAST to createFaces(from, to)[Directions.EAST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = mapOf(Directions.EAST to createFaces()[Directions.EAST]!!))), textures = mapOf("test" to minecraft("block/test").texture())), y = rotation)
|
||||
|
||||
return model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class FacePropertiesTest {
|
||||
fun fullBlock() {
|
||||
val from = Vec3(0.0f)
|
||||
val to = Vec3(1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
@ -50,7 +50,7 @@ class FacePropertiesTest {
|
||||
fun lowerSlab() {
|
||||
val from = Vec3(0.0f, 0.0f, 0.0f)
|
||||
val to = Vec3(1.0f, 0.5f, 1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
@ -65,7 +65,7 @@ class FacePropertiesTest {
|
||||
fun upperSlab() {
|
||||
val from = Vec3(0.0f, 0.5f, 0.0f)
|
||||
val to = Vec3(1.0f, 1.0f, 1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
@ -80,7 +80,7 @@ class FacePropertiesTest {
|
||||
fun northSlab() {
|
||||
val from = Vec3(0.0f, 0.0f, 0.0f)
|
||||
val to = Vec3(1.0f, 1.0f, 0.5f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
@ -96,7 +96,7 @@ class FacePropertiesTest {
|
||||
fun southSlab() {
|
||||
val from = Vec3(0.0f, 0.0f, 0.5f)
|
||||
val to = Vec3(1.0f, 1.0f, 1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
@ -112,7 +112,7 @@ class FacePropertiesTest {
|
||||
fun westSlab() {
|
||||
val from = Vec3(0.0f, 0.0f, 0.0f)
|
||||
val to = Vec3(0.5f, 1.0f, 1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
@ -128,7 +128,7 @@ class FacePropertiesTest {
|
||||
fun eastSlab() {
|
||||
val from = Vec3(0.5f, 0.0f, 0.0f)
|
||||
val to = Vec3(1.0f, 1.0f, 1.0f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
@ -144,7 +144,7 @@ class FacePropertiesTest {
|
||||
fun `mini cube`() {
|
||||
val from = Vec3(0.1f, 0.2f, 0.3f)
|
||||
val to = Vec3(0.7f, 0.8f, 0.9f)
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces(from, to))), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
val model = SingleBlockStateApply(BlockModel(elements = listOf(ModelElement(from, to, faces = BakedModelTestUtil.createFaces())), textures = mapOf("test" to minecraft("block/test").texture())))
|
||||
|
||||
val baked = model.bake(BakedModelTestUtil.createTextureManager("block/test"))!!
|
||||
|
||||
|
@ -34,7 +34,7 @@ import java.util.*
|
||||
|
||||
data class ModelFace(
|
||||
val texture: String,
|
||||
val uv: FaceUV,
|
||||
val uv: FaceUV?,
|
||||
val rotation: Int,
|
||||
val tintIndex: Int = -1,
|
||||
) {
|
||||
@ -58,19 +58,6 @@ data class ModelFace(
|
||||
|
||||
companion object {
|
||||
|
||||
fun fallbackUV(direction: Directions, from: Vec3, to: Vec3): FaceUV {
|
||||
return when (direction) {
|
||||
// @formatter:off
|
||||
Directions.DOWN -> FaceUV(from.x, 1.0f - from.z, to.x, 1.0f - to.z)
|
||||
Directions.UP -> FaceUV(from.x, to.z, to.x, from.z )
|
||||
Directions.NORTH -> FaceUV(1.0f - to.x, 1.0f - from.y, 1.0f - from.x, 1.0f - to.y)
|
||||
Directions.SOUTH -> FaceUV(from.x, 1.0f - from.y, to.x, 1.0f - to.y)
|
||||
Directions.WEST -> FaceUV(from.z, 1.0f - from.y, to.z, 1.0f - to.y)
|
||||
Directions.EAST -> FaceUV(1.0f - to.z, 1.0f - from.y, 1.0f - from.z, 1.0f - to.y)
|
||||
// @formatter:on
|
||||
}
|
||||
}
|
||||
|
||||
fun deserialize(direction: Directions, from: Vec3, to: Vec3, data: JsonObject): ModelFace {
|
||||
val texture = data["texture"].toString()
|
||||
|
||||
@ -80,7 +67,7 @@ data class ModelFace(
|
||||
start = Vec2(it[0], it[3].toFloat()) / BLOCK_SIZE,
|
||||
end = Vec2(it[2], it[1].toFloat()) / BLOCK_SIZE,
|
||||
)
|
||||
} ?: fallbackUV(direction, from, to)
|
||||
}
|
||||
|
||||
val rotation = data["rotation"]?.toInt()?.rotation() ?: 0
|
||||
val tintIndex = data["tintindex"]?.toInt() ?: TintManager.DEFAULT_TINT_INDEX
|
||||
|
@ -14,6 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.models.block.state.apply
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.kutil.exception.Broken
|
||||
import de.bixilon.kutil.json.JsonObject
|
||||
import de.bixilon.kutil.primitive.BooleanUtil.toBoolean
|
||||
@ -23,6 +24,7 @@ import de.bixilon.minosoft.data.direction.DirectionUtil.rotateX
|
||||
import de.bixilon.minosoft.data.direction.DirectionUtil.rotateY
|
||||
import de.bixilon.minosoft.data.direction.Directions
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.BlockModel
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.element.face.FaceUV
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.BakedFace
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.BakedModel
|
||||
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.BakingUtil.compact
|
||||
@ -166,7 +168,9 @@ data class SingleBlockStateApply(
|
||||
.rotateY(direction.rotateX(this.x))
|
||||
|
||||
|
||||
var uv = face.uv.toArray(rotatedDirection, face.rotation)
|
||||
val abc = face.uv ?: if (uvLock) fallbackUV(rotatedDirection, positions.start(), positions.end()) else fallbackUV(direction, element.from, element.to)
|
||||
|
||||
var uv = abc.toArray(rotatedDirection, face.rotation)
|
||||
|
||||
if (!uvLock) {
|
||||
val rotation = getTextureRotation(direction, rotatedDirection)
|
||||
@ -185,6 +189,14 @@ data class SingleBlockStateApply(
|
||||
return BakedModel(bakedFaces.compact(), properties.compactProperties(), null) // TODO
|
||||
}
|
||||
|
||||
private fun FloatArray.start(): Vec3 {
|
||||
return Vec3(this[0], this[1], this[2])
|
||||
}
|
||||
|
||||
private fun FloatArray.end(): Vec3 {
|
||||
return Vec3(this[6], this[7], this[8])
|
||||
}
|
||||
|
||||
fun FloatArray.properties(direction: Directions, texture: Texture): FaceProperties? {
|
||||
// TODO: Bad code?
|
||||
|
||||
@ -240,5 +252,18 @@ data class SingleBlockStateApply(
|
||||
Directions.NORTH, Directions.SOUTH -> 0.8f
|
||||
Directions.WEST, Directions.EAST -> 0.6f
|
||||
}
|
||||
|
||||
fun fallbackUV(direction: Directions, from: Vec3, to: Vec3): FaceUV {
|
||||
return when (direction) {
|
||||
// @formatter:off
|
||||
Directions.DOWN -> FaceUV(from.x, 1.0f - from.z, to.x, 1.0f - to.z)
|
||||
Directions.UP -> FaceUV(from.x, to.z, to.x, from.z )
|
||||
Directions.NORTH -> FaceUV(1.0f - to.x, 1.0f - from.y, 1.0f - from.x, 1.0f - to.y)
|
||||
Directions.SOUTH -> FaceUV(from.x, 1.0f - from.y, to.x, 1.0f - to.y)
|
||||
Directions.WEST -> FaceUV(from.z, 1.0f - from.y, to.z, 1.0f - to.y)
|
||||
Directions.EAST -> FaceUV(1.0f - to.z, 1.0f - from.y, 1.0f - from.z, 1.0f - to.y)
|
||||
// @formatter:on
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user