From 35cf1d65b454985c38b1e00a91670663b1583670 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 2 Oct 2022 03:23:05 +0200 Subject: a --- main.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 81f6abf2..182ce5ec 100644 --- a/main.cpp +++ b/main.cpp @@ -4,27 +4,16 @@ #include "defs.hpp" #include "tile.hpp" #include "chunk.hpp" -#include "tile-mesh.hpp" +#include "floor-mesh.hpp" #include -#include -#include #include #include -#include -#include #include -#include #include -#include #include #include - -#include -#include -#include -#include #include namespace Magnum::Examples { @@ -74,7 +63,7 @@ struct app final : Platform::Application shared_tile_atlas wall1 = loader.tile_atlas("../share/game/images/metal2.tga", {2, 2}); chunk _chunk = make_test_chunk(); - tile_mesh _tile_mesh; + floor_mesh _floor_mesh; std::uint64_t time_ticks = 0, time_freq = SDL_GetPerformanceFrequency(); Vector2 camera_offset; @@ -103,8 +92,8 @@ void app::draw_chunk(chunk& c) for (std::size_t j = 0, k = 0; j < N; j++) for (std::size_t i = 0; i < N; i++, k++) - _tile_mesh.draw_floor_quad(_shader, c[k].ground_image, - {(float)(X*i), (float)(Y*j), 0}); + _floor_mesh.set_tile(c[k], {i, j}); + _floor_mesh.draw(_shader); } app::app(const Arguments& arguments): @@ -145,7 +134,7 @@ app::app(const Arguments& arguments): k++; } - _mesh.setCount((int)indices.size()) + _floor_mesh.setCount((int)indices.size()) .addVertexBuffer(GL::Buffer{vertices}, 0, tile_shader::Position{}, tile_shader::TextureCoordinates{}) .addVertexBuffer(GL::Buffer{c.sampler_array()}, 0, tile_shader::TextureID{}) -- cgit v1.2.3