From 4e4875b5d7ed03b1b3c06127c991ead0c097c719 Mon Sep 17 00:00:00 2001 From: DBotThePony <dbotthepony@yandex.ru> Date: Sat, 2 Sep 2023 22:04:26 +0700 Subject: [PATCH] Bump kvector and kbox2d --- build.gradle.kts | 4 ++-- .../client/gl/shader/GLShaderProgram.kt | 2 +- .../kstarbound/client/render/Box2DRenderer.kt | 1 + .../ru/dbotthepony/kstarbound/world/Chunk.kt | 15 ++++++--------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7d6c6f61..ba812533 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -80,8 +80,8 @@ dependencies { implementation("net.java.dev.jna:jna:5.13.0") implementation("com.github.jnr:jnr-ffi:2.2.13") - implementation("ru.dbotthepony:kbox2d:2.4.1.2") - implementation("ru.dbotthepony:kvector:2.2.4") + implementation("ru.dbotthepony:kbox2d:2.4.1.6") + implementation("ru.dbotthepony:kvector:2.2.8") implementation("com.github.ben-manes.caffeine:caffeine:3.1.5") } diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLShaderProgram.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLShaderProgram.kt index e811e8bd..c917278e 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLShaderProgram.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLShaderProgram.kt @@ -196,7 +196,7 @@ open class GLShaderProgram(val state: GLStateTracker, shaders: Iterable<GLStateT state.ensureSameThread() buff4x4.position(0) - value.storeColumnRow(buff4x4) + value.storeRowColumn(buff4x4) buff4x4.position(0) _value.position(0) diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/client/render/Box2DRenderer.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/client/render/Box2DRenderer.kt index 6eef5479..e70c5053 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/client/render/Box2DRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/client/render/Box2DRenderer.kt @@ -14,6 +14,7 @@ class Box2DRenderer(val state: GLStateTracker) : IDebugDraw { override var drawShapes: Boolean = false override var drawJoints: Boolean = false override var drawAABB: Boolean = false + override var drawTreeAABB: Boolean = false override var drawPairs: Boolean = false override var drawCenterOfMess: Boolean = false diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt index 64ae790e..1ff7906a 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt @@ -205,6 +205,7 @@ abstract class Chunk<WorldType : World<WorldType, This>, This : Chunk<WorldType, changeset++ collisionChangeset++ this@Chunk.changeset++ + markPhysicsDirty() } override fun randomLongFor(x: Int, y: Int): Long { @@ -215,20 +216,16 @@ abstract class Chunk<WorldType : World<WorldType, This>, This : Chunk<WorldType, val foreground = TileLayer() val background = TileLayer() - protected val liquidStates: TwoDimensionalArray<LiquidState> = TwoDimensionalArray(CHUNK_SIZE, CHUNK_SIZE) + protected val liquidStates: Object2DArray<LiquidState?> = Object2DArray.nulls(CHUNK_SIZE, CHUNK_SIZE) fun getLiquid(x: Int, y: Int) = liquidStates[x, y] fun setLiquid(x: Int, y: Int, value: LiquidDefinition?): LiquidState? { if (value == null) { - val old = liquidStates.set(x, y, null) - - if (old != null) { - changeset++ - liquidChangeset++ - } - - return old + liquidStates.set(x, y, null) + changeset++ + liquidChangeset++ + return null } val state = LiquidState(value)