diff --git a/src/net/torvald/gdx/graphics/Cvec.kt b/src/net/torvald/gdx/graphics/Cvec.kt index 0812895eb..6c552a334 100644 --- a/src/net/torvald/gdx/graphics/Cvec.kt +++ b/src/net/torvald/gdx/graphics/Cvec.kt @@ -34,10 +34,10 @@ import com.badlogic.gdx.utils.NumberUtils class Cvec { /** the red, green, blue and alpha components */ - var r: Float = 0.toFloat() - var g: Float = 0.toFloat() - var b: Float = 0.toFloat() - var a: Float = 0.toFloat() + var r: Float = 0f + var g: Float = 0f + var b: Float = 0f + var a: Float = 0f /** Constructs a new Cvec with all components set to 0. */ constructor() {} diff --git a/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt b/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt index b30846238..98738eb9c 100644 --- a/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt +++ b/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt @@ -286,34 +286,39 @@ object LightmapRenderer { fun r3() { // TODO test non-parallel swipeDiag = true - for (linx in -LIGHTMAP_HEIGHT + 1 until LIGHTMAP_WIDTH - 1) { - /* construct indices such that: - 56789ABC - 4 1 w-2 - 3 \---\---+ - 2 \\···\··| - 1 \\\···\·| - 0 \\\\···\| - h-2 \\\\\---\ + /* construct indices such that: + 56789ABC + 4 1 w-2 + 3 \---\---+ + 2 \\···\··| + 1 \\\···\·| + 0 \\\\···\| + h-2 \\\\\---\ - 0 (1, h-2) -> (1, h-2) - 1 (1, h-2-1) -> (2, h-2) - 2 (1, h-2-2) -> (3, h-2) - 3 (1, h-2-3) -> (4, h-2) - 4 (1, 1) -> (5, h-2) - 5 (2, 1) -> (6, h-2) - 6 (3, 1) -> (7, h-2) - 7 (4, 1) -> (8, h-2) - 8 (5, 1) -> (w-2, h-2) - 9 (6, 1) -> (w-2, h-2-1) - 10 (7, 1) -> (w-2, h-2-2) - 11 (8, 1) -> (w-2, h-2-3) - 12 (w-2, 1) -> (w-2, 1) + 0 (1, h-2) -> (1, h-2) + 1 (1, h-2-1) -> (2, h-2) + 2 (1, h-2-2) -> (3, h-2) + 3 (1, h-2-3) -> (4, h-2) + 4 (1, 1) -> (5, h-2) - number of indices: internal_width + internal_height - 1 - */ + 5 (2, 1) -> (6, h-2) + 6 (3, 1) -> (7, h-2) + 7 (4, 1) -> (8, h-2) + 8 (5, 1) -> (w-2, h-2) - TODO() + 9 (6, 1) -> (w-2, h-2-1) + 10 (7, 1) -> (w-2, h-2-2) + 11 (8, 1) -> (w-2, h-2-3) + 12 (w-2, 1) -> (w-2, 1) + + number of indices: internal_width + internal_height - 1 + */ + for (i in 0 until LIGHTMAP_WIDTH + LIGHTMAP_HEIGHT - 5) { + swipeLight( + maxOf(1, i - LIGHTMAP_HEIGHT - 2 + 2), maxOf(1, LIGHTMAP_HEIGHT - 2 - i), + minOf(LIGHTMAP_WIDTH - 2, i + 1), minOf(LIGHTMAP_HEIGHT - 2, (LIGHTMAP_WIDTH + LIGHTMAP_HEIGHT - 5) - i), + 1, 1 + ) } } @@ -333,7 +338,7 @@ object LightmapRenderer { //r3();r4();r1();r2();r3(); - r1();r2();//r3() + r1();r2();r3() } } else if (world.worldIndex != -1) { // to avoid updating on the null world