reducing number of warnings on the codebase

This commit is contained in:
minjaesong
2021-08-20 23:28:59 +09:00
parent 69075ad6da
commit bb95444067
24 changed files with 58 additions and 164 deletions

View File

@@ -273,10 +273,10 @@ class Cvec {
return this return this
} }
override fun equals(o: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === o) return true if (this === other) return true
if (o == null || javaClass != o.javaClass) return false if (other == null || javaClass != other.javaClass) return false
val color = o as Cvec? val color = other as Cvec?
return toIntBits() == color!!.toIntBits() return toIntBits() == color!!.toIntBits()
} }

View File

@@ -173,7 +173,7 @@ public class LwjglGraphics implements Graphics {
} }
} }
public float getRawDeltaTime () { public float getDeltaTime () {
return deltaTime; return deltaTime;
} }

View File

@@ -487,7 +487,7 @@ public class AppLoader implements ApplicationListener {
postInit(); postInit();
} }
AppLoader.setDebugTime("GDX.rawDelta", (long) (Gdx.graphics.getRawDeltaTime() * 1000_000_000f)); AppLoader.setDebugTime("GDX.rawDelta", (long) (Gdx.graphics.getDeltaTime() * 1000_000_000f));
FrameBufferManager.begin(renderFBO); FrameBufferManager.begin(renderFBO);
@@ -500,7 +500,7 @@ public class AppLoader implements ApplicationListener {
if (currenScreen == null) { if (currenScreen == null) {
drawSplash(); drawSplash();
loadTimer += Gdx.graphics.getRawDeltaTime(); loadTimer += Gdx.graphics.getDeltaTime();
if (loadTimer >= showupTime) { if (loadTimer >= showupTime) {
// hand over the scene control to this single class; Terrarum must call // hand over the scene control to this single class; Terrarum must call
@@ -556,13 +556,12 @@ public class AppLoader implements ApplicationListener {
} }
private void drawSplash() { private void drawSplash() {
shaderBayerSkyboxFill.begin(); shaderBayerSkyboxFill.bind();
shaderBayerSkyboxFill.setUniformMatrix("u_projTrans", camera.combined); shaderBayerSkyboxFill.setUniformMatrix("u_projTrans", camera.combined);
shaderBayerSkyboxFill.setUniformf("parallax_size", 0f); shaderBayerSkyboxFill.setUniformf("parallax_size", 0f);
shaderBayerSkyboxFill.setUniformf("topColor", gradWhiteTop.r, gradWhiteTop.g, gradWhiteTop.b); shaderBayerSkyboxFill.setUniformf("topColor", gradWhiteTop.r, gradWhiteTop.g, gradWhiteTop.b);
shaderBayerSkyboxFill.setUniformf("bottomColor", gradWhiteBottom.r, gradWhiteBottom.g, gradWhiteBottom.b); shaderBayerSkyboxFill.setUniformf("bottomColor", gradWhiteBottom.r, gradWhiteBottom.g, gradWhiteBottom.b);
fullscreenQuad.render(shaderBayerSkyboxFill, GL20.GL_TRIANGLES); fullscreenQuad.render(shaderBayerSkyboxFill, GL20.GL_TRIANGLES);
shaderBayerSkyboxFill.end();
setCameraPosition(0f, 0f); setCameraPosition(0f, 0f);

View File

@@ -39,11 +39,10 @@ object ColorLimiterTest : ApplicationAdapter() {
ShaderProgram.pedantic = false ShaderProgram.pedantic = false
shader4096 = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/4096_bayer.frag")) shader4096 = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/4096_bayer.frag"))
shader4096.begin() shader4096.bind()
shader4096.setUniformf("rcount", 4f) shader4096.setUniformf("rcount", 4f)
shader4096.setUniformf("gcount", 4f) shader4096.setUniformf("gcount", 4f)
shader4096.setUniformf("bcount", 4f) shader4096.setUniformf("bcount", 4f)
shader4096.end()
//img = Texture("assets/test_gradient.tga") //img = Texture("assets/test_gradient.tga")
img = Texture("assets/test_texture.tga") img = Texture("assets/test_texture.tga")

View File

@@ -139,7 +139,7 @@ object GlslTilingTest : ApplicationAdapter() {
tilesBufferAsTex.bind(2) tilesBufferAsTex.bind(2)
tileAtlas.bind(1) // for some fuck reason, it must be bound as last tileAtlas.bind(1) // for some fuck reason, it must be bound as last
shader.begin() shader.bind()
shader.setUniformMatrix("u_projTrans", batch.projectionMatrix)//camera.combined) shader.setUniformMatrix("u_projTrans", batch.projectionMatrix)//camera.combined)
//shader.setUniformf("colourFilter", Color.RED) //shader.setUniformf("colourFilter", Color.RED)
shader.setUniformf("screenDimension", Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat()) shader.setUniformf("screenDimension", Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
@@ -152,7 +152,6 @@ object GlslTilingTest : ApplicationAdapter() {
shader.setUniformf("tilesInAtlas", 256f, 256f) //depends on the tile atlas shader.setUniformf("tilesInAtlas", 256f, 256f) //depends on the tile atlas
shader.setUniformf("atlasTexSize", 4096f, 4096f) //depends on the tile atlas shader.setUniformf("atlasTexSize", 4096f, 4096f) //depends on the tile atlas
tilesQuad.render(shader, GL20.GL_TRIANGLES) tilesQuad.render(shader, GL20.GL_TRIANGLES)
shader.end()
tilesBufferAsTex.dispose() tilesBufferAsTex.dispose()

View File

@@ -75,7 +75,7 @@ object PostProcessor : Disposable {
} }
debugUI.update(Gdx.graphics.rawDeltaTime) debugUI.update(Gdx.graphics.deltaTime)
AppLoader.measureDebugTime("Renderer.PostProcessor") { AppLoader.measureDebugTime("Renderer.PostProcessor") {
@@ -135,11 +135,10 @@ object PostProcessor : Disposable {
fbo.colorBufferTexture.bind(0) fbo.colorBufferTexture.bind(0)
shader?.begin() shader?.bind()
shader?.setUniformMatrix("u_projTrans", projMat) shader?.setUniformMatrix("u_projTrans", projMat)
shader?.setUniformi("u_texture", 0) shader?.setUniformi("u_texture", 0)
AppLoader.fullscreenQuad.render(shader, GL20.GL_TRIANGLES) AppLoader.fullscreenQuad.render(shader, GL20.GL_TRIANGLES)
shader?.end()
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it

View File

@@ -70,7 +70,7 @@ object SanicLoadScreen : LoadScreenBase() {
override fun render(delta: Float) { override fun render(delta: Float) {
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle()) Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
val delta = Gdx.graphics.rawDeltaTime val delta = Gdx.graphics.deltaTime
glideDispY = AppLoader.screenSize.screenH - 100f - AppLoader.fontGame.lineHeight glideDispY = AppLoader.screenSize.screenH - 100f - AppLoader.fontGame.lineHeight
arrowObjGlideSize = arrowObjTex.width + 2f * AppLoader.screenSize.screenW arrowObjGlideSize = arrowObjTex.width + 2f * AppLoader.screenSize.screenW

View File

@@ -266,7 +266,7 @@ object Terrarum : Disposable {
get() = Gdx.input.deltaY get() = Gdx.input.deltaY
/** Delta converted as it it was a FPS */ /** Delta converted as it it was a FPS */
inline val updateRate: Double inline val updateRate: Double
get() = 1.0 / Gdx.graphics.rawDeltaTime get() = 1.0 / Gdx.graphics.deltaTime
/** /**
* Usage: * Usage:

View File

@@ -194,7 +194,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
// async update and render // async update and render
val dt = Gdx.graphics.rawDeltaTime val dt = Gdx.graphics.deltaTime
updateAkku += dt updateAkku += dt
var i = 0L var i = 0L
@@ -208,16 +208,6 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
// render? just do it anyway // render? just do it anyway
AppLoader.measureDebugTime("Ingame.Render") { renderScreen() } AppLoader.measureDebugTime("Ingame.Render") { renderScreen() }
AppLoader.setDebugTime("Ingame.Render - (Light + Tiling)",
((AppLoader.debugTimers["Ingame.Render"] as? Long) ?: 0) -
(
((AppLoader.debugTimers["Renderer.Lanterns"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.LightPrecalc"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.LightRuns"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.LightToScreen"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.Tiling"] as? Long) ?: 0)
)
)
} }
fun updateScreen(delta: Float) { fun updateScreen(delta: Float) {

View File

@@ -81,7 +81,7 @@ object BlockPropUtil {
// FPS-time compensation // FPS-time compensation
if (Gdx.graphics.framesPerSecond > 0) { if (Gdx.graphics.framesPerSecond > 0) {
prop.rngBase0 += Gdx.graphics.rawDeltaTime prop.rngBase0 += Gdx.graphics.deltaTime
} }
// reset timer // reset timer

View File

@@ -18,14 +18,12 @@ import net.torvald.terrarum.gameworld.BlockAddress
import net.torvald.terrarum.gameworld.GameWorld import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.realestate.LandUtil import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import net.torvald.terrarum.worlddrawer.WorldCamera import net.torvald.terrarum.worlddrawer.WorldCamera
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import org.dyn4j.geometry.Vector2 import org.dyn4j.geometry.Vector2
import java.util.* import java.util.*
import kotlin.math.absoluteValue import kotlin.math.absoluteValue
import kotlin.math.roundToInt import kotlin.math.roundToInt
import kotlin.math.sign
/** /**
@@ -33,8 +31,8 @@ import kotlin.math.sign
* Also has all the usePhysics * Also has all the usePhysics
* *
* @param renderOrder Rendering order (BEHIND, MIDDLE, MIDTOP, FRONT) * @param renderOrder Rendering order (BEHIND, MIDDLE, MIDTOP, FRONT)
* @param immobileBody use realistic air friction (1/1000 of "unrealistic" canonical setup) * @param physProp physics properties
* @param usePhysics use usePhysics simulation * @param id use custom ActorID
* *
* Created by minjaesong on 2016-01-13. * Created by minjaesong on 2016-01-13.
*/ */
@@ -328,8 +326,6 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
* @param h * @param h
* @param tx positive: translate sprite to LEFT. * @param tx positive: translate sprite to LEFT.
* @param ty positive: translate sprite to DOWN. * @param ty positive: translate sprite to DOWN.
* @see ActorWBMovable.drawBody
* @see ActorWBMovable.drawGlow
*/ */
fun setHitboxDimension(w: Int, h: Int, tx: Int, ty: Int) { fun setHitboxDimension(w: Int, h: Int, tx: Int, ty: Int) {
baseHitboxH = h baseHitboxH = h
@@ -423,7 +419,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
// Actors are subject to the gravity and the buoyancy if they are not levitating // Actors are subject to the gravity and the buoyancy if they are not levitating
if (!isNoSubjectToGrav) { if (!isNoSubjectToGrav) {
applyGravitation(delta) applyGravitation()
} }
//applyBuoyancy() //applyBuoyancy()
@@ -463,9 +459,9 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
// TODO less friction for non-animating objects (make items glide far more on ice) // TODO less friction for non-animating objects (make items glide far more on ice)
// FIXME asymmetry on friction // FIXME asymmetry on friction
setHorizontalFriction(delta) // friction SHOULD use and alter externalV setHorizontalFriction() // friction SHOULD use and alter externalV
//if (isNoClip) { // TODO also hanging on the rope, etc. //if (isNoClip) { // TODO also hanging on the rope, etc.
setVerticalFriction(delta) setVerticalFriction()
//} //}
@@ -514,54 +510,12 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
isStationary = (hitbox - oldHitbox).magnitudeSquared < PHYS_EPSILON_VELO isStationary = (hitbox - oldHitbox).magnitudeSquared < PHYS_EPSILON_VELO
} }
/** fun getDrag(externalForce: Vector2): Vector2 {
* Similar to applyForce but deals with walking. Read below:
*
* how speedcap is achieved with moveDelta:
* moveDelta is (velo + walk), but this added value is reset every update.
* if it wasn't, it will go like this:
* F 0 velo + walk
* F 1 velo + walk + velo + walk
* as a result, the speed will keep increase without it
*/
/*private fun combineVeloToMoveDelta() {
if (this is Controllable) {
// decide whether to ignore walkX
if (!(isWalled(hitbox, COLLIDING_LEFT) && walkX < 0)
|| !(isWalled(hitbox, COLLIDING_RIGHT) && walkX > 0)
) {
moveDelta.x = externalV.x + walkX
}
// decide whether to ignore walkY
if (!(isWalled(hitbox, COLLIDING_TOP) && walkY < 0)
|| !(isWalled(hitbox, COLLIDING_BOTTOM) && walkY > 0)
) {
moveDelta.y = externalV.y + walkY
}
}
else {
if (!isWalled(hitbox, COLLIDING_LEFT)
|| !isWalled(hitbox, COLLIDING_RIGHT)
) {
moveDelta.x = externalV.x
}
// decide whether to ignore walkY
if (!isWalled(hitbox, COLLIDING_TOP)
|| !isWalled(hitbox, COLLIDING_BOTTOM)
) {
moveDelta.y = externalV.y
}
}
}*/
fun getDrag(delta: Float, externalForce: Vector2): Vector2 {
/** /**
* weight; gravitational force in action * weight; gravitational force in action
* W = mass * G (9.8 [m/s^2]) * W = mass * G (9.8 [m/s^2])
*/ */
val W: Vector2 = gravitation * Terrarum.PHYS_TIME_FRAME.toDouble() val W: Vector2 = gravitation * Terrarum.PHYS_TIME_FRAME
/** /**
* Area * Area
*/ */
@@ -595,42 +549,15 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
* *
* Apply only if not grounded; normal force is precessed separately. * Apply only if not grounded; normal force is precessed separately.
*/ */
private fun applyGravitation(delta: Float) { private fun applyGravitation() {
if (!isNoSubjectToGrav && !(gravitation.y > 0 && walledBottom || gravitation.y < 0 && walledTop)) { if (!isNoSubjectToGrav && !(gravitation.y > 0 && walledBottom || gravitation.y < 0 && walledTop)) {
//if (!isWalled(hitbox, COLLIDING_BOTTOM)) { //if (!isWalled(hitbox, COLLIDING_BOTTOM)) {
applyForce(getDrag(delta, externalV)) applyForce(getDrag(externalV))
//} //}
} }
} }
/**
* nextHitbox must NOT be altered before this method is called!
*/
/*@Deprecated("It's stupid anyway.") private fun displaceByCCD() {
if (!isNoCollideWorld) {
if (!isColliding(hitbox))
return
// do some CCD between hitbox and nextHitbox
val ccdDelta = (hitbox.toVector() - hitbox.toVector())
if (ccdDelta.x != 0.0 || ccdDelta.y != 0.0) {
//ccdDelta.set(ccdDelta.setMagnitude(CCD_TICK)) // fixed tick
val displacement = Math.min(1.0.div(moveDelta.magnitude * 2), 0.5) // adaptive tick
ccdDelta.set(ccdDelta.setMagnitude(displacement))
}
//println("deltaMax: $deltaMax")
//println("ccdDelta: $ccdDelta")
while (!ccdDelta.isZero && isColliding(hitbox)) {
hitbox.translate(-ccdDelta)
}
//println("ccdCollided: $ccdCollided")
}
}*/
private fun displaceHitbox() { private fun displaceHitbox() {
// // HOW IT SHOULD WORK // // // // HOW IT SHOULD WORK // //
// //////////////////////// // ////////////////////////
@@ -1002,7 +929,6 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
val intpStep = 64.0 val intpStep = 64.0
// make interpolation even if the "next" position is clear of collision // make interpolation even if the "next" position is clear of collision
var clearOfCollision = true
val testHitbox = hitbox.clone() val testHitbox = hitbox.clone()
// divide the vectors by the constant // divide the vectors by the constant
@@ -1020,13 +946,11 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
if (isWalled2(testHitbox, COLLIDING_UD)) { if (isWalled2(testHitbox, COLLIDING_UD)) {
externalV.y *= elasticity // TODO also multiply the friction value externalV.y *= elasticity // TODO also multiply the friction value
controllerV?.let { controllerV!!.y *= elasticity } // TODO also multiply the friction value controllerV?.let { controllerV!!.y *= elasticity } // TODO also multiply the friction value
clearOfCollision = false
} }
// horizontal collision // horizontal collision
if (isWalled2(testHitbox, COLLIDING_LR)) { if (isWalled2(testHitbox, COLLIDING_LR)) {
externalV.x *= elasticity // TODO also multiply the friction value externalV.x *= elasticity // TODO also multiply the friction value
controllerV?.let { controllerV!!.x *= elasticity } // TODO also multiply the friction value controllerV?.let { controllerV!!.x *= elasticity } // TODO also multiply the friction value
clearOfCollision = false
} }
} }
@@ -1241,7 +1165,6 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
val ys = if (gravitation.y >= 0) pyEnd downTo pyStart else pyStart..pyEnd val ys = if (gravitation.y >= 0) pyEnd downTo pyStart else pyStart..pyEnd
val yheight = (ys.last - ys.first).absoluteValue val yheight = (ys.last - ys.first).absoluteValue
var stairHeight = 0 var stairHeight = 0
var countUpForStairHeight = true
var hitFloor = false var hitFloor = false
for (y in ys) { for (y in ys) {
@@ -1370,7 +1293,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
/** about stopping /** about stopping
* for about get moving, see updateMovementControl */ * for about get moving, see updateMovementControl */
private fun setHorizontalFriction(delta: Float) { private fun setHorizontalFriction() {
val friction = if (isNoClip) val friction = if (isNoClip)
BASE_FRICTION * (actorValue.getAsDouble(AVKey.FRICTIONMULT) ?: 1.0) * BlockCodex[Block.STONE].friction.frictionToMult() BASE_FRICTION * (actorValue.getAsDouble(AVKey.FRICTIONMULT) ?: 1.0) * BlockCodex[Block.STONE].friction.frictionToMult()
else { else {
@@ -1399,7 +1322,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties,
} }
} }
private fun setVerticalFriction(delta: Float) { private fun setVerticalFriction() {
val friction = if (isNoClip) val friction = if (isNoClip)
BASE_FRICTION * (actorValue.getAsDouble(AVKey.FRICTIONMULT) ?: 1.0) * BlockCodex[Block.STONE].friction.frictionToMult() BASE_FRICTION * (actorValue.getAsDouble(AVKey.FRICTIONMULT) ?: 1.0) * BlockCodex[Block.STONE].friction.frictionToMult()
else else

View File

@@ -314,7 +314,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
// ASYNCHRONOUS UPDATE AND RENDER // // ASYNCHRONOUS UPDATE AND RENDER //
val dt = Gdx.graphics.rawDeltaTime val dt = Gdx.graphics.deltaTime
updateAkku += dt updateAkku += dt
var i = 0L var i = 0L

View File

@@ -93,11 +93,10 @@ object IngameRenderer : Disposable {
if (AppLoader.getConfigBoolean("fxdither")) { if (AppLoader.getConfigBoolean("fxdither")) {
shaderBayer = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/4096_bayer.frag") shaderBayer = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/4096_bayer.frag")
shaderBayer.begin() shaderBayer.bind()
shaderBayer.setUniformf("rcount", 64f) shaderBayer.setUniformf("rcount", 64f)
shaderBayer.setUniformf("gcount", 64f) shaderBayer.setUniformf("gcount", 64f)
shaderBayer.setUniformf("bcount", 64f) shaderBayer.setUniformf("bcount", 64f)
shaderBayer.end()
} }
else { else {
shaderBayer = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/passthrurgb.frag") shaderBayer = AppLoader.loadShaderFromFile("assets/4096.vert", "assets/passthrurgb.frag")
@@ -626,11 +625,10 @@ object IngameRenderer : Disposable {
val texture = LightmapRenderer.draw() val texture = LightmapRenderer.draw()
texture.bind(0) texture.bind(0)
shaderPassthru.begin() shaderPassthru.bind()
shaderPassthru.setUniformMatrix("u_projTrans", camera.combined) shaderPassthru.setUniformMatrix("u_projTrans", camera.combined)
shaderPassthru.setUniformi("u_texture", 0) shaderPassthru.setUniformi("u_texture", 0)
blurWriteQuad.render(shaderPassthru, GL20.GL_TRIANGLES) blurWriteQuad.render(shaderPassthru, GL20.GL_TRIANGLES)
shaderPassthru.end()
} }
// do blurring // do blurring
@@ -641,7 +639,7 @@ object IngameRenderer : Disposable {
blurTex.texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear) blurTex.texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
blurTex.texture.bind(0) blurTex.texture.bind(0)
shaderBlur.begin() shaderBlur.bind()
shaderBlur.setUniformMatrix("u_projTrans", camera.combined) shaderBlur.setUniformMatrix("u_projTrans", camera.combined)
shaderBlur.setUniformi("u_texture", 0) shaderBlur.setUniformi("u_texture", 0)
shaderBlur.setUniformf("iResolution", shaderBlur.setUniformf("iResolution",
@@ -652,7 +650,6 @@ object IngameRenderer : Disposable {
else else
shaderBlur.setUniformf("direction", 0f, blurRadius) shaderBlur.setUniformf("direction", 0f, blurRadius)
blurWriteQuad.render(shaderBlur, GL20.GL_TRIANGLES) blurWriteQuad.render(shaderBlur, GL20.GL_TRIANGLES)
shaderBlur.end()
// swap // swap

View File

@@ -534,7 +534,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// ASYNCHRONOUS UPDATE AND RENDER // // ASYNCHRONOUS UPDATE AND RENDER //
/** UPDATE CODE GOES HERE */ /** UPDATE CODE GOES HERE */
val dt = Gdx.graphics.rawDeltaTime val dt = Gdx.graphics.deltaTime
updateAkku += dt updateAkku += dt
var i = 0L var i = 0L
@@ -549,16 +549,6 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
/** RENDER CODE GOES HERE */ /** RENDER CODE GOES HERE */
AppLoader.measureDebugTime("Ingame.Render") { renderGame() } AppLoader.measureDebugTime("Ingame.Render") { renderGame() }
AppLoader.setDebugTime("Ingame.Render - (Light + Tiling)",
((AppLoader.debugTimers["Ingame.Render"] as? Long) ?: 0) -
(
((AppLoader.debugTimers["Renderer.Lanterns"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.LightPrecalc"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.LightRuns"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.LightToScreen"] as? Long) ?: 0) +
((AppLoader.debugTimers["Renderer.Tiling"] as? Long) ?: 0)
)
)
} }
@@ -660,11 +650,11 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
uiContainer.forEach { uiContainer.forEach {
when (it) { when (it) {
is UICanvas -> it.update(Gdx.graphics.rawDeltaTime) is UICanvas -> it.update(Gdx.graphics.deltaTime)
is Id_UICanvasNullable -> it.get()?.update(Gdx.graphics.rawDeltaTime) is Id_UICanvasNullable -> it.get()?.update(Gdx.graphics.deltaTime)
} }
} }
//uiFixture?.update(Gdx.graphics.rawDeltaTime) //uiFixture?.update(Gdx.graphics.deltaTime)
// deal with the uiFixture being closed // deal with the uiFixture being closed
if (uiFixture?.isClosed == true) { uiFixture = null } if (uiFixture?.isClosed == true) { uiFixture = null }

View File

@@ -567,7 +567,7 @@ open class ActorHumanoid(
val timedJumpCharge = jumpFunc(MAX_JUMP_LENGTH, jmpCtr) val timedJumpCharge = jumpFunc(MAX_JUMP_LENGTH, jmpCtr)
forceVec.y -= getJumpAcc(jumpPower, timedJumpCharge) forceVec.y -= getJumpAcc(jumpPower, timedJumpCharge)
forceVec.y += getDrag(AppLoader.UPDATE_RATE, forceVec).y forceVec.y += getDrag(forceVec).y
simYPos += forceVec.y // ignoring all the fluid drag OTHER THAN THE AIR simYPos += forceVec.y // ignoring all the fluid drag OTHER THAN THE AIR

View File

@@ -36,7 +36,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
MinimapComposer.setWorld(Terrarum.ingame!!.world) MinimapComposer.setWorld(Terrarum.ingame!!.world)
MinimapComposer.update() MinimapComposer.update()
minimapRerenderTimer += Gdx.graphics.rawDeltaTime minimapRerenderTimer += Gdx.graphics.deltaTime
} }
override fun renderUI(batch: SpriteBatch, camera: Camera) { override fun renderUI(batch: SpriteBatch, camera: Camera) {

View File

@@ -144,7 +144,7 @@ class UIItemInventoryItemGrid(
// equip da shit // equip da shit
val itemEquipSlot = item.equipPosition val itemEquipSlot = item.equipPosition
if (itemEquipSlot == GameItem.EquipPosition.NULL) { if (itemEquipSlot == GameItem.EquipPosition.NULL) {
TODO("Equip position is NULL, does this mean it's single-consume items like a potion? (from item: \"$item\" with itemID: ${item?.originalID}/${item?.dynamicID})") TODO("Equip position is NULL, does this mean it's single-consume items like a potion? (from item: \"$item\" with itemID: ${item.originalID}/${item.dynamicID})")
} }
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
if (player != null) { if (player != null) {

View File

@@ -30,13 +30,13 @@ class UIVitalMetre(
private val gap = 4f private val gap = 4f
override var width: Int = 80 + 2 * margin; set(value) { throw Error("operation not permitted") } override var width: Int = 80 + 2 * margin; set(value) { throw Error("operation not permitted") }
override var height: Int; get() = player.baseHitboxH ?: 0 * 3 + margin; set(value) { throw Error("operation not permitted") } override var height: Int; get() = player.baseHitboxH; set(value) { throw Error("operation not permitted") }
override var openCloseTime: Second = 0.05f override var openCloseTime: Second = 0.05f
//private val relativePX = width / 2f //private val relativePX = width / 2f
private val offsetY: Float; get() = (player.baseHitboxH ?: 0) * 1.5f private val offsetY: Float; get() = player.baseHitboxH * 1.5f
private val circleRadius: Float; get() = (player.baseHitboxH ?: 0) * 3f private val circleRadius: Float; get() = player.baseHitboxH * 3f
private val theta = 33f private val theta = 33f
private val halfTheta = theta / 2f private val halfTheta = theta / 2f

View File

@@ -49,7 +49,7 @@ object SavegameWriter {
private lateinit var playerName: String private lateinit var playerName: String
operator fun invoke(pnameOverride: String? = null): Boolean { operator fun invoke(pnameOverride: String? = null): Boolean {
playerName = pnameOverride ?: "${Terrarum.ingame!!.actorGamer!!.actorValue[AVKey.NAME]}" playerName = pnameOverride ?: "${Terrarum.ingame!!.actorGamer.actorValue[AVKey.NAME]}"
if (playerName.isEmpty()) playerName = "Test subject ${Math.random().times(0x7FFFFFFF).roundToInt()}" if (playerName.isEmpty()) playerName = "Test subject ${Math.random().times(0x7FFFFFFF).roundToInt()}"
try { try {
@@ -71,7 +71,7 @@ object SavegameWriter {
val creationDate = System.currentTimeMillis() / 1000L val creationDate = System.currentTimeMillis() / 1000L
val ingame = Terrarum.ingame!! val ingame = Terrarum.ingame!!
val gameworld = ingame.world val gameworld = ingame.world
val player = ingame.actorGamer!! val player = ingame.actorGamer
val disk = VDUtil.createNewDisk(0x7FFFFFFFFFFFFFFFL, "Tesv-$playerName", charset) val disk = VDUtil.createNewDisk(0x7FFFFFFFFFFFFFFFL, "Tesv-$playerName", charset)
val ROOT = disk.root.entryID val ROOT = disk.root.entryID

View File

@@ -39,7 +39,7 @@ class UIElemTest : ApplicationAdapter() {
override fun render() { override fun render() {
ui.update(Gdx.graphics.rawDeltaTime) ui.update(Gdx.graphics.deltaTime)
ui.render(batch, camera) ui.render(batch, camera)
} }

View File

@@ -96,37 +96,37 @@ class UIItemIntSlider(
get() = super.mouseOverCall get() = super.mouseOverCall
override var updateListener: ((Float) -> Unit)? override var updateListener: ((Float) -> Unit)?
get() = super.updateListener get() = super.updateListener
set(value) {} set(_) {}
override var keyDownListener: ((Int) -> Unit)? override var keyDownListener: ((Int) -> Unit)?
get() = super.keyDownListener get() = super.keyDownListener
set(value) {} set(_) {}
override var keyUpListener: ((Int) -> Unit)? override var keyUpListener: ((Int) -> Unit)?
get() = super.keyUpListener get() = super.keyUpListener
set(value) {} set(_) {}
override var mouseMovedListener: ((Int, Int) -> Unit)? override var mouseMovedListener: ((Int, Int) -> Unit)?
get() = super.mouseMovedListener get() = super.mouseMovedListener
set(value) {} set(_) {}
override var touchDraggedListener: ((Int, Int, Int) -> Unit)? override var touchDraggedListener: ((Int, Int, Int) -> Unit)?
get() = super.touchDraggedListener get() = super.touchDraggedListener
set(value) {} set(_) {}
override var touchDownListener: ((Int, Int, Int, Int) -> Unit)? override var touchDownListener: ((Int, Int, Int, Int) -> Unit)?
get() = super.touchDownListener get() = super.touchDownListener
set(value) {} set(_) {}
override var touchUpListener: ((Int, Int, Int, Int) -> Unit)? override var touchUpListener: ((Int, Int, Int, Int) -> Unit)?
get() = super.touchUpListener get() = super.touchUpListener
set(value) {} set(_) {}
override var scrolledListener: ((Float, Float) -> Unit)? override var scrolledListener: ((Float, Float) -> Unit)?
get() = super.scrolledListener get() = super.scrolledListener
set(value) {} set(_) {}
override var clickOnceListener: ((Int, Int, Int) -> Unit)? override var clickOnceListener: ((Int, Int, Int) -> Unit)?
get() = super.clickOnceListener get() = super.clickOnceListener
set(value) {} set(_) {}
override var clickOnceListenerFired: Boolean override var clickOnceListenerFired: Boolean
get() = super.clickOnceListenerFired get() = super.clickOnceListenerFired
set(value) {} set(_) {}
override var controllerInFocus: Boolean override var controllerInFocus: Boolean
get() = super.controllerInFocus get() = super.controllerInFocus
set(value) {} set(_) {}
override fun dispose() { override fun dispose() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. TODO("not implemented") //To change body of created functions use File | Settings | File Templates.

View File

@@ -54,7 +54,7 @@ open class UIItemTransitionContainer(
} }
if (transitionOngoing) { if (transitionOngoing) {
transitionTimer += Gdx.graphics.rawDeltaTime transitionTimer += Gdx.graphics.deltaTime
currentPosition = UIUtils.moveLinear(transitionReqSource, transitionReqTarget, transitionTimer, transitionLength) currentPosition = UIUtils.moveLinear(transitionReqSource, transitionReqTarget, transitionTimer, transitionLength)

View File

@@ -193,7 +193,7 @@ internal object WeatherMixer : RNGConsumer {
// 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 // 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.bind()
IngameRenderer.shaderSkyboxFill.setUniformMatrix("u_projTrans", camera.combined) IngameRenderer.shaderSkyboxFill.setUniformMatrix("u_projTrans", camera.combined)
IngameRenderer.shaderSkyboxFill.setUniformf("topColor", topCol.r, topCol.g, topCol.b) IngameRenderer.shaderSkyboxFill.setUniformf("topColor", topCol.r, topCol.g, topCol.b)
IngameRenderer.shaderSkyboxFill.setUniformf("bottomColor", bottomCol.r, bottomCol.g, bottomCol.b) IngameRenderer.shaderSkyboxFill.setUniformf("bottomColor", bottomCol.r, bottomCol.g, bottomCol.b)
@@ -201,7 +201,6 @@ internal object WeatherMixer : RNGConsumer {
IngameRenderer.shaderSkyboxFill.setUniformf("parallax_size", 1f/3f) IngameRenderer.shaderSkyboxFill.setUniformf("parallax_size", 1f/3f)
IngameRenderer.shaderSkyboxFill.setUniformf("zoomInv", 1f / (Terrarum.ingame?.screenZoom ?: 1f)) IngameRenderer.shaderSkyboxFill.setUniformf("zoomInv", 1f / (Terrarum.ingame?.screenZoom ?: 1f))
AppLoader.fullscreenQuad.render(IngameRenderer.shaderSkyboxFill, GL20.GL_TRIANGLES) AppLoader.fullscreenQuad.render(IngameRenderer.shaderSkyboxFill, GL20.GL_TRIANGLES)
IngameRenderer.shaderSkyboxFill.end()
*/ */

View File

@@ -605,7 +605,7 @@ internal object BlocksDrawer {
tileAtlas.texture.bind(0) // for some fuck reason, it must be bound as last tileAtlas.texture.bind(0) // for some fuck reason, it must be bound as last
} }
shader.begin() shader.bind()
shader.setUniformMatrix("u_projTrans", projectionMatrix)//camera.combined) shader.setUniformMatrix("u_projTrans", projectionMatrix)//camera.combined)
shader.setUniform2fv("tilesInAtlas", AppLoader.tileMaker.SHADER_SIZE_KEYS, 2, 2) shader.setUniform2fv("tilesInAtlas", AppLoader.tileMaker.SHADER_SIZE_KEYS, 2, 2)
shader.setUniform2fv("atlasTexSize", AppLoader.tileMaker.SHADER_SIZE_KEYS, 0, 2) shader.setUniform2fv("atlasTexSize", AppLoader.tileMaker.SHADER_SIZE_KEYS, 0, 2)
@@ -628,7 +628,6 @@ internal object BlocksDrawer {
shader.setUniformf("mulBlendIntensity", if (mode == OCCLUSION) occlusionIntensity else 1f) shader.setUniformf("mulBlendIntensity", if (mode == OCCLUSION) occlusionIntensity else 1f)
//shader.setUniformf("drawBreakage", if (mode == WIRE) 0f else 1f) //shader.setUniformf("drawBreakage", if (mode == WIRE) 0f else 1f)
tilesQuad.render(shader, GL20.GL_TRIANGLES) tilesQuad.render(shader, GL20.GL_TRIANGLES)
shader.end()
//tilesBufferAsTex.dispose() //tilesBufferAsTex.dispose()
} }