mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
removing branching on tiling shader, improving performance
Now tga export needs extra care, but boy that 5 FPS improvement
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Air tile (tile 0,0) must have colour of 0x00000000, NOT 0xFFFFFF00. You can modify the tga file directly to correct bad exporter behaviour.
|
||||
Binary file not shown.
@@ -23,14 +23,11 @@ uniform sampler2D backgroundTexture;
|
||||
|
||||
uniform ivec2 tilesInAtlas = ivec2(256, 256);
|
||||
uniform ivec2 atlasTexSize = ivec2(4096, 4096);
|
||||
ivec2 tileSizeInPx = atlasTexSize / tilesInAtlas;
|
||||
|
||||
uniform vec4 colourFilter = vec4(1, 1, 1, 1);
|
||||
|
||||
uniform ivec2 cameraTranslation = ivec2(0, 0);
|
||||
uniform int tileSizeInPx = 16;
|
||||
|
||||
|
||||
vec4 nocolour = vec4(0,0,0,0);
|
||||
|
||||
|
||||
ivec2 getTileXY(int tileNumber) {
|
||||
@@ -75,8 +72,10 @@ void main() {
|
||||
// TODO blend a breakage (0xrrggbb where 0xr0 -- upper 4 bits of int_red component)
|
||||
|
||||
|
||||
if (tileXY.x == 0 && tileXY.y == 0)
|
||||
// if statements considered harmful
|
||||
// --definitely not Dijkstra
|
||||
/*if (tileXY.x == 0 && tileXY.y == 0)
|
||||
gl_FragColor = nocolour;
|
||||
else
|
||||
else*/
|
||||
gl_FragColor = colourFilter * texture2D(tilesAtlas, finalUVCoordForTile);
|
||||
}
|
||||
|
||||
@@ -108,4 +108,8 @@ object AVKey {
|
||||
|
||||
const val HEALTH = "health"
|
||||
const val MAGIC = "magic"
|
||||
|
||||
|
||||
const val __HISTORICAL_BORNTIME = "__borntime" // time_t
|
||||
const val __HISTORICAL_DEADTIME = "__deadtime" // time_t
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user