mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
randomised torch flicker
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|8448..0x0F_FFFF|Items (static) (1M possible)|
|
||||
|0x10_0000..0x0FFF_FFFF|Items (dynamic\*) (267M possible)|
|
||||
|0x1000_0000..0x7FFF_FFFF|Actors (1879M possible)|
|
||||
|-1..-65536|Virtual Tiles|
|
||||
|-2147483648..-1 (all negative numbers)|Faction (2147M possible)|
|
||||
|
||||
* dynamic items have own properties that will persist through savegame.
|
||||
|
||||
24
src/net/torvald/terrarum/ReferencingRanges.kt
Normal file
24
src/net/torvald/terrarum/ReferencingRanges.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
|
||||
/**
|
||||
* See REFERENCING.md
|
||||
*/
|
||||
object ReferencingRanges {
|
||||
|
||||
val TILES = 0..4095
|
||||
val WALLS = 4096..8191
|
||||
val WIRES = 8192..8447
|
||||
val ITEMS_STATIC = 8448..0x0F_FFFF
|
||||
val ITEMS_DYNAMIC = 0x10_0000..0x0FFF_FFFF
|
||||
val ACTORS = 0x1000_0000..0x7FFF_FFFF
|
||||
|
||||
val ACTORS_BEHIND = 0x1000_0000..0x1FFF_FFFF // Rendered behind (e.g. tapestries)
|
||||
val ACTORS_MIDDLE = 0x2000_0000..0x4FFF_FFFF // Regular actors (e.g. almost all of them)
|
||||
val ACTORS_MIDTOP = 0x5000_0000..0x5FFF_FFFF // Special (e.g. weapon swung, bullets, dropped item, particles)
|
||||
val ACTORS_FRONT = 0x6000_0000..0x6FFF_FFFF // Rendered front (e.g. fake tile)
|
||||
val ACTORS_OVERLAY = 0x7000_0000..0x7FFF_FFFF // Rendered as screen overlay, not affected by light nor environment overlays
|
||||
|
||||
val VIRTUAL_TILES = -1 downTo -65536
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.blockproperties
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printmsg
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.gameworld.FluidType
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.utils.CSVFetcher
|
||||
@@ -18,16 +19,25 @@ object BlockCodex {
|
||||
|
||||
private var blockProps = HashMap<Int, BlockProp>()
|
||||
|
||||
val dynamicLights = SortedArrayList<Int>()
|
||||
val dynamicLights = SortedArrayList<Int>() // does not include virtual ones
|
||||
|
||||
/** 4096 */
|
||||
const val MAX_TERRAIN_TILES = GameWorld.TILES_SUPPORTED
|
||||
val MAX_TERRAIN_TILES = GameWorld.TILES_SUPPORTED
|
||||
|
||||
private val nullProp = BlockProp()
|
||||
|
||||
var highestNumber = -1
|
||||
var highestNumber = -1 // does not include virtual ones
|
||||
private set
|
||||
|
||||
// fake props for "randomised" dynamic lights
|
||||
const val DYNAMIC_RANDOM_CASES = 64
|
||||
var virtualPropsCount = 0
|
||||
private set
|
||||
/** always points to the HIGHEST prop ID. <Original ID, Virtual ID> */
|
||||
val dynamicToVirtualPropMapping = ArrayList<Pair<Int, Int>>()
|
||||
/** for random access dont iterate over this */
|
||||
val dynamicToVirtualMap = hashMapOf<Int, Int>()
|
||||
|
||||
/**
|
||||
* Later entry (possible from other modules) will replace older ones
|
||||
*/
|
||||
@@ -48,8 +58,18 @@ object BlockCodex {
|
||||
val id = intVal(it, "id")
|
||||
setProp(id, it)
|
||||
|
||||
// register tiles with dynamic light
|
||||
if ((blockProps[id]?.dynamicLuminosityFunction ?: 0) != 0) {
|
||||
dynamicLights.add(id)
|
||||
|
||||
// add virtual props for dynamic lights
|
||||
val virtualIDMax = ReferencingRanges.VIRTUAL_TILES.first - virtualPropsCount
|
||||
dynamicToVirtualPropMapping.add(id to virtualIDMax)
|
||||
dynamicToVirtualMap[id] = virtualIDMax
|
||||
repeat(DYNAMIC_RANDOM_CASES) { i ->
|
||||
setProp(virtualIDMax - i, it)
|
||||
virtualPropsCount += 1
|
||||
}
|
||||
}
|
||||
|
||||
if (id > highestNumber)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.blockproperties
|
||||
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.gameworld.fmod
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-02-16.
|
||||
@@ -49,11 +50,17 @@ class BlockProp {
|
||||
internal var baseLumColB = 0f // base value used to calculate dynamic luminosity
|
||||
internal var baseLumColA = 0f // base value used to calculate dynamic luminosity
|
||||
internal val baseLumCol = Cvec(0)
|
||||
var lumColR = 0f // memoised value of dynamic luminosity
|
||||
var lumColG = 0f // memoised value of dynamic luminosity
|
||||
var lumColB = 0f // memoised value of dynamic luminosity
|
||||
var lumColA = 0f // memoised value of dynamic luminosity
|
||||
var lumCol = Cvec(0)
|
||||
//var lumColR = 0f // memoised value of dynamic luminosity
|
||||
//var lumColG = 0f // memoised value of dynamic luminosity
|
||||
//var lumColB = 0f // memoised value of dynamic luminosity
|
||||
//var lumColA = 0f // memoised value of dynamic luminosity
|
||||
internal val _lumCol = Cvec(0)
|
||||
fun getLumCol(x: Int, y: Int) = if (dynamicLuminosityFunction == 0) {
|
||||
baseLumCol
|
||||
} else {
|
||||
val offset = (x * 214013 + 2531011).ushr(16).fmod(BlockCodex.DYNAMIC_RANDOM_CASES)
|
||||
BlockCodex[BlockCodex.dynamicToVirtualMap[id]!! - offset]._lumCol
|
||||
}
|
||||
|
||||
/**
|
||||
* @param luminosity
|
||||
@@ -61,7 +68,7 @@ class BlockProp {
|
||||
//inline val luminosity: Cvec
|
||||
// get() = BlockPropUtil.getDynamicLumFunc(internalLumCol, dynamicLuminosityFunction)
|
||||
|
||||
fun getLum(channel: Int) = lumCol.getElem(channel)
|
||||
//fun getLum(channel: Int) = lumCol.getElem(channel)
|
||||
|
||||
var drop: Int = 0
|
||||
|
||||
@@ -72,4 +79,8 @@ class BlockProp {
|
||||
var dynamicLuminosityFunction: Int = 0
|
||||
|
||||
var material: String = ""
|
||||
|
||||
var rngBase0 = Math.random().toFloat() // initial cycle phase (xxxxFuncX)
|
||||
var rngBase1 = Math.random().toFloat() // flicker P0, etc
|
||||
var rngBase2 = Math.random().toFloat() // flicker P1, etc
|
||||
}
|
||||
@@ -14,81 +14,50 @@ import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||
* Created by minjaesong on 2016-06-16.
|
||||
*/
|
||||
object BlockPropUtil {
|
||||
var flickerFuncX: Second = 0f // saves current status (time) of func
|
||||
//var flickerFuncX: Second = 0f // saves current status (time) of func
|
||||
val flickerFuncDomain: Second = 0.08f // time between two noise sample
|
||||
val flickerFuncRange = 0.012f // intensity [0, 1]
|
||||
|
||||
var breathFuncX = 0f
|
||||
//var breathFuncX = 0f
|
||||
val breathRange = 0.02f
|
||||
val breathCycleDuration: Second = 2f
|
||||
|
||||
var pulsateFuncX = 0f
|
||||
//var pulsateFuncX = 0f
|
||||
val pulsateRange = 0.034f
|
||||
val pulsateCycleDuration: Second = 0.5f
|
||||
|
||||
val random = HQRNG()
|
||||
|
||||
var flickerP0 = getNewRandom()
|
||||
var flickerP1 = getNewRandom()
|
||||
//var flickerP0 = getNewRandom()
|
||||
//var flickerP1 = getNewRandom()
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
private fun getTorchFlicker(baseLum: Cvec): Cvec {
|
||||
val funcY = FastMath.interpolateLinear(flickerFuncX / flickerFuncDomain, flickerP0, flickerP1)
|
||||
return alterBrightnessUniform(baseLum, funcY)
|
||||
private fun getTorchFlicker(prop: BlockProp): Cvec {
|
||||
val funcY = FastMath.interpolateLinear(prop.rngBase0 / flickerFuncDomain, prop.rngBase1, prop.rngBase2)
|
||||
return alterBrightnessUniform(prop.baseLumCol, funcY)
|
||||
}
|
||||
|
||||
private fun getTorchFlicker(baseLum: Float): Float {
|
||||
return baseLum + FastMath.interpolateLinear(flickerFuncX / flickerFuncDomain, flickerP0, flickerP1)
|
||||
private fun getSlowBreath(prop: BlockProp): Cvec {
|
||||
val funcY = FastMath.sin(FastMath.PI * prop.rngBase0 / breathCycleDuration) * breathRange
|
||||
return alterBrightnessUniform(prop.baseLumCol, funcY)
|
||||
}
|
||||
|
||||
private fun getSlowBreath(baseLum: Cvec): Cvec {
|
||||
val funcY = FastMath.sin(FastMath.PI * breathFuncX / breathCycleDuration) * breathRange
|
||||
return alterBrightnessUniform(baseLum, funcY)
|
||||
private fun getPulsate(prop: BlockProp): Cvec {
|
||||
val funcY = FastMath.sin(FastMath.PI * prop.rngBase0 / pulsateCycleDuration) * pulsateRange
|
||||
return alterBrightnessUniform(prop.baseLumCol, funcY)
|
||||
}
|
||||
|
||||
private fun getSlowBreath(baseLum: Float): Float {
|
||||
return baseLum + FastMath.sin(FastMath.PI * breathFuncX / breathCycleDuration) * breathRange
|
||||
}
|
||||
|
||||
private fun getPulsate(baseLum: Cvec): Cvec {
|
||||
val funcY = FastMath.sin(FastMath.PI * pulsateFuncX / pulsateCycleDuration) * pulsateRange
|
||||
return alterBrightnessUniform(baseLum, funcY)
|
||||
}
|
||||
|
||||
private fun getPulsate(baseLum: Float): Float {
|
||||
return baseLum + FastMath.sin(FastMath.PI * pulsateFuncX / pulsateCycleDuration) * pulsateRange
|
||||
}
|
||||
|
||||
/**
|
||||
* Using our own timer so that they flickers for same duration regardless of game's FPS
|
||||
*/
|
||||
internal fun dynamicLumFuncTickClock() {
|
||||
// FPS-time compensation
|
||||
if (Gdx.graphics.framesPerSecond > 0) {
|
||||
flickerFuncX += Gdx.graphics.rawDeltaTime
|
||||
breathFuncX += Gdx.graphics.rawDeltaTime
|
||||
pulsateFuncX += Gdx.graphics.rawDeltaTime
|
||||
}
|
||||
|
||||
// flicker-related vars
|
||||
if (flickerFuncX > flickerFuncDomain) {
|
||||
flickerFuncX -= flickerFuncDomain
|
||||
|
||||
flickerP0 = flickerP1
|
||||
flickerP1 = getNewRandom()
|
||||
}
|
||||
|
||||
// breath-related vars
|
||||
if (breathFuncX > breathCycleDuration) breathFuncX -= breathCycleDuration
|
||||
|
||||
// pulsate-related vars
|
||||
if (pulsateFuncX > pulsateCycleDuration) pulsateFuncX -= pulsateCycleDuration
|
||||
|
||||
// update the memoised values in props
|
||||
for (key in BlockCodex.dynamicLights) {
|
||||
/*for (key in BlockCodex.dynamicLights) {
|
||||
try {
|
||||
val prop = BlockCodex[key]
|
||||
if (prop.dynamicLuminosityFunction != 0) {
|
||||
@@ -100,6 +69,38 @@ object BlockPropUtil {
|
||||
}
|
||||
}
|
||||
catch (skip: NullPointerException) {}
|
||||
}*/
|
||||
// update randomised virtual props instead
|
||||
for (keyMax in BlockCodex.dynamicToVirtualPropMapping) {
|
||||
repeat(BlockCodex.DYNAMIC_RANDOM_CASES) {
|
||||
val prop = BlockCodex[keyMax.second - it]
|
||||
val domain = when (prop.dynamicLuminosityFunction) {
|
||||
1 -> flickerFuncDomain
|
||||
4 -> breathCycleDuration
|
||||
5 -> pulsateCycleDuration
|
||||
else -> 0f
|
||||
}
|
||||
|
||||
// FPS-time compensation
|
||||
if (Gdx.graphics.framesPerSecond > 0) {
|
||||
prop.rngBase0 += Gdx.graphics.rawDeltaTime
|
||||
}
|
||||
|
||||
// reset timer
|
||||
if (prop.rngBase0 > domain) {
|
||||
prop.rngBase0 -= domain
|
||||
|
||||
// flicker related
|
||||
prop.rngBase1 = prop.rngBase2
|
||||
prop.rngBase2 = getNewRandom()
|
||||
}
|
||||
|
||||
prop._lumCol.set(getDynamicLumFunc(prop))
|
||||
//prop.lumColR = prop.lumCol.r
|
||||
//prop.lumColG = prop.lumCol.g
|
||||
//prop.lumColB = prop.lumCol.b
|
||||
//prop.lumColA = prop.lumCol.a
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,21 +108,21 @@ object BlockPropUtil {
|
||||
|
||||
private fun linearInterpolation1D(a: Float, b: Float, x: Float) = a * (1 - x) + b * x
|
||||
|
||||
private fun getDynamicLumFunc(baseLum: Cvec, type: Int): Cvec {
|
||||
return when (type) {
|
||||
1 -> getTorchFlicker(baseLum)
|
||||
private fun getDynamicLumFunc(prop: BlockProp): Cvec {
|
||||
return when (prop.dynamicLuminosityFunction) {
|
||||
1 -> getTorchFlicker(prop)
|
||||
2 -> (Terrarum.ingame!!.world).globalLight.cpy().mul(LightmapRenderer.DIV_FLOAT) // current global light
|
||||
3 -> WeatherMixer.getGlobalLightOfTime(Terrarum.ingame!!.world, WorldTime.DAY_LENGTH / 2).cpy().mul(LightmapRenderer.DIV_FLOAT) // daylight at noon
|
||||
4 -> getSlowBreath(baseLum)
|
||||
5 -> getPulsate(baseLum)
|
||||
else -> baseLum
|
||||
4 -> getSlowBreath(prop)
|
||||
5 -> getPulsate(prop)
|
||||
else -> prop.baseLumCol
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param chan 0 for R, 1 for G, 2 for B, 3 for A
|
||||
*/
|
||||
private fun getDynamicLumFuncByChan(baseLum: Float, type: Int, chan: Int): Float {
|
||||
/*private fun getDynamicLumFuncByChan(baseLum: Float, type: Int, chan: Int): Float {
|
||||
return when (type) {
|
||||
1 -> getTorchFlicker(baseLum)
|
||||
2 -> (Terrarum.ingame!!.world).globalLight.cpy().mul(LightmapRenderer.DIV_FLOAT).getElem(chan) // current global light
|
||||
@@ -130,7 +131,7 @@ object BlockPropUtil {
|
||||
5 -> getPulsate(baseLum)
|
||||
else -> baseLum
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Darken or brighten colour by 'brighten' argument
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex.ACTORID_MIN
|
||||
|
||||
@@ -22,11 +23,11 @@ abstract class Actor(val renderOrder: RenderOrder) : Comparable<Actor>, Runnable
|
||||
}
|
||||
|
||||
companion object {
|
||||
val RANGE_BEHIND = ACTORID_MIN..0x1FFF_FFFF // 1
|
||||
val RANGE_MIDDLE = 0x2000_0000..0x4FFF_FFFF // 3
|
||||
val RANGE_MIDTOP = 0x5000_0000..0x5FFF_FFFF // 1
|
||||
val RANGE_FRONT = 0x6000_0000..0x6FFF_FFFF // 1
|
||||
val RANDE_OVERLAY= 0x7000_0000..0x7FFF_FFFF // 1
|
||||
val RANGE_BEHIND = ReferencingRanges.ACTORS_BEHIND // 1
|
||||
val RANGE_MIDDLE = ReferencingRanges.ACTORS_MIDDLE // 3
|
||||
val RANGE_MIDTOP = ReferencingRanges.ACTORS_MIDTOP // 1
|
||||
val RANGE_FRONT = ReferencingRanges.ACTORS_FRONT // 1
|
||||
val RANDE_OVERLAY= ReferencingRanges.ACTORS_OVERLAY // 1
|
||||
}
|
||||
|
||||
abstract fun update(delta: Float)
|
||||
|
||||
@@ -4,6 +4,7 @@ package net.torvald.terrarum.gameworld
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
@@ -478,7 +479,7 @@ open class GameWorld : Disposable {
|
||||
@Transient const val TERRAIN = 1
|
||||
@Transient const val WIRE = 2
|
||||
|
||||
@Transient const val TILES_SUPPORTED = 4096
|
||||
@Transient val TILES_SUPPORTED = ReferencingRanges.TILES.last + 1
|
||||
//@Transient val SIZEOF: Byte = 2
|
||||
@Transient const val LAYERS: Byte = 4 // terrain, wall (layerTerrainLowBits + layerWallLowBits), wire
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blockproperties.Fluid
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
@@ -27,12 +28,12 @@ object ItemCodex {
|
||||
val dynamicItemDescription = HashMap<ItemID, GameItem>()
|
||||
val dynamicToStaticTable = HashMap<ItemID, ItemID>()
|
||||
|
||||
val ITEM_TILES = 0..GameWorld.TILES_SUPPORTED - 1
|
||||
val ITEM_WALLS = GameWorld.TILES_SUPPORTED..GameWorld.TILES_SUPPORTED * 2 - 1
|
||||
val ITEM_WIRES = GameWorld.TILES_SUPPORTED * 2..GameWorld.TILES_SUPPORTED * 2 + 255
|
||||
val ITEM_STATIC = ITEM_WIRES.endInclusive + 1..0x0F_FFFF
|
||||
val ITEM_DYNAMIC = 0x10_0000..0x0FFF_FFFF
|
||||
val ACTORID_MIN = ITEM_DYNAMIC.endInclusive + 1
|
||||
val ITEM_TILES = ReferencingRanges.TILES
|
||||
val ITEM_WALLS = ReferencingRanges.WALLS
|
||||
val ITEM_WIRES = ReferencingRanges.WIRES
|
||||
val ITEM_STATIC = ReferencingRanges.ITEMS_STATIC
|
||||
val ITEM_DYNAMIC = ReferencingRanges.ITEMS_DYNAMIC
|
||||
val ACTORID_MIN = ReferencingRanges.ACTORS.first
|
||||
|
||||
private val itemImagePlaceholder: TextureRegion
|
||||
get() = CommonResourcePool.getAsTextureRegion("itemplaceholder_24") // copper pickaxe
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
@@ -15,8 +16,11 @@ import java.util.*
|
||||
*/
|
||||
internal class FixtureTikiTorch : FixtureBase(BlockBox(BlockBox.NO_COLLISION, 1, 2)), Luminous {
|
||||
|
||||
private val rndHash1: Int
|
||||
private val rndHash2: Int
|
||||
|
||||
override var color: Cvec
|
||||
get() = BlockCodex[Block.TORCH].lumCol
|
||||
get() = BlockCodex[Block.TORCH].getLumCol(rndHash1, rndHash2)
|
||||
set(value) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
@@ -35,6 +39,10 @@ internal class FixtureTikiTorch : FixtureBase(BlockBox(BlockBox.NO_COLLISION, 1,
|
||||
sprite!!.setRowsAndFrames(1, 1)
|
||||
|
||||
actorValue[AVKey.BASEMASS] = MASS
|
||||
|
||||
val rng = HQRNG()
|
||||
rndHash1 = rng.nextInt()
|
||||
rndHash2 = rng.nextInt()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -239,7 +239,7 @@ object LightmapRenderer {
|
||||
|
||||
|
||||
// pre-seed the lightmap with known value
|
||||
for (x in for_x_start - overscan_open..for_x_end + overscan_open) {
|
||||
/*for (x in for_x_start - overscan_open..for_x_end + overscan_open) {
|
||||
for (y in for_y_start - overscan_open..for_y_end + overscan_open) {
|
||||
val tile = world.getTileFromTerrain(x, y)
|
||||
val wall = world.getTileFromWall(x, y)
|
||||
@@ -264,7 +264,7 @@ object LightmapRenderer {
|
||||
//lightmap.setB(lx, ly, lightlevel.b)
|
||||
//lightmap.setA(lx, ly, lightlevel.a)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
// O((5*9)n) == O(n) where n is a size of the map.
|
||||
@@ -681,7 +681,7 @@ object LightmapRenderer {
|
||||
|
||||
// regarding the issue #26
|
||||
try {
|
||||
val fuck = BlockCodex[thisTerrain].lumCol
|
||||
val fuck = BlockCodex[thisTerrain].getLumCol(x, y)
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
System.err.println("## NPE -- x: $x, y: $y, value: $thisTerrain")
|
||||
@@ -704,13 +704,13 @@ object LightmapRenderer {
|
||||
if (thisFluid.type != Fluid.NULL) {
|
||||
fluidAmountToCol.set(thisFluid.amount, thisFluid.amount, thisFluid.amount, thisFluid.amount)
|
||||
|
||||
thisTileLuminosity.set(BlockCodex[thisTerrain].lumCol)
|
||||
thisTileLuminosity.maxAndAssign(BlockCodex[thisFluid.type].lumCol.mul(fluidAmountToCol)) // already been div by four
|
||||
thisTileLuminosity.set(BlockCodex[thisTerrain].getLumCol(x, y))
|
||||
thisTileLuminosity.maxAndAssign(BlockCodex[thisFluid.type].getLumCol(x, y).mul(fluidAmountToCol)) // already been div by four
|
||||
thisTileOpacity.set(BlockCodex[thisTerrain].opacity)
|
||||
thisTileOpacity.maxAndAssign(BlockCodex[thisFluid.type].opacity.mul(fluidAmountToCol)) // already been div by four
|
||||
}
|
||||
else {
|
||||
thisTileLuminosity.set(BlockCodex[thisTerrain].lumCol)
|
||||
thisTileLuminosity.set(BlockCodex[thisTerrain].getLumCol(x, y))
|
||||
thisTileOpacity.set(BlockCodex[thisTerrain].opacity)
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ object LightmapRenderer {
|
||||
lightLevelThis.maxAndAssign(thisTileLuminosity).maxAndAssign(lanternMap[LandUtil.getBlockAddr(world, x, y)] ?: colourNull)
|
||||
}
|
||||
|
||||
private fun getLightsAndShadesCh(x: Int, y: Int, channel: Int) {
|
||||
/*private fun getLightsAndShadesCh(x: Int, y: Int, channel: Int) {
|
||||
lightLevelThisCh = 0f
|
||||
thisTerrain = world.getTileFromTerrain(x, y) ?: Block.STONE
|
||||
thisFluid = world.getFluid(x, y)
|
||||
@@ -735,7 +735,7 @@ object LightmapRenderer {
|
||||
|
||||
// regarding the issue #26
|
||||
try {
|
||||
val fuck = BlockCodex[thisTerrain].lumCol
|
||||
val fuck = BlockCodex[thisTerrain].getLumCol(x, y)
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
System.err.println("## NPE -- x: $x, y: $y, value: $thisTerrain")
|
||||
@@ -780,7 +780,7 @@ object LightmapRenderer {
|
||||
// blend lantern
|
||||
lightLevelThisCh = maxOf(thisTileLuminosityCh, lightLevelThisCh)
|
||||
lightLevelThisCh = maxOf(lanternMap[LandUtil.getBlockAddr(world, x, y)]?.getElem(channel) ?: 0f, lightLevelThisCh)
|
||||
}
|
||||
}*/
|
||||
|
||||
private val inNoopMaskp = Point2i(0,0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user