aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/mesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/o3d/mesh.cpp')
-rw-r--r--src/o3d/mesh.cpp10
1 files changed, 5 insertions, 5 deletions
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<engine::vk::Vertex>, std::vector<uint16_t>> Mesh::linearize_indices() const & {
+std::tuple<std::vector<engine::vk::Vertex>, std::vector<uint16_t>> Mesh::linearize_indices() const & noexcept {
std::unordered_map<std::array<size_t, 3>, size_t, VertexIndicesHasher<3>> unique_vertices;
std::vector<engine::vk::Vertex> linearized_vertices;
std::vector<uint16_t> 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);