mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
serialisation of HRQNG is fixed so it would not make illegal reflective access on Java 17
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -38,7 +38,7 @@
|
||||
<property name="caretWidth" class="java.lang.Integer" />
|
||||
</properties>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SuppressKotlinCodeStyleNotification">
|
||||
|
||||
2
.idea/runConfigurations/Terrarum.xml
generated
2
.idea/runConfigurations/Terrarum.xml
generated
@@ -4,7 +4,7 @@
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="11" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="17" />
|
||||
<module name="terrarum.terrarum" />
|
||||
<method v="2">
|
||||
<option name="BuildArtifacts" enabled="true">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<option name="JAR_PATH" value="$PROJECT_DIR$/out/TerrarumBuild.jar" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="11" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="17" />
|
||||
<module name="terrarum.terrarum" />
|
||||
<method v="2">
|
||||
<option name="BuildArtifacts" enabled="true">
|
||||
|
||||
BIN
assets/mods/basegame/gui/construction_grid.tga
LFS
Normal file
BIN
assets/mods/basegame/gui/construction_grid.tga
LFS
Normal file
Binary file not shown.
@@ -11,12 +11,12 @@ import java.util.Random;
|
||||
*/
|
||||
public class HQRNG extends Random {
|
||||
|
||||
private static final long DOUBLE_MASK = (1L << 53) - 1;
|
||||
private static final double NORM_53 = 1. / (1L << 53);
|
||||
private static final long FLOAT_MASK = (1L << 24) - 1;
|
||||
private static final double NORM_24 = 1. / (1L << 24);
|
||||
transient private static final long DOUBLE_MASK = (1L << 53) - 1;
|
||||
transient private static final double NORM_53 = 1. / (1L << 53);
|
||||
transient private static final long FLOAT_MASK = (1L << 24) - 1;
|
||||
transient private static final double NORM_24 = 1. / (1L << 24);
|
||||
|
||||
private static final long serialVersionUID = 1018744536171610262L;
|
||||
transient private static final long serialVersionUID = 1018744536171610262L;
|
||||
|
||||
private long state0, state1;
|
||||
|
||||
|
||||
@@ -12,18 +12,19 @@ object ScreencapNogui: ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
IngameRenderer.screencapExportCallback = {
|
||||
val w = 960
|
||||
val h = 640
|
||||
val p = Pixmap.createFromFrameBuffer((it.width - w).ushr(1), (it.height - h).ushr(1), w, h)
|
||||
val p = Pixmap.createFromFrameBuffer(0, 0, it.width, it.height)
|
||||
PixmapIO2.writeTGA(Gdx.files.absolute(App.defaultDir + "/Exports/${args[1]}.tga"), p, true)
|
||||
p.dispose()
|
||||
}
|
||||
IngameRenderer.screencapRequested = true
|
||||
Echo("FBO exported to$ccG Exports/${args[1]}.tga")
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
}
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
|
||||
Echo("Usage: screencapnogui <output filename>")
|
||||
}
|
||||
}
|
||||
@@ -402,9 +402,10 @@ object IngameRenderer : Disposable {
|
||||
Gdx.gl.glDisable(GL20.GL_BLEND)
|
||||
}
|
||||
|
||||
// processBlur(lightmapFboA, lightmapFboB)
|
||||
processKawaseBlur(lightmapFbo)
|
||||
// processNoBlur()
|
||||
if (KeyToggler.isOn(Input.Keys.F5))
|
||||
processNoBlur(lightmapFbo)
|
||||
else
|
||||
processKawaseBlur(lightmapFbo)
|
||||
|
||||
|
||||
blendNormal(batch)
|
||||
@@ -668,6 +669,22 @@ object IngameRenderer : Disposable {
|
||||
|
||||
private const val KAWASE_POWER = 1.5f
|
||||
|
||||
fun processNoBlur(outFbo: FloatFrameBuffer) {
|
||||
|
||||
blurtex0.dispose()
|
||||
|
||||
|
||||
outFbo.inAction(camera, batch) {
|
||||
blurtex0 = LightmapRenderer.draw()
|
||||
blurtex0.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||
blurtex0.bind(0)
|
||||
App.shaderPassthruRGBA.bind()
|
||||
App.shaderPassthruRGBA.setUniformMatrix("u_projTrans", camera.combined)
|
||||
App.shaderPassthruRGBA.setUniformi("u_texture", 0)
|
||||
blurWriteQuad.render(App.shaderPassthruRGBA, GL20.GL_TRIANGLES)
|
||||
}
|
||||
}
|
||||
|
||||
fun processKawaseBlur(outFbo: FloatFrameBuffer) {
|
||||
|
||||
blurtex0.dispose()
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.serialise
|
||||
import com.badlogic.gdx.utils.Json
|
||||
import com.badlogic.gdx.utils.JsonValue
|
||||
import com.badlogic.gdx.utils.JsonWriter
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.console.EchoError
|
||||
import net.torvald.terrarum.gameworld.BlockLayer
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
@@ -187,6 +188,19 @@ object Common {
|
||||
return UUID.fromString(jsonData.asString())
|
||||
}
|
||||
})
|
||||
// HQRNG
|
||||
jsoner.setSerializer(HQRNG::class.java, object : Json.Serializer<HQRNG> {
|
||||
override fun write(json: Json, obj: HQRNG, knownType: Class<*>?) {
|
||||
json.writeValue("${obj.state0.toString()},${obj.state1.toString()}")
|
||||
}
|
||||
|
||||
override fun read(json: Json, jsonData: JsonValue, type: Class<*>?): HQRNG {
|
||||
val rng = HQRNG()
|
||||
val seedstr = jsonData.asString().split(',')
|
||||
rng.setSeed(seedstr[0].toLong(), seedstr[1].toLong())
|
||||
return rng
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private data class LayerInfo(val h: String, val b: String, val x: Int, val y: Int)
|
||||
|
||||
BIN
work_files/UI/construction_grid_mockup.kra
LFS
Normal file
BIN
work_files/UI/construction_grid_mockup.kra
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user