mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
moving things around between packages
This commit is contained in:
@@ -19,7 +19,7 @@ import net.torvald.terrarum.modulebasegame.ui.Notification
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIBuildingMakerBlockChooser
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIBuildingMakerPenMenu
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIPaletteSelector
|
||||
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
import net.torvald.terrarum.ui.UINSMenu
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.gameworld.fmod
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ParticleBase
|
||||
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.worlddrawer.*
|
||||
import net.torvald.util.CircularArray
|
||||
|
||||
@@ -20,14 +20,14 @@ import net.torvald.terrarum.gamecontroller.IngameController
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameitem.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.console.AVTracker
|
||||
import net.torvald.terrarum.modulebasegame.console.ActorsList
|
||||
import net.torvald.terrarum.console.AVTracker
|
||||
import net.torvald.terrarum.console.ActorsList
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.*
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.physicssolver.CollisionSolver
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.WorldSimulator
|
||||
import net.torvald.terrarum.modulebasegame.ui.*
|
||||
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
import net.torvald.terrarum.modulebasegame.worldgenerator.RoguelikeRandomiser
|
||||
import net.torvald.terrarum.modulebasegame.worldgenerator.Worldgen
|
||||
import net.torvald.terrarum.modulebasegame.worldgenerator.WorldgenParams
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.debuggerapp.ActorValueTracker
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-12-29.
|
||||
*/
|
||||
internal object AVTracker : ConsoleCommand {
|
||||
private val jPanelInstances = ArrayList<ActorValueTracker>()
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size < 2) {
|
||||
jPanelInstances.add(ActorValueTracker((Terrarum.ingame!! as TerrarumIngame).actorNowPlaying))
|
||||
}
|
||||
else {
|
||||
try {
|
||||
val actorID = args[1].toInt()
|
||||
|
||||
if (Terrarum.ingame!!.theGameHasActor(actorID)) {
|
||||
jPanelInstances.add(ActorValueTracker(Terrarum.ingame!!.getActorByID(actorID)))
|
||||
}
|
||||
else {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
EchoError("Illegal actor ID input")
|
||||
return
|
||||
}
|
||||
catch (e1: IllegalArgumentException) {
|
||||
EchoError("No such actor with specified ID")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo("Pops up new window that provides real-time information about the actor's actor value")
|
||||
}
|
||||
|
||||
fun update() {
|
||||
jPanelInstances.forEach { it.update() }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.debuggerapp.ActorsLister
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-12-29.
|
||||
*/
|
||||
internal object ActorsList : ConsoleCommand {
|
||||
private val jPanelInstances = ArrayList<ActorsLister>()
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
jPanelInstances.add(ActorsLister(
|
||||
(Terrarum.ingame!! as TerrarumIngame).actorContainerActive,
|
||||
(Terrarum.ingame!! as TerrarumIngame).actorContainerInactive)
|
||||
)
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo("Pops up new window that displays the list of actors currently in the game")
|
||||
}
|
||||
|
||||
fun update() {
|
||||
jPanelInstances.forEach { it.update() }
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ object PlayerBuilderSigrid {
|
||||
p.actorValue[AVKey.STRENGTH] = 1414 // this is test character, after all.
|
||||
p.actorValue[AVKey.ENCUMBRANCE] = 1000
|
||||
p.actorValue[AVKey.BASEHEIGHT] = 46
|
||||
p.actorValue[AVKey.BASEREACH] = 50
|
||||
|
||||
p.actorValue[AVKey.NAME] = "Sigrid"
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ object PlayerBuilderWerebeastTest {
|
||||
p.actorValue[AVKey.ACCEL] = ActorHumanoid.WALK_ACCEL_BASE
|
||||
p.actorValue[AVKey.ACCELBUFF] = 1.0
|
||||
p.actorValue[AVKey.JUMPPOWER] = 19.0
|
||||
p.actorValue[AVKey.BASEREACH] = 114 // 7 tiles + 2 px
|
||||
|
||||
p.actorValue[AVKey.BASEMASS] = 599.16
|
||||
p.actorValue[AVKey.SCALEBUFF] = 1.0 // Constant 1.0 for player, meant to be used by random mobs
|
||||
@@ -46,7 +47,7 @@ object PlayerBuilderWerebeastTest {
|
||||
p.sprite = SpriteAnimation(p)
|
||||
p.spriteGlow = SpriteAnimation(p)
|
||||
p.reassembleSprite(p.sprite!!, p.spriteGlow)
|
||||
p.setHitboxDimension(22, p.actorValue.getAsInt(AVKey.BASEHEIGHT) ?: ActorHumanoid.BASE_HEIGHT, 30, 0)
|
||||
p.setHitboxDimension(22, p.actorValue.getAsInt(AVKey.BASEHEIGHT)!!, 30, 0)
|
||||
|
||||
p.setPosition(3.0 * TILE_SIZE, 3.0 * TILE_SIZE)
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.torvald.terrarum.modulebasegame.weather
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import net.torvald.terrarum.GdxColorMap
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Note: Colour maps are likely to have sparse data points
|
||||
* (i.e., they have 2 475 px in width and you'll need 79 200 data points for a day)
|
||||
* so between two must be interpolated.
|
||||
*
|
||||
* Created by minjaesong on 2016-07-11.
|
||||
*/
|
||||
data class BaseModularWeather(
|
||||
var skyboxGradColourMap: GdxColorMap, // row 0: skybox grad top, row 1: skybox grad bottom, row 2: sunlight (RGBA)
|
||||
val classification: String,
|
||||
var extraImages: ArrayList<Texture>,
|
||||
val mixFrom: String? = null,
|
||||
val mixPercentage: Double? = null
|
||||
)
|
||||
@@ -1,328 +0,0 @@
|
||||
package net.torvald.terrarum.modulebasegame.weather
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.RNGConsumer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ParticleMegaRain
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
||||
import net.torvald.terrarum.utils.JsonFetcher
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Current, next are there for cross-fading two weathers
|
||||
*
|
||||
*
|
||||
* Building a CLUT:
|
||||
* Brightest:Darkest must be "around" 10:1
|
||||
* Is RGBA-formatted (32-bit)
|
||||
*
|
||||
* Created by minjaesong on 2016-07-11.
|
||||
*/
|
||||
internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
override val RNG = HQRNG()
|
||||
|
||||
var globalLightOverridden = false
|
||||
|
||||
var weatherList: HashMap<String, ArrayList<BaseModularWeather>>
|
||||
|
||||
var currentWeather: BaseModularWeather
|
||||
var nextWeather: BaseModularWeather
|
||||
|
||||
lateinit var mixedWeather: BaseModularWeather
|
||||
|
||||
val globalLightNow = Cvec(0)
|
||||
|
||||
// Weather indices
|
||||
const val WEATHER_GENERIC = "generic"
|
||||
const val WEATHER_GENERIC_RAIN = "genericrain"
|
||||
// TODO add weather classification indices manually
|
||||
|
||||
// TODO to save from GL overhead, store lightmap to array; use GdxColorMap
|
||||
|
||||
init {
|
||||
weatherList = HashMap<String, ArrayList<BaseModularWeather>>()
|
||||
|
||||
// read weather descriptions from assets/weather (modular weather)
|
||||
val weatherRawValidList = ArrayList<File>()
|
||||
val weatherRaws = ModMgr.getFiles("basegame", "weathers")
|
||||
weatherRaws.forEach {
|
||||
if (!it.isDirectory && it.name.endsWith(".json"))
|
||||
weatherRawValidList.add(it)
|
||||
}
|
||||
// --> read from directory and store file that looks like RAW
|
||||
for (raw in weatherRawValidList) {
|
||||
val weather = readFromJson(raw)
|
||||
|
||||
// if List for the classification does not exist, make one
|
||||
if (!weatherList.containsKey(weather.classification))
|
||||
weatherList.put(weather.classification, ArrayList())
|
||||
|
||||
weatherList[weather.classification]!!.add(weather)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// initialise
|
||||
currentWeather = weatherList[WEATHER_GENERIC]!![0]
|
||||
nextWeather = getRandomWeather(WEATHER_GENERIC)
|
||||
}
|
||||
|
||||
/**
|
||||
* Part of Ingame update
|
||||
*/
|
||||
fun update(delta: Float, player: ActorWithBody?, world: GameWorldExtension) {
|
||||
if (player == null) return
|
||||
|
||||
currentWeather = weatherList[WEATHER_GENERIC]!![0]
|
||||
|
||||
|
||||
// test rain toggled by F2
|
||||
if (KeyToggler.isOn(Input.Keys.F2) && Terrarum.ingame is TerrarumIngame) {
|
||||
val playerPosX = player.hitbox.centeredX
|
||||
val playerPosY = player.hitbox.centeredY
|
||||
kotlin.repeat(7) {
|
||||
val rainParticle = ParticleMegaRain(
|
||||
playerPosX + HQRNG().nextInt(AppLoader.screenSize.screenW) - AppLoader.screenSize.halfScreenW,
|
||||
playerPosY - AppLoader.screenSize.screenH
|
||||
)
|
||||
(Terrarum.ingame!! as TerrarumIngame).addParticle(rainParticle)
|
||||
}
|
||||
//globalLightNow.set(getGlobalLightOfTime((Terrarum.ingame!!.world).time.todaySeconds).mul(0.3f, 0.3f, 0.3f, 0.58f))
|
||||
}
|
||||
|
||||
|
||||
if (!globalLightOverridden) {
|
||||
world.globalLight = WeatherMixer.globalLightNow
|
||||
}
|
||||
}
|
||||
|
||||
//private val parallaxZeroPos = WorldGenerator.TERRAIN_AVERAGE_HEIGHT * 0.75f // just an arb multiplier (266.66666 -> 200)
|
||||
|
||||
private val skyboxPixmap = Pixmap(2, 2, Pixmap.Format.RGBA8888)
|
||||
private var skyboxTexture = Texture(skyboxPixmap)
|
||||
|
||||
/**
|
||||
* Sub-portion of IngameRenderer. You are not supposed to directly deal with this.
|
||||
*/
|
||||
internal fun render(camera: Camera, batch: SpriteBatch, world: GameWorld) {
|
||||
val parallaxZeroPos = (world.height / 3f) * 0.8888f
|
||||
val parallaxDomainSize = world.height / 4f
|
||||
|
||||
|
||||
// we will not care for nextSkybox for now
|
||||
val timeNow = world.TIME_T.toInt() % world.dayLength
|
||||
val skyboxColourMap = currentWeather.skyboxGradColourMap
|
||||
|
||||
// calculate global light
|
||||
val globalLight = getGradientColour(world, skyboxColourMap, 2, timeNow)
|
||||
globalLightNow.set(globalLight)
|
||||
|
||||
|
||||
/* (copied from the shader source)
|
||||
UV mapping coord.y
|
||||
|
||||
-+ <- 1.0 =
|
||||
D| = // parallax of -1
|
||||
i| = =
|
||||
s| = // parallax of 0
|
||||
p| = =
|
||||
.| = // parallax of +1
|
||||
-+ <- 0.0 =
|
||||
*/
|
||||
val parallax = ((parallaxZeroPos - WorldCamera.gdxCamY.div(TILE_SIZEF)) / parallaxDomainSize).times(-1f).coerceIn(-1f, 1f)
|
||||
val parallaxSize = 1f / 3f
|
||||
val parallaxMidpt = (parallax + 1f) / 2f
|
||||
val parallaxTop = (parallaxMidpt - (parallaxSize / 2f)).coerceIn(0f, 1f)
|
||||
val parallaxBottom = (parallaxMidpt + (parallaxSize / 2f)).coerceIn(0f, 1f)
|
||||
|
||||
//println("$parallaxZeroPos, $parallax | $parallaxTop - $parallaxMidpt - $parallaxBottom | $parallaxDomainSize")
|
||||
|
||||
// draw skybox to provided graphics instance
|
||||
val colTopmost = getGradientColour(world, skyboxColourMap, 0, timeNow).toGdxColor()
|
||||
val colBottommost = getGradientColour(world, skyboxColourMap, 1, timeNow).toGdxColor()
|
||||
val colMid = colorMix(colTopmost, colBottommost, 0.5f)
|
||||
|
||||
//println(parallax) // parallax value works as intended.
|
||||
|
||||
val colTop = colorMix(colTopmost, colBottommost, parallaxTop)
|
||||
val colBottom = colorMix(colTopmost, colBottommost, parallaxBottom)
|
||||
|
||||
// draw using shaperenderer or whatever
|
||||
|
||||
//Terrarum.textureWhiteSquare.bind(0)
|
||||
gdxSetBlendNormal()
|
||||
|
||||
// draw to skybox texture
|
||||
skyboxPixmap.setColor(colBottom)
|
||||
skyboxPixmap.drawPixel(0, 0); skyboxPixmap.drawPixel(1, 0)
|
||||
skyboxPixmap.setColor(colTop)
|
||||
skyboxPixmap.drawPixel(0, 1); skyboxPixmap.drawPixel(1, 1)
|
||||
skyboxTexture.dispose()
|
||||
skyboxTexture = Texture(skyboxPixmap); skyboxTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||
|
||||
if (AppLoader.getConfigBoolean("fxdither")) {
|
||||
batch.shader = IngameRenderer.shaderBayer
|
||||
batch.shader.setUniformf("rcount", 64f)
|
||||
batch.shader.setUniformf("gcount", 64f)
|
||||
batch.shader.setUniformf("bcount", 64f)
|
||||
}
|
||||
else {
|
||||
batch.shader = null
|
||||
}
|
||||
batch.inUse {
|
||||
it.draw(skyboxTexture, 0f, -AppLoader.screenSize.halfScreenHf, AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf * 2f) // because of how the linear filter works, we extend the image by two
|
||||
}
|
||||
|
||||
// don't use shader to just fill the whole screen... frag shader will be called a million times and it's best to not burden it
|
||||
/*
|
||||
IngameRenderer.shaderSkyboxFill.begin()
|
||||
IngameRenderer.shaderSkyboxFill.setUniformMatrix("u_projTrans", camera.combined)
|
||||
IngameRenderer.shaderSkyboxFill.setUniformf("topColor", topCol.r, topCol.g, topCol.b)
|
||||
IngameRenderer.shaderSkyboxFill.setUniformf("bottomColor", bottomCol.r, bottomCol.g, bottomCol.b)
|
||||
IngameRenderer.shaderSkyboxFill.setUniformf("parallax", parallax.coerceIn(-1f, 1f))
|
||||
IngameRenderer.shaderSkyboxFill.setUniformf("parallax_size", 1f/3f)
|
||||
IngameRenderer.shaderSkyboxFill.setUniformf("zoomInv", 1f / (Terrarum.ingame?.screenZoom ?: 1f))
|
||||
AppLoader.fullscreenQuad.render(IngameRenderer.shaderSkyboxFill, GL20.GL_TRIANGLES)
|
||||
IngameRenderer.shaderSkyboxFill.end()
|
||||
*/
|
||||
|
||||
|
||||
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
|
||||
|
||||
}
|
||||
|
||||
fun Float.clampOne() = if (this > 1) 1f else this
|
||||
|
||||
private operator fun Color.times(other: Color) = Color(this.r * other.r, this.g * other.g, this.b * other.b, 1f)
|
||||
|
||||
fun colorMix(one: Color, two: Color, scale: Float): Color {
|
||||
return Color(
|
||||
FastMath.interpolateLinear(scale, one.r, two.r),
|
||||
FastMath.interpolateLinear(scale, one.g, two.g),
|
||||
FastMath.interpolateLinear(scale, one.b, two.b),
|
||||
FastMath.interpolateLinear(scale, one.a, two.a)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a GL of specific time
|
||||
*/
|
||||
fun getGlobalLightOfTime(world: GameWorld, timeInSec: Int): Cvec =
|
||||
getGradientColour(world, currentWeather.skyboxGradColourMap, 2, timeInSec)
|
||||
|
||||
fun getGradientColour(world: GameWorld, colorMap: GdxColorMap, row: Int, timeInSec: Int): Cvec {
|
||||
val dataPointDistance = world.dayLength / colorMap.width
|
||||
|
||||
val phaseThis: Int = timeInSec / dataPointDistance // x-coord in gradmap
|
||||
val phaseNext: Int = (phaseThis + 1) % colorMap.width
|
||||
|
||||
val colourThis = colorMap.get(phaseThis, row)
|
||||
val colourNext = colorMap.get(phaseNext, row)
|
||||
|
||||
// interpolate R, G, B and A
|
||||
val scale = (timeInSec % dataPointDistance).toFloat() / dataPointDistance // [0.0, 1.0]
|
||||
|
||||
val newCol = colourThis.cpy().lerp(colourNext, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext)
|
||||
|
||||
/* // very nice monitor code
|
||||
// 65 -> 66 | 300 | 19623 | RGB8(255, 0, 255) -[41%]-> RGB8(193, 97, 23) | * `230`40`160`
|
||||
// ^ step |width| time | colour from scale colour to | output
|
||||
if (dataPointDistance == 300)
|
||||
println("$phaseThis -> $phaseNext | $dataPointDistance | $timeInSec" +
|
||||
" | ${colourThis.toStringRGB()} -[${scale.times(100).toInt()}%]-> ${colourNext.toStringRGB()}" +
|
||||
" | * `$r`$g`$b`")*/
|
||||
|
||||
return Cvec(newCol)
|
||||
}
|
||||
|
||||
fun getWeatherList(classification: String) = weatherList[classification]!!
|
||||
fun getRandomWeather(classification: String) =
|
||||
getWeatherList(classification)[HQRNG().nextInt(getWeatherList(classification).size)]
|
||||
|
||||
fun readFromJson(file: File): BaseModularWeather = readFromJson(file.path)
|
||||
|
||||
fun readFromJson(path: String): BaseModularWeather {
|
||||
/* JSON structure:
|
||||
{
|
||||
"skyboxGradColourMap": "colourmap/sky_colour.tga", // string (path to image) for dynamic. Image must be RGBA8888 or RGB888
|
||||
"extraImages": [
|
||||
// if any, it will be like:
|
||||
sun01.tga,
|
||||
clouds01.tga,
|
||||
clouds02.tga,
|
||||
auroraBlueViolet.tga
|
||||
]
|
||||
}
|
||||
*/
|
||||
val pathToImage = "weathers"
|
||||
|
||||
val JSON = JsonFetcher(path)
|
||||
|
||||
val skyboxInJson = JSON.get("skyboxGradColourMap").asJsonPrimitive
|
||||
val extraImagesPath = JSON.getAsJsonArray("extraImages")
|
||||
|
||||
|
||||
|
||||
val skybox = if (skyboxInJson.isString)
|
||||
GdxColorMap(ModMgr.getGdxFile("basegame", "$pathToImage/${skyboxInJson.asString}"))
|
||||
else
|
||||
throw IllegalStateException("In weather descriptor $path -- skyboxGradColourMap seems malformed.")
|
||||
|
||||
|
||||
|
||||
val extraImages = ArrayList<Texture>()
|
||||
for (i in extraImagesPath)
|
||||
extraImages.add(Texture(ModMgr.getGdxFile("basegame", "$pathToImage/${i.asString}")))
|
||||
|
||||
|
||||
|
||||
val classification = JSON.get("classification").asJsonPrimitive.asString
|
||||
|
||||
|
||||
|
||||
var mixFrom: String?
|
||||
try { mixFrom = JSON.get("mixFrom").asJsonPrimitive.asString }
|
||||
catch (e: NullPointerException) { mixFrom = null }
|
||||
|
||||
|
||||
|
||||
var mixPercentage: Double?
|
||||
try { mixPercentage = JSON.get("mixPercentage").asJsonPrimitive.asDouble }
|
||||
catch (e: NullPointerException) { mixPercentage = null }
|
||||
|
||||
|
||||
|
||||
return BaseModularWeather(
|
||||
skyboxGradColourMap = skybox,
|
||||
classification = classification,
|
||||
extraImages = extraImages
|
||||
)
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
try {
|
||||
skyboxTexture.dispose()
|
||||
}
|
||||
catch (e: Throwable) {}
|
||||
|
||||
skyboxPixmap.dispose()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user