mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 05:54:05 +09:00
render is fixed (tile breakage not tested as loading items are still wip); air tile no longer has tilenum of 0
This commit is contained in:
BIN
assets/graphics/blocks/init.tga
LFS
BIN
assets/graphics/blocks/init.tga
LFS
Binary file not shown.
@@ -76,7 +76,7 @@ void main() {
|
|||||||
int tile = getTileFromColor(tileFromMap);
|
int tile = getTileFromColor(tileFromMap);
|
||||||
int breakage = getBreakageFromColor(tileFromMap);
|
int breakage = getBreakageFromColor(tileFromMap);
|
||||||
ivec2 tileXY = getTileXY(tile);
|
ivec2 tileXY = getTileXY(tile);
|
||||||
ivec2 breakageXY = getTileXY(breakage + 5); // +5 is hard-coded constant that depends on the atlas
|
ivec2 breakageXY = getTileXY(breakage + 5); // +5 is hard-coded constant that depends on the contents of the atlas
|
||||||
|
|
||||||
// calculate the UV coord value for texture sampling //
|
// calculate the UV coord value for texture sampling //
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,9 @@ open class GameWorld : Disposable {
|
|||||||
tileNumberToNameMap[it.value.tileNumber] = it.key
|
tileNumberToNameMap[it.value.tileNumber] = it.key
|
||||||
tileNameToNumberMap[it.key] = it.value.tileNumber
|
tileNameToNumberMap[it.key] = it.value.tileNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AN EXCEPTIONAL TERM: tilenum 0 is always redirected to Air tile, even if the tilenum for actual Air tile is not zero
|
||||||
|
tileNumberToNameMap[0] = Block.AIR
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,6 +204,9 @@ open class GameWorld : Disposable {
|
|||||||
// TODO rename wire map
|
// TODO rename wire map
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AN EXCEPTIONAL TERM: tilenum 0 is always redirected to Air tile, even if the tilenum for actual Air tile is not zero
|
||||||
|
tileNumberToNameMap[0] = Block.AIR
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ object CreateTileAtlas {
|
|||||||
|
|
||||||
// 16 tiles are reserved for internal use: solid black, solid white, breakage stages.
|
// 16 tiles are reserved for internal use: solid black, solid white, breakage stages.
|
||||||
// 0th tile is complete transparent tile and is also a BlockID of zero: air.
|
// 0th tile is complete transparent tile and is also a BlockID of zero: air.
|
||||||
private var atlasCursor = 0
|
private var atlasCursor = 64 // 64 predefined tiles. The normal blocks (e.g. Air) should start from this number
|
||||||
private val atlasInit = "./assets/graphics/blocks/init.tga"
|
private val atlasInit = "./assets/graphics/blocks/init.tga"
|
||||||
private var itemSheetCursor = 16
|
private var itemSheetCursor = 16
|
||||||
|
|
||||||
@@ -86,6 +86,14 @@ object CreateTileAtlas {
|
|||||||
atlasFluid.blending = Pixmap.Blending.None
|
atlasFluid.blending = Pixmap.Blending.None
|
||||||
atlasGlow.blending = Pixmap.Blending.None
|
atlasGlow.blending = Pixmap.Blending.None
|
||||||
|
|
||||||
|
// populate the atlantes with atlasInit
|
||||||
|
// this just directly copies the image to the atlantes :p
|
||||||
|
val initPixmap = Pixmap(Gdx.files.internal(atlasInit))
|
||||||
|
atlas.drawPixmap(initPixmap, 0, 0)
|
||||||
|
atlasAutumn.drawPixmap(initPixmap, 0, 0)
|
||||||
|
atlasWinter.drawPixmap(initPixmap, 0, 0)
|
||||||
|
atlasSpring.drawPixmap(initPixmap, 0, 0)
|
||||||
|
|
||||||
// get all the files applicable
|
// get all the files applicable
|
||||||
// first, get all the '/blocks' directory, and add all the files, regardless of their extension, to the list
|
// first, get all the '/blocks' directory, and add all the files, regardless of their extension, to the list
|
||||||
val tgaList = ArrayList<Pair<String, FileHandle>>() //Pair of <modname, filehandle>
|
val tgaList = ArrayList<Pair<String, FileHandle>>() //Pair of <modname, filehandle>
|
||||||
@@ -192,6 +200,7 @@ object CreateTileAtlas {
|
|||||||
itemWallTexture = Texture(itemWallPixmap)
|
itemWallTexture = Texture(itemWallPixmap)
|
||||||
itemTerrainPixmap.dispose()
|
itemTerrainPixmap.dispose()
|
||||||
itemWallPixmap.dispose()
|
itemWallPixmap.dispose()
|
||||||
|
initPixmap.dispose()
|
||||||
|
|
||||||
initialised = true
|
initialised = true
|
||||||
} }
|
} }
|
||||||
|
|||||||
Reference in New Issue
Block a user