From 07a0e09c5927478cf2efee663aeec5dbaf3645f1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 8 Dec 2023 20:00:19 +0100 Subject: w --- src/chunk-walls.cpp | 24 +++++++++++++++--------- src/wall-atlas.cpp | 1 + 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/chunk-walls.cpp b/src/chunk-walls.cpp index 77ab2673..8cfdaf64 100644 --- a/src/chunk-walls.cpp +++ b/src/chunk-walls.cpp @@ -119,26 +119,32 @@ template<> std::array chunk::make_wall_vertex_data std::array chunk::make_wall_vertex_data(float depth) { - auto top_right = Vector2{X , Y - depth }, + auto top_right = Vector2{X, Y - depth }, bottom_right = Vector2{top_right.x(), Y }, top_left = Vector2{-X, top_right.y() }, bottom_left = Vector2{top_left.x(), bottom_right.y() }; - // br tr - // tr tl - // bl br - // tl bl return {{ - { top_right.x(), top_right.y(), Z }, - { top_left.x(), top_left.y(), Z }, - { bottom_right.x(), bottom_right.y(), Z }, - { bottom_left.x(), bottom_left.y(), Z } + { top_right.x(), top_right.y(), Z }, // br tr + { top_left.x(), top_left.y(), Z }, // tr tl + { bottom_right.x(), bottom_right.y(), Z }, // bl br + { bottom_left.x(), bottom_left.y(), Z }, // tl bl }}; } // top west template<> std::array chunk::make_wall_vertex_data(float depth) { + auto top_right = Vector2{-X, -Y }, + top_left = Vector2{top_right.x() - depth, top_right.y() }, + bottom_right = Vector2{-X, Y }, + bottom_left = Vector2{bottom_right.x() - depth, bottom_right.y() }; + return {{ + { bottom_right.x(), bottom_right.y(), Z }, + { top_right.x(), top_right.y(), Z }, + { bottom_left.x(), bottom_left.y(), Z }, + { top_left.x(), top_left.y(), Z }, + }}; } // ----------------------- diff --git a/src/wall-atlas.cpp b/src/wall-atlas.cpp index e637007d..b08afbb3 100644 --- a/src/wall-atlas.cpp +++ b/src/wall-atlas.cpp @@ -45,6 +45,7 @@ wall_atlas::wall_atlas(wall_atlas_def def, String path, const ImageView2D& img) _info{std::move(def.header)}, _path{std::move(path)}, _direction_map{def.direction_map} { + // todo resolve `from_rotation` here _texture.setLabel(_path) .setWrapping(GL::SamplerWrapping::ClampToEdge) .setMagnificationFilter(GL::SamplerFilter::Nearest) -- cgit v1.2.3