From c4521b9fd92733959fa5a588db4a8520a17f4c6e Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 28 Feb 2020 05:14:13 +0900 Subject: [PATCH] more comments --- src/net/torvald/UnsafePtr.kt | 3 +++ src/net/torvald/gdx/graphics/Cvec.kt | 7 +++++++ src/net/torvald/gdx/graphics/UnsafeCvecArray.kt | 5 +++++ .../torvald/terrarum/worlddrawer/LightmapRendererNew.kt | 4 ++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/net/torvald/UnsafePtr.kt b/src/net/torvald/UnsafePtr.kt index c87af48b7..a12b65069 100644 --- a/src/net/torvald/UnsafePtr.kt +++ b/src/net/torvald/UnsafePtr.kt @@ -4,6 +4,9 @@ import net.torvald.terrarum.printStackTrace import sun.misc.Unsafe /** + * Further read: + * - http://www.docjar.com/docs/api/sun/misc/Unsafe.html + * * Created by minjaesong on 2019-06-21. */ diff --git a/src/net/torvald/gdx/graphics/Cvec.kt b/src/net/torvald/gdx/graphics/Cvec.kt index c346d66f2..0812895eb 100644 --- a/src/net/torvald/gdx/graphics/Cvec.kt +++ b/src/net/torvald/gdx/graphics/Cvec.kt @@ -19,6 +19,13 @@ package net.torvald.gdx.graphics import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.utils.NumberUtils +/** + * A Cvec is kind of a Vector4f made compatible with LibGdx's Color class, with the intention of actually utilising + * the JEP 338 VectorInstrinsics later, when the damned thing finally releases. + * + * Before then, the code will be identical to LibGdx's. + */ + /** A color class, holding the r, g, b and alpha component as floats in the range [0,1]. All methods perform clamping on the * internal values after execution. * diff --git a/src/net/torvald/gdx/graphics/UnsafeCvecArray.kt b/src/net/torvald/gdx/graphics/UnsafeCvecArray.kt index bea65cffb..2c15ccece 100644 --- a/src/net/torvald/gdx/graphics/UnsafeCvecArray.kt +++ b/src/net/torvald/gdx/graphics/UnsafeCvecArray.kt @@ -2,6 +2,11 @@ package net.torvald.gdx.graphics import net.torvald.UnsafeHelper +/** + * Basically just a FloatArray. You may need to re-write the entire code to actually store the Vectors, + * maybe in the form of array of objects. + */ + /** * Created by minjaesong on 2019-06-21. */ diff --git a/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt b/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt index 14a422b7b..3dd6df90d 100644 --- a/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt +++ b/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt @@ -102,7 +102,7 @@ object LightmapRenderer { //private var lightmap: Array = Array(LIGHTMAP_WIDTH * LIGHTMAP_HEIGHT) { Cvec(0) } // Can't use framebuffer/pixmap -- this is a fvec4 array, whereas they are ivec4. private val lanternMap = HashMap((Terrarum.ingame?.ACTORCONTAINER_INITIAL_SIZE ?: 2) * 4) - private val lightsourceMap = ArrayList>(256) + //private val lightsourceMap = ArrayList>(256) init { LightmapHDRMap.invoke() @@ -235,7 +235,7 @@ object LightmapRenderer { // when disabled, light will "decay out" instead of "instantly out", which can have a cool effect // but the performance boost is measly 0.1 ms on 6700K lightmap.zerofill() - lightsourceMap.clear() + //lightsourceMap.clear() // pre-seed the lightmap with known value