summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-04 18:57:29 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-04 18:57:29 +0200
commitf0c7d4d241d7b415e4ba0ef2c0198e127d789ef4 (patch)
tree6678a51b981a75c400e24e286f02ece3101671f9
parentb47d96ccd1ef1f424154511f7294ab969bd4f5ca (diff)
a
-rw-r--r--main.cpp8
-rw-r--r--shaders/tile-shader.vert2
-rw-r--r--tile-atlas.cpp4
3 files changed, 8 insertions, 6 deletions
diff --git a/main.cpp b/main.cpp
index fa312c6d..0f573dc5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -83,9 +83,11 @@ chunk app::make_test_chunk()
const auto& atlas = pt.x > N/2 && pt.y >= N/2 ? floor2 : floor1;
x.ground_image = { atlas, (std::uint8_t)(k % atlas->size()) };
});
- c[{N/2 + 1, N/2}].wall_north = { wall1, 0 };
- c[{N/2, N/2}].wall_north = { wall1, 0 };
- c[{N/2, N/2}].wall_west = { wall1, 0 };
+ constexpr auto C = N/2;
+ c[{C, C}].wall_north = { wall1, 0 };
+ c[{C, C}].wall_west = { floor1, 0 };
+ c[{C, C+1}].wall_north = { wall1, 0 };
+ c[{C+1, C}].wall_west = { floor1, 0 };
return c;
}
diff --git a/shaders/tile-shader.vert b/shaders/tile-shader.vert
index fe81ba3b..122b08f7 100644
--- a/shaders/tile-shader.vert
+++ b/shaders/tile-shader.vert
@@ -11,6 +11,6 @@ void main() {
frag_texcoords = texcoords;
float cx = 2/scale.x, cy = 2/scale.y;
- float x = -position.x, y = -position.y, z = position.z;
+ float x = -position.y, y = -position.x, z = position.z;
gl_Position = vec4((x-y+offset.x)*cx, (x+y+z*2)*cx*0.75-offset.y*cx, 0, 1);
}
diff --git a/tile-atlas.cpp b/tile-atlas.cpp
index 45b0bf5e..35aaddac 100644
--- a/tile-atlas.cpp
+++ b/tile-atlas.cpp
@@ -50,7 +50,7 @@ vertex_array_type tile_atlas::floor_quad(const Vector3 center, const Vector2 siz
}};
}
-vertex_array_type tile_atlas::wall_quad_N(const Vector3 center, const Vector3 size)
+vertex_array_type tile_atlas::wall_quad_W(const Vector3 center, const Vector3 size)
{
float x = size[0]*.5f, y = size[1]*.5f, z = size[2];
return {{
@@ -61,7 +61,7 @@ vertex_array_type tile_atlas::wall_quad_N(const Vector3 center, const Vector3 si
}};
}
-vertex_array_type tile_atlas::wall_quad_W(const Vector3 center, const Vector3 size)
+vertex_array_type tile_atlas::wall_quad_N(const Vector3 center, const Vector3 size)
{
float x = size[0]*.5f, y = size[1]*.5f, z = size[2];
return {{