mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
randomised torch flicker
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user