From cbf7d23623b5bb2d2092cb6c86bc965138b4ea75 Mon Sep 17 00:00:00 2001 From: vimene Date: Tue, 3 Feb 2026 20:26:01 +0100 Subject: added mipmaps for the hw renderer, improvements This commit add mipmaps, but for now, mipmaps are generated on the gpu at runtime. We should generate them in advance. - added mipmaps for the hardware renderer - renamed stb_image.c to stb_image.cpp - add compiler flag to stb_image.cpp to prevent warning - added pipe notation for various objects to have all clipping functions be left to right. We need this for the time being because dot notation would considerably complicate the current implementation - small improvements --- src/o3d/mesh.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/o3d/mesh.cpp') diff --git a/src/o3d/mesh.cpp b/src/o3d/mesh.cpp index fc5ff78..c3314b4 100644 --- a/src/o3d/mesh.cpp +++ b/src/o3d/mesh.cpp @@ -21,7 +21,7 @@ struct VertexIndicesHasher { } }; -Mesh Mesh::plane(float width, float height) { +Mesh Mesh::plane(float width, float height) noexcept { const float w2 = width / 2, h2 = height / 2; return { @@ -50,18 +50,18 @@ Mesh Mesh::plane(float width, float height) { }; } -std::tuple, std::vector> Mesh::linearize_indices() const & { +std::tuple, std::vector> Mesh::linearize_indices() const & noexcept { std::unordered_map, size_t, VertexIndicesHasher<3>> unique_vertices; std::vector linearized_vertices; std::vector linearized_indices; - for (const auto& triangle_indices : this->indices) { + for (const auto& triangle_indices : indices) { for (const auto& vertex_indices : triangle_indices) { auto it = unique_vertices.find(vertex_indices); if (it == unique_vertices.end()) { - linearized_vertices.emplace_back(this->vertices[vertex_indices[0]], this->normals[vertex_indices[1]], this->uvs[vertex_indices[2]]); + linearized_vertices.emplace_back(vertices[vertex_indices[0]], normals[vertex_indices[1]], uvs[vertex_indices[2]]); size_t idx = linearized_vertices.size() - 1; - unique_vertices.emplace(vertex_indices, idx); + unique_vertices[vertex_indices] = idx; linearized_indices.emplace_back(idx); } else { linearized_indices.emplace_back((*it).second); -- cgit v1.2.3