diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-15 22:21:17 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-15 22:21:17 +0200 |
commit | d5955d35b9fd32b31b4cd7b5b6f286e1b9c43494 (patch) | |
tree | 1f6893c7c7177088d6fd7166d78b87262ec201dc /draw | |
parent | 1e8d16fe10917664f9520008f224f19692c3a668 (diff) |
a
Diffstat (limited to 'draw')
-rw-r--r-- | draw/wall-mesh.cpp | 4 | ||||
-rw-r--r-- | draw/wall-mesh.hpp | 2 | ||||
-rw-r--r-- | draw/wireframe-mesh.cpp | 9 | ||||
-rw-r--r-- | draw/wireframe-mesh.hpp | 6 |
4 files changed, 10 insertions, 11 deletions
diff --git a/draw/wall-mesh.cpp b/draw/wall-mesh.cpp index 81201598..c15be873 100644 --- a/draw/wall-mesh.cpp +++ b/draw/wall-mesh.cpp @@ -2,7 +2,7 @@ #include "tile-atlas.hpp" #include "shaders/tile-shader.hpp" #include "chunk.hpp" -#include <Magnum/GL/RectangleTexture.h> +#include <Magnum/GL/Texture.h> #include <Magnum/GL/MeshView.h> namespace floormat { @@ -49,7 +49,7 @@ void wall_mesh::draw(tile_shader& shader, chunk& c) _vertex_buffer.setSubData(0, data); } - const GL::RectangleTexture* last_texture = nullptr; + const GL::Texture2D* last_texture = nullptr; Magnum::GL::MeshView mesh{_mesh}; for (std::size_t i = 0; i < COUNT; i++) { diff --git a/draw/wall-mesh.hpp b/draw/wall-mesh.hpp index 364f3831..b021ef95 100644 --- a/draw/wall-mesh.hpp +++ b/draw/wall-mesh.hpp @@ -27,7 +27,7 @@ private: using quad = std::array<vertex, 4>; using vertex_array = std::array<quad, COUNT>; - using texture_array = std::array<GL::RectangleTexture*, COUNT>; + using texture_array = std::array<GL::Texture2D*, COUNT>; static void maybe_add_tile(vertex_array& data, texture_array& textures, tile& x, std::size_t pos); static void add_wall(vertex_array& data, texture_array& textures, tile_image& img, std::size_t pos); diff --git a/draw/wireframe-mesh.cpp b/draw/wireframe-mesh.cpp index 0b6846d7..b0ba7676 100644 --- a/draw/wireframe-mesh.cpp +++ b/draw/wireframe-mesh.cpp @@ -12,18 +12,17 @@ namespace floormat::wireframe { -GL::RectangleTexture mesh_base::make_constant_texture() +GL::Texture2D mesh_base::make_constant_texture() { const Vector4ub data[] = { {255, 255, 255, 255} }; Trade::ImageData2D img{PixelFormat::RGBA8Unorm, {1, 1}, {}, Containers::arrayView(data, 1), {}, {}}; - GL::RectangleTexture tex; + GL::Texture2D tex; tex.setWrapping(GL::SamplerWrapping::ClampToEdge) .setMagnificationFilter(GL::SamplerFilter::Nearest) .setMinificationFilter(GL::SamplerFilter::Nearest) - .setMaxAnisotropy(1) - .setStorage(GL::textureFormat(img.format()), img.size()) - .setSubImage({}, std::move(img)); + .setStorage(1, GL::textureFormat(img.format()), img.size()) + .setSubImage(0, {}, std::move(img)); return tex; } diff --git a/draw/wireframe-mesh.hpp b/draw/wireframe-mesh.hpp index bd15a0bf..40471f8d 100644 --- a/draw/wireframe-mesh.hpp +++ b/draw/wireframe-mesh.hpp @@ -7,7 +7,7 @@ #include <Magnum/Math/Vector2.h> #include <Magnum/GL/Buffer.h> #include <Magnum/GL/Mesh.h> -#include "Magnum/GL/RectangleTexture.h" +#include "Magnum/GL/Texture.h" namespace floormat { @@ -28,9 +28,9 @@ concept traits = requires (const T& x) { struct mesh_base { - static GL::RectangleTexture make_constant_texture(); + static GL::Texture2D make_constant_texture(); GL::Buffer _vertex_buffer{{}, GL::BufferUsage::DynamicDraw}, _texcoords_buffer, _index_buffer; - GL::RectangleTexture _texture = make_constant_texture(); + GL::Texture2D _texture = make_constant_texture(); GL::Mesh _mesh; mesh_base(GL::MeshPrimitive primitive, Containers::ArrayView<const void> index_data, |