diff --git a/assets/mods/basegame/blocks/19.tga b/assets/mods/basegame/blocks/19.tga index fbc78f3d0..2e1019e8c 100644 --- a/assets/mods/basegame/blocks/19.tga +++ b/assets/mods/basegame/blocks/19.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b67f3aaef078c23508ff6a8b5f2e47603659345c17b101885e06e2a5778f6595 -size 50220 +oid sha256:e84dbbc88c88660629548f4f2f9aafdec50d6a85a11f7f0a7479abac7c49b6c5 +size 56594 diff --git a/assets/mods/basegame/blocks/48.tga b/assets/mods/basegame/blocks/48.tga index 1eec854a8..b42a513d4 100644 --- a/assets/mods/basegame/blocks/48.tga +++ b/assets/mods/basegame/blocks/48.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c52df534a06b52464fa524a034df1289d56c10c3530334fd863949cd3606bd4d +oid sha256:1448fae01ad29fb604c16fe823935d4dcbe71b036c189c3073636e5c04829c95 size 56594 diff --git a/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt b/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt index 21f885d06..ab48bbfac 100644 --- a/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt +++ b/src/net/torvald/terrarum/worlddrawer/BlocksDrawer.kt @@ -187,15 +187,26 @@ internal object BlocksDrawer { intArrayOf(0 ,4 ,8 ,9 ,1 ,5 ,6 ,10,2 ,3 ,7 ,11,12,16,15,14,13,20,19,18,17), /* hfCW 270 */ ) // order: TL, TR, BR, BL - private val variantOpsLUT = arrayOf( + private val variantOpsLUT_terr = arrayOf( // newIndex = (oldIndex % A) + B for (a to b) arrayOf(16 to 0,16 to 0,16 to 0,16 to 0), // TILING_FULL arrayOf(16 to 0,16 to 0,16 to 0,16 to 0), // TILING_FULL_NOFLIP arrayOf(8 to 0,8 to 8,8 to 8,8 to 0), // TILING_BRICK_SMALL arrayOf(8 to 0,8 to 8,8 to 8,8 to 0), // TILING_BRICK_SMALL_NOFLIP + arrayOf(8 to 8,8 to 0,8 to 8,8 to 0), // TILING_BRICK_LARGE + arrayOf(8 to 8,8 to 0,8 to 8,8 to 0), // TILING_BRICK_LARGE_NOFLIP + ) + // order: TL, TR, BR, BL + private val variantOpsLUT_wall = arrayOf( + // newIndex = (oldIndex % A) + B for (a to b) + arrayOf(16 to 0,16 to 0,16 to 0,16 to 0), // TILING_FULL + arrayOf(16 to 0,16 to 0,16 to 0,16 to 0), // TILING_FULL_NOFLIP + arrayOf(8 to 8,8 to 0,8 to 0,8 to 8), // TILING_BRICK_SMALL + arrayOf(8 to 8,8 to 0,8 to 0,8 to 8), // TILING_BRICK_SMALL_NOFLIP arrayOf(8 to 0,8 to 8,8 to 0,8 to 8), // TILING_BRICK_LARGE arrayOf(8 to 0,8 to 8,8 to 0,8 to 8), // TILING_BRICK_LARGE_NOFLIP ) + private val variantOpsLUT = arrayOf(variantOpsLUT_terr, variantOpsLUT_wall) init { assert(256 == connectLut47.size) @@ -554,7 +565,7 @@ internal object BlocksDrawer { (hash ushr 22) and 7, (hash ushr 25) and 7, ) - val variantOps = variantOpsLUT[renderTag.tilingMode] + val variantOps = variantOpsLUT[mode][renderTag.tilingMode] val subtiles = getSubtileIndexOf(tileNumberBase, nearbyTilesInfo, hash, subtileSwizzlers, variantOps) /*TL*/writeToBufferSubtile(mode, bufferBaseX * 2 + 0, bufferBaseY * 2 + 0, subtiles[0].x, subtiles[0].y, breakingStage, subtileSwizzlers[0]) @@ -911,8 +922,8 @@ internal object BlocksDrawer { ) } val baseXY = tilenumInAtlas.map { Point2i( - it % (App.tileMaker.TILES_IN_X * 2), - (it / (App.tileMaker.TILES_IN_X * 2)).let { + it % App.tileMaker.SUBTILES_IN_X, + (it / App.tileMaker.SUBTILES_IN_X).let { if (it % 2 == 1) it + 1 else it }, ) } @@ -921,16 +932,20 @@ internal object BlocksDrawer { return (baseXY zip variants).map { (base, va) -> Point2i( base.x + va / 2, base.y + va % 2, - ) }.also { -// println("Base: $base") -// println("Tiles: $it") - } + ).wrapAroundAtlasBySubtile() } } private fun Int.reorientSubtileUsingFliprotIdx(fliprotIndex: Int): Int { return subtileReorientLUT[fliprotIndex][this] } + private fun Point2i.wrapAroundAtlasBySubtile(): Point2i { + return Point2i( + this.x % App.tileMaker.SUBTILES_IN_X, + this.y + 2 * (this.x / App.tileMaker.SUBTILES_IN_X) + ) + } + /** * @param sheetX x-coord of the FULL TILE in an atlas diff --git a/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt b/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt index 37dc5c141..b2acf30aa 100644 --- a/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt +++ b/src/net/torvald/terrarum/worlddrawer/CreateTileAtlas.kt @@ -246,7 +246,7 @@ class CreateTileAtlas { } // test print - PixmapIO2.writeTGA(Gdx.files.absolute("${App.defaultDir}/atlas.tga"), atlas, false) +// PixmapIO2.writeTGA(Gdx.files.absolute("${App.defaultDir}/atlas.tga"), atlas, false) // PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlasGlow.tga"), atlasGlow, false) diff --git a/work_files/graphics/terrain/terrain_variable_subtiling_full.kra b/work_files/graphics/terrain/terrain_variable_subtiling_full.kra index a507c4859..184a9bcfc 100644 --- a/work_files/graphics/terrain/terrain_variable_subtiling_full.kra +++ b/work_files/graphics/terrain/terrain_variable_subtiling_full.kra @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:93f05f4d33d8db208463095fc452eb596d344a6c133dcc5ee95a4e7d90862bf3 -size 617742 +oid sha256:aa6e721591dafeeebf66ab9f8c698c79ef070a88256e2e76c6c501b5d83daf2a +size 634503