mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
See Github issue #15
This commit is contained in:
@@ -1 +1,3 @@
|
||||
Air tile (tile 0,0) must have colour of 0x00000000, NOT 0xFFFFFF00. You can modify the tga file directly to correct bad exporter behaviour.
|
||||
Air tile (tile 0,0) must have colour of 0x00000000, NOT 0xFFFFFF00. You can modify the tga file directly to correct bad exporter behaviour.
|
||||
|
||||
All TGA must have alpha premultiplied.
|
||||
@@ -1,5 +1,6 @@
|
||||
"id";"drop";"name" ; "shdr"; "shdg"; "shdb"; "shduv";"str";"dsty";"mate";"solid";"plat";"clear";"wall";"fall";"dlfn";"vscs";"fv";"fr"; "lumr"; "lumg"; "lumb"; "lumuv"
|
||||
"0"; "0";"BLOCK_AIR" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "1";"NULL"; "0"; "0"; "1"; "1"; "0"; "0"; "N/A"; "0"; "4";"0.0000";"0.0000";"0.0000";"0.0000"
|
||||
"1"; "1";"BLOCK_MIASMA" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "1";"NULL"; "0"; "0"; "1"; "1"; "0"; "0"; "N/A"; "0"; "4";"0.0000";"0.0000";"0.0000";"0.0000"
|
||||
"16"; "17";"BLOCK_STONE" ;"0.1252";"0.1252";"0.1252";"0.1252"; "48";"2400";"ROCK"; "1"; "0"; "0"; "1"; "0"; "0"; "N/A"; "4";"16";"0.0000";"0.0000";"0.0000";"0.0000"
|
||||
"17"; "17";"BLOCK_STONE_QUARRIED" ;"0.1252";"0.1252";"0.1252";"0.1252"; "48";"2400";"ROCK"; "1"; "0"; "0"; "1"; "0"; "0"; "N/A"; "4";"16";"0.0000";"0.0000";"0.0000";"0.0000"
|
||||
"18"; "18";"BLOCK_STONE_TILE_WHITE" ;"0.1252";"0.1252";"0.1252";"0.1252"; "48";"2400";"ROCK"; "1"; "0"; "0"; "1"; "0"; "0"; "N/A"; "4";"16";"0.0000";"0.0000";"0.0000";"0.0000"
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 20.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/gdx-nightly-20190112.zip
Normal file
BIN
lib/gdx-nightly-20190112.zip
Normal file
Binary file not shown.
BIN
lib/gdx.jar
BIN
lib/gdx.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -157,7 +157,7 @@ public class AppLoader implements ApplicationListener {
|
||||
ShaderProgram.pedantic = false;
|
||||
|
||||
LwjglApplicationConfiguration appConfig = new LwjglApplicationConfiguration();
|
||||
appConfig.useGL30 = true;
|
||||
//appConfig.useGL30 = true; // used: loads GL 3.2, unused: loads GL 4.6; what the fuck?
|
||||
appConfig.vSyncEnabled = false;
|
||||
appConfig.resizable = false;//true;
|
||||
//appConfig.width = 1072; // IMAX ratio
|
||||
|
||||
@@ -577,26 +577,25 @@ fun SpriteBatch.drawStraightLine(x: Float, y: Float, otherEnd: Float, thickness:
|
||||
infix fun Color.mul(other: Color): Color = this.cpy().mul(other)
|
||||
|
||||
|
||||
|
||||
/*inline fun Color.toRGB10(): RGB10 {
|
||||
val bits = this.toIntBits() // ABGR
|
||||
// 0bxxRRRRRRRRRRGGGGGGGGGGBBBBBBBBBB
|
||||
// 0bAAAAAAAABBBBBBBBGGGGGGGGRRRRRRRR
|
||||
return bits.and(0x0000FF).shl(20) or bits.and(0x00FF00).shl(2) or bits.and(0xFF0000).ushr(16)
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
fun blendMul(batch: SpriteBatch? = null) {
|
||||
// will break if the colour image contains semitransparency
|
||||
(batch ?: Terrarum.batch).enableBlending()
|
||||
(batch ?: Terrarum.batch).setBlendFunction(GL20.GL_DST_COLOR, GL20.GL_ONE_MINUS_SRC_ALPHA)
|
||||
Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD) // batch.flush does not touch blend equation
|
||||
}
|
||||
|
||||
fun blendScreen(batch: SpriteBatch? = null) {
|
||||
// will break if the colour image contains semitransparency
|
||||
(batch ?: Terrarum.batch).enableBlending()
|
||||
(batch ?: Terrarum.batch).setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR)
|
||||
}
|
||||
|
||||
fun blendDisable(batch: SpriteBatch? = null) {
|
||||
(batch ?: Terrarum.batch).disableBlending()
|
||||
}
|
||||
|
||||
fun blendNormal(batch: SpriteBatch? = null) {
|
||||
(batch ?: Terrarum.batch).enableBlending()
|
||||
(batch ?: Terrarum.batch).setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)
|
||||
(batch ?: Terrarum.batch).setBlendFunctionSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_SRC_ALPHA, GL20.GL_ONE)
|
||||
|
||||
// ALPHA *MUST BE* PREMULTIPLIED //
|
||||
|
||||
@@ -613,17 +612,6 @@ fun blendNormal(batch: SpriteBatch? = null) {
|
||||
// - https://www.andersriggelsen.dk/glblendfunc.php
|
||||
}
|
||||
|
||||
fun blendScreen(batch: SpriteBatch? = null) {
|
||||
// will break if the colour image contains semitransparency
|
||||
(batch ?: Terrarum.batch).enableBlending()
|
||||
(batch ?: Terrarum.batch).setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR)
|
||||
Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD) // batch.flush does not touch blend equation
|
||||
}
|
||||
|
||||
fun blendDisable(batch: SpriteBatch? = null) {
|
||||
(batch ?: Terrarum.batch).disableBlending()
|
||||
}
|
||||
|
||||
fun gdxClearAndSetBlend(r: Float, g: Float, b: Float, a: Float) {
|
||||
Gdx.gl.glClearColor(r,g,b,a)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
@@ -637,8 +625,8 @@ fun gdxSetBlend() {
|
||||
|
||||
fun gdxSetBlendNormal() {
|
||||
gdxSetBlend()
|
||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)
|
||||
Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD)
|
||||
Gdx.gl.glBlendFuncSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_SRC_ALPHA, GL20.GL_ONE)
|
||||
//Gdx.gl.glBlendEquationSeparate(GL20.GL_FUNC_ADD, GL30.GL_MAX) // batch.flush does not touch blend equation
|
||||
|
||||
// ALPHA *MUST BE* PREMULTIPLIED //
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ object IngameRenderer {
|
||||
|
||||
// clear main or whatever super-FBO being used
|
||||
//clearBuffer()
|
||||
gdxClearAndSetBlend(.64f, .754f, .84f, 1f)
|
||||
gdxClearAndSetBlend(.64f, .754f, .84f, 0f)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -544,21 +544,21 @@ object IngameRenderer {
|
||||
lightmapFboB.dispose()
|
||||
}
|
||||
|
||||
fboRGB = FrameBuffer(Pixmap.Format.RGBA8888, width, height, false)
|
||||
fboRGB_lightMixed = FrameBuffer(Pixmap.Format.RGBA8888, width, height, false)
|
||||
fboA = FrameBuffer(Pixmap.Format.RGBA8888, width, height, false)
|
||||
fboA_lightMixed = FrameBuffer(Pixmap.Format.RGBA8888, width, height, false)
|
||||
fboRGB = FrameBuffer(Pixmap.Format.RGBA8888, width, height, true)
|
||||
fboRGB_lightMixed = FrameBuffer(Pixmap.Format.RGBA8888, width, height, true)
|
||||
fboA = FrameBuffer(Pixmap.Format.RGBA8888, width, height, true)
|
||||
fboA_lightMixed = FrameBuffer(Pixmap.Format.RGBA8888, width, height, true)
|
||||
lightmapFboA = FrameBuffer(
|
||||
Pixmap.Format.RGBA8888,
|
||||
LightmapRenderer.lightBuffer.width * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
||||
LightmapRenderer.lightBuffer.height * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
||||
false
|
||||
true
|
||||
)
|
||||
lightmapFboB = FrameBuffer(
|
||||
Pixmap.Format.RGBA8888,
|
||||
LightmapRenderer.lightBuffer.width * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
||||
LightmapRenderer.lightBuffer.height * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
||||
false
|
||||
true
|
||||
)
|
||||
|
||||
BlocksDrawer.resize(width, height)
|
||||
|
||||
@@ -190,14 +190,15 @@ object LightmapRenderer {
|
||||
* Updating order:
|
||||
* ,--------. ,--+-----. ,-----+--. ,--------. -
|
||||
* |↘ | | | 3| |3 | | | ↙| ↕︎ overscan_open / overscan_opaque
|
||||
* | +-----+ | | 2 | | 2 | | +-----+ | - depending on the noop_mask
|
||||
* | |1 | → | |1 | → | 1| | → | 1| |
|
||||
* | | 2 | | +-----+ +-----+ | | 2 | |
|
||||
* | ,-----+ | | 2 | | 2 | | +-----. | - depending on the noop_mask
|
||||
* | |1 | | |1 | | 1| | | 1| |
|
||||
* | | 2 | | `-----+ +-----' | | 2 | |
|
||||
* | | 3| |↗ | | ↖| |3 | |
|
||||
* `--+-----' `--------' `--------' `-----+--'
|
||||
* round: 1 2 3 4
|
||||
* for all lightmap[y][x], run in this order: 2-3-4-1
|
||||
* for some reason, this setup removes (or mitigates) directional artefacts.
|
||||
* for all lightmap[y][x], run in this order: 2-3-4-1-2
|
||||
* If you run only 4 sets, orthogonal/diagonal artefacts are bound to occur,
|
||||
* it seems 5-pass is mandatory
|
||||
*/
|
||||
|
||||
AppLoader.debugTimers["Renderer.Lanterns"] = measureNanoTime {
|
||||
@@ -247,11 +248,21 @@ object LightmapRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
// Round 2
|
||||
AppLoader.debugTimers["Renderer.Light5"] = measureNanoTime {
|
||||
for (y in for_y_end + overscan_open downTo for_y_start) {
|
||||
for (x in for_x_start - overscan_open..for_x_end) {
|
||||
setLight(x, y, calculate(x, y, 5))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AppLoader.debugTimers["Renderer.LightSequential"] =
|
||||
(AppLoader.debugTimers["Renderer.Light1"]!! as Long) +
|
||||
(AppLoader.debugTimers["Renderer.Light2"]!! as Long) +
|
||||
(AppLoader.debugTimers["Renderer.Light3"]!! as Long) +
|
||||
(AppLoader.debugTimers["Renderer.Light4"]!! as Long)
|
||||
(AppLoader.debugTimers["Renderer.Light4"]!! as Long) +
|
||||
(AppLoader.debugTimers["Renderer.Light5"]!! as Long)
|
||||
}
|
||||
else {
|
||||
AppLoader.debugTimers["Renderer.LightPre"] = measureNanoTime {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user