From f1df7c20129a1f1cc47c47e5731efd10f8e49aeb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 25 Oct 2022 16:37:58 +0200 Subject: rename in draw/ --- draw/wireframe-mesh.cpp | 55 ------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 draw/wireframe-mesh.cpp (limited to 'draw/wireframe-mesh.cpp') diff --git a/draw/wireframe-mesh.cpp b/draw/wireframe-mesh.cpp deleted file mode 100644 index 55af19a1..00000000 --- a/draw/wireframe-mesh.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "wireframe-mesh.hpp" -#include "shaders/tile-shader.hpp" -//#include -#include -#include -#include -//#include -#include -#include -//#include -#include - -namespace floormat::wireframe -{ - -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::Texture2D tex; - tex.setWrapping(GL::SamplerWrapping::ClampToEdge) - .setMagnificationFilter(GL::SamplerFilter::Nearest) - .setMinificationFilter(GL::SamplerFilter::Nearest) - .setStorage(1, GL::textureFormat(img.format()), img.size()) - .setSubImage(0, {}, std::move(img)); - return tex; -} - -mesh_base::mesh_base(GL::MeshPrimitive primitive, ArrayView index_data, - std::size_t num_vertices, std::size_t num_indexes) : - _vertex_buffer{Containers::Array{ValueInit, num_vertices}, GL::BufferUsage::DynamicDraw}, - _texcoords_buffer{Containers::Array{ValueInit, num_vertices}}, - _index_buffer{num_indexes == 0 ? GL::Buffer{NoCreate} : GL::Buffer{index_data}} -{ - _mesh.setCount((int)(num_indexes > 0 ? num_indexes : num_vertices)) - .setPrimitive(primitive) - .addVertexBuffer(_vertex_buffer, 0, tile_shader::Position{}) - .addVertexBuffer(_texcoords_buffer, 0, tile_shader::TextureCoordinates{}); - if (num_indexes > 0) - _mesh.setIndexBuffer(_index_buffer, 0, GL::MeshIndexType::UnsignedShort); -} - -void mesh_base::draw(tile_shader& shader) -{ - _texture.bind(0); - shader.draw(_mesh); -} - -void mesh_base::set_subdata(ArrayView array) -{ - _vertex_buffer.setSubData(0, array); -} - -} // namespace floormat::wireframe -- cgit v1.2.3