diff --git a/game/src/main/resources/shaders/block.glsl b/game/src/main/resources/shaders/block.glsl index 53d1b97d..84d8e56f 100644 --- a/game/src/main/resources/shaders/block.glsl +++ b/game/src/main/resources/shaders/block.glsl @@ -77,8 +77,6 @@ void main() { #pragma shader frag #define y60 0.866025403784439 -ivec2 triCoordsToStorage(in ivec2 triCoords); - struct FragInFlat { int blockTex; int faceIndex; @@ -122,10 +120,10 @@ void main() { int texOffset = (fragInFlat.blockTex >> (4 * (5 - ss)) & 0xffff) >> 12 & 15; // blockTex: 11112222333344445555 + 12 bits - vec2 tex = vec2(1 + px, 1) * factor * texSizef; - int texX = clamp(int(tex.x), 0, texSize * 2); + vec2 tex = vec2(min(1 + px, 1), min(1 - px, 1)) * factor * texSizef; + int texX = clamp(int(tex.x), 0, texSize - 1); int texY = clamp(int(tex.y), 0, texSize - 1); - ivec2 stCoords = triCoordsToStorage(ivec2(texX, texY)); + ivec2 stCoords = ivec2(int(tex.x), int(tex.y)); color = textureGrad( texSampler, vec3(vec2(stCoords) / texSizef, texDepth + texOffset), @@ -138,37 +136,3 @@ void main() { color.rgb *= (fragIn.brightness * 0.8 + 0.2) * visibility; } - -// Recursive storage format -ivec2 triCoordsToStorage(in ivec2 triCoords) { - int sx = 0; - int sy = 0; - int bsize = texSize; - int x = triCoords.x; - int y = triCoords.y; - int sign = 1; - - while (bsize > 0) { - int rest = y - bsize; - - if (y < bsize) { - } else if (x <= 2 * rest) { // left - sy += bsize * sign; - y = rest; - } else if (x >= 2 * bsize) { // right - sx += bsize * sign; - x -= 2 * bsize; - y = rest; - } else { - sx += (2 * bsize - 1) * sign; - sy += (2 * bsize - 1) * sign; - sign = -sign; - x = 2 * bsize - 1 - x; - y = bsize - 1 - rest; - } - - bsize >>= 1; - } - - return ivec2(sx, sy); -} diff --git a/game/src/main/resources/shaders/gui_block.glsl b/game/src/main/resources/shaders/gui_block.glsl index 88fb7eb5..c012358d 100644 --- a/game/src/main/resources/shaders/gui_block.glsl +++ b/game/src/main/resources/shaders/gui_block.glsl @@ -53,8 +53,6 @@ void main() { #pragma shader frag #define y60 0.866025403784439 -ivec2 triCoordsToStorage(in ivec2 triCoords); - struct FragInFlat { int blockTex; int faceIndex; @@ -96,10 +94,10 @@ void main() { int texOffset = (fragInFlat.blockTex >> (4 * (5 - ss)) & 0xffff) >> 12 & 15; // blockTex: 11112222333344445555 + 12 bits - vec2 tex = vec2(1 + px, 1) * factor * texSizef; - int texX = clamp(int(tex.x), 0, texSize * 2); + vec2 tex = vec2(min(1 + px, 1), min(1 - px, 1)) * factor * texSizef; + int texX = clamp(int(tex.x), 0, texSize - 1); int texY = clamp(int(tex.y), 0, texSize - 1); - ivec2 stCoords = triCoordsToStorage(ivec2(texX, texY)); + ivec2 stCoords = ivec2(int(tex.x), int(tex.y)); color = textureGrad( texSampler, @@ -112,37 +110,3 @@ void main() { color.rgb *= fragInFlat.brightness * visibility; } - -// Recursive storage format -ivec2 triCoordsToStorage(in ivec2 triCoords) { - int sx = 0; - int sy = 0; - int bsize = texSize; - int x = triCoords.x; - int y = triCoords.y; - int sign = 1; - - while (bsize > 0) { - int rest = y - bsize; - - if (y < bsize) { - } else if (x <= 2 * rest) { // left - sy += bsize * sign; - y = rest; - } else if (x >= 2 * bsize) { // right - sx += bsize * sign; - x -= 2 * bsize; - y = rest; - } else { - sx += (2 * bsize - 1) * sign; - sy += (2 * bsize - 1) * sign; - sign = -sign; - x = 2 * bsize - 1 - x; - y = bsize - 1 - rest; - } - - bsize >>= 1; - } - - return ivec2(sx, sy); -} diff --git a/game/src/main/resources/textures/blocks/grassTop.png b/game/src/main/resources/textures/blocks/grassTop.png index d654ab34..82ab17a0 100644 Binary files a/game/src/main/resources/textures/blocks/grassTop.png and b/game/src/main/resources/textures/blocks/grassTop.png differ diff --git a/game/src/main/resources/textures/blocks/log.png b/game/src/main/resources/textures/blocks/log.png index 1b206d65..84439be3 100644 Binary files a/game/src/main/resources/textures/blocks/log.png and b/game/src/main/resources/textures/blocks/log.png differ diff --git a/game/src/main/resources/textures/blocks/log_birch.png b/game/src/main/resources/textures/blocks/log_birch.png index f167f38d..319492b0 100644 Binary files a/game/src/main/resources/textures/blocks/log_birch.png and b/game/src/main/resources/textures/blocks/log_birch.png differ diff --git a/game/src/main/resources/textures/blocks/planks_top.png b/game/src/main/resources/textures/blocks/planks_top.png index ffae8216..8c5f5547 100644 Binary files a/game/src/main/resources/textures/blocks/planks_top.png and b/game/src/main/resources/textures/blocks/planks_top.png differ diff --git a/game/src/main/resources/textures/blocks/stoneTop.png b/game/src/main/resources/textures/blocks/stoneTop.png index cc95eaf0..fdd36770 100644 Binary files a/game/src/main/resources/textures/blocks/stoneTop.png and b/game/src/main/resources/textures/blocks/stoneTop.png differ diff --git a/game/src/main/resources/textures/blocks/tnt_top.png b/game/src/main/resources/textures/blocks/tnt_top.png index 9f85b84e..e755ffbf 100644 Binary files a/game/src/main/resources/textures/blocks/tnt_top.png and b/game/src/main/resources/textures/blocks/tnt_top.png differ diff --git a/game/src/test/scala/hexacraft/RootArchTest.scala b/game/src/test/scala/hexacraft/RootArchTest.scala index 585abea9..741bc03d 100644 --- a/game/src/test/scala/hexacraft/RootArchTest.scala +++ b/game/src/test/scala/hexacraft/RootArchTest.scala @@ -36,7 +36,6 @@ class RootArchTest extends FunSuite { // TODO: reduce package dependencies and update this test accordingly test("packages should not depend on too many other packages") { val root = "root" - val Text = "Text" val Game = "Game" val GUI = "GUI" val Infra = "Infra" @@ -44,6 +43,7 @@ class RootArchTest extends FunSuite { val Math = "Math" val Physics = "Physics" val Renderer = "Renderer" + val Text = "Text" val Util = "Util" val World = "World"