Skip to content

Commit

Permalink
Fixed warnings on g++
Browse files Browse the repository at this point in the history
  • Loading branch information
gan74 committed Sep 28, 2024
1 parent 3d22f53 commit b765d3c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/Scene_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@

#include <iostream>

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#pragma GCC diagnostic ignored "-Wconversion"
#endif

#define TINYGLTF_IMPLEMENTATION
#define TINYGLTF_NO_STB_IMAGE_WRITE
#define TINYGLTF_NOEXCEPTION
#include <tinygltf/tiny_gltf.h>

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

namespace OM3D {

bool display_gltf_loading_warnings = false;
Expand Down Expand Up @@ -170,6 +180,15 @@ static Result<MeshData> build_mesh_data(const tinygltf::Model& gltf, const tinyg
}
}

AABB aabb = {};
if(!vertices.empty()) {
aabb.min = aabb.max = vertices[0].position;
for(size_t i = 1; i < vertices.size(); ++i) {
aabb.min = glm::min(aabb.min, vertices[i].position);
aabb.max = glm::max(aabb.max, vertices[i].position);
}
}


std::vector<u32> indices;
{
Expand All @@ -189,7 +208,7 @@ static Result<MeshData> build_mesh_data(const tinygltf::Model& gltf, const tinyg
}
}

return {true, MeshData{std::move(vertices), std::move(indices)}};
return {true, MeshData{std::move(vertices), std::move(indices), aabb}};
}

static Result<TextureData> build_texture_data(const tinygltf::Image& image, bool as_sRGB) {
Expand Down

0 comments on commit b765d3c

Please sign in to comment.