mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
fixed bad color rendering on blocksdrawer and lightmaprenderer
This commit is contained in:
@@ -352,8 +352,7 @@ object BlocksDrawer {
|
||||
*/
|
||||
blendNormal()
|
||||
|
||||
batch.color = wallOverlayColour
|
||||
drawTiles(batch, WALL, false)
|
||||
drawTiles(batch, WALL, false, wallOverlayColour)
|
||||
}
|
||||
|
||||
fun renderTerrain(batch: SpriteBatch) {
|
||||
@@ -362,8 +361,7 @@ object BlocksDrawer {
|
||||
*/
|
||||
blendNormal()
|
||||
|
||||
batch.color = Color.WHITE
|
||||
drawTiles(batch, TERRAIN, false) // regular tiles
|
||||
drawTiles(batch, TERRAIN, false, Color.WHITE) // regular tiles
|
||||
}
|
||||
|
||||
fun renderFront(batch: SpriteBatch, drawWires: Boolean) {
|
||||
@@ -372,11 +370,10 @@ object BlocksDrawer {
|
||||
*/
|
||||
blendMul()
|
||||
|
||||
batch.color = Color.WHITE
|
||||
drawTiles(batch, TERRAIN, true) // blendmul tiles
|
||||
drawTiles(batch, TERRAIN, true, Color.WHITE) // blendmul tiles
|
||||
|
||||
if (drawWires) {
|
||||
drawTiles(batch, WIRE, false)
|
||||
drawTiles(batch, WIRE, false, Color.WHITE)
|
||||
}
|
||||
|
||||
blendNormal()
|
||||
@@ -384,7 +381,7 @@ object BlocksDrawer {
|
||||
|
||||
private val tileDrawLightThreshold = 2
|
||||
|
||||
private fun drawTiles(batch: SpriteBatch, mode: Int, drawModeTilesBlendMul: Boolean) {
|
||||
private fun drawTiles(batch: SpriteBatch, mode: Int, drawModeTilesBlendMul: Boolean, color: Color) {
|
||||
val for_y_start = y / TILE_SIZE
|
||||
val for_y_end = BlocksDrawer.clampHTile(for_y_start + (height / TILE_SIZE) + 2)
|
||||
|
||||
@@ -393,6 +390,8 @@ object BlocksDrawer {
|
||||
|
||||
var zeroTileCounter = 0
|
||||
|
||||
batch.color = color
|
||||
|
||||
// loop
|
||||
for (y in for_y_start..for_y_end) {
|
||||
for (x in for_x_start..for_x_end - 1) {
|
||||
@@ -490,7 +489,7 @@ object BlocksDrawer {
|
||||
|
||||
batch.fillRect(x.toFloat(), y.toFloat(), TILE_SIZEF, TILE_SIZEF)
|
||||
|
||||
batch.color = Color.WHITE
|
||||
batch.color = color
|
||||
}
|
||||
} // end if (not an air)
|
||||
} catch (e: NullPointerException) {
|
||||
|
||||
@@ -320,6 +320,8 @@ object LightmapRenderer {
|
||||
val this_y_end = for_y_end// + overscan_open
|
||||
|
||||
|
||||
val originalColour = batch.color.cpy()
|
||||
|
||||
// draw to the
|
||||
try {
|
||||
// loop for "scanlines"
|
||||
@@ -329,7 +331,7 @@ object LightmapRenderer {
|
||||
while (x < this_x_end) {
|
||||
// smoothing enabled and zoom is 0.75 or greater
|
||||
// (zoom of 0.5 should not smoothed, for performance)
|
||||
if (TerrarumGDX.getConfigBoolean("smoothlighting") ?: false &&
|
||||
if (TerrarumGDX.getConfigBoolean("smoothlighting") &&
|
||||
TerrarumGDX.ingame!!.screenZoom >= 0.75) {
|
||||
|
||||
val thisLightLevel = getLightForOpaque(x, y) ?: 0
|
||||
@@ -435,6 +437,8 @@ object LightmapRenderer {
|
||||
}
|
||||
|
||||
|
||||
batch.color = originalColour
|
||||
|
||||
}
|
||||
|
||||
val lightScalingMagic = 8f
|
||||
|
||||
Reference in New Issue
Block a user