new skybox drawing wip

This commit is contained in:
minjaesong
2019-12-10 15:24:05 +09:00
parent 75dad8a78c
commit 01783387ad
16 changed files with 91 additions and 57 deletions

View File

@@ -660,8 +660,8 @@ internal object BlocksDrawer {
var tilesInVertical = -1; private set
fun resize(screenW: Int, screenH: Int) {
tilesInHorizontal = (screenW.toFloat() / TILE_SIZE).ceilInt() + 1
tilesInVertical = (screenH.toFloat() / TILE_SIZE).ceilInt() + 1
tilesInHorizontal = (AppLoader.screenWf / TILE_SIZE).ceilInt() + 1
tilesInVertical = (AppLoader.screenHf / TILE_SIZE).ceilInt() + 1
val oldTH = (oldScreenW.toFloat() / TILE_SIZE).ceilInt() + 1
val oldTV = (oldScreenH.toFloat() / TILE_SIZE).ceilInt() + 1
@@ -687,9 +687,9 @@ internal object BlocksDrawer {
tilesQuad.setVertices(floatArrayOf( // WARNING! not ususal quads; TexCoords of Y is flipped
0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f, 0f,
screenW.toFloat(), 0f, 0f, 1f, 1f, 1f, 1f, 1f, 0f,
screenW.toFloat(), screenH.toFloat(), 0f, 1f, 1f, 1f, 1f, 1f, 1f,
0f, screenH.toFloat(), 0f, 1f, 1f, 1f, 1f, 0f, 1f
AppLoader.screenWf, 0f, 0f, 1f, 1f, 1f, 1f, 1f, 0f,
AppLoader.screenWf, AppLoader.screenHf, 0f, 1f, 1f, 1f, 1f, 1f, 1f,
0f, AppLoader.screenHf, 0f, 1f, 1f, 1f, 1f, 0f, 1f
))
tilesQuad.setIndices(shortArrayOf(0, 1, 2, 2, 3, 0))
}

View File

@@ -756,8 +756,8 @@ object LightmapRenderer {
// copied from BlocksDrawer, duh!
// FIXME 'lightBuffer' is not zoomable in this way
val tilesInHorizontal = (screenW.toFloat() / TILE_SIZE).ceilInt() + 1
val tilesInVertical = (screenH.toFloat() / TILE_SIZE).ceilInt() + 1
val tilesInHorizontal = (AppLoader.screenWf / TILE_SIZE).ceilInt() + 1
val tilesInVertical = (AppLoader.screenHf / TILE_SIZE).ceilInt() + 1
LIGHTMAP_WIDTH = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenW).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
LIGHTMAP_HEIGHT = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenH).div(TILE_SIZE).ceil() + overscan_open * 2 + 3