Skip to content

Commit

Permalink
[gltf] Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmNotHanni committed Jul 28, 2021
1 parent c52f887 commit e968a89
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion include/inexor/vulkan-renderer/gltf2/gltf2_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ class Model {
public:
/// @brief Extract the model data from a model file.
/// @paran device The device wrapper
/// @param file The glTF2 model file
/// @param model The glTF2 model
Model(const wrapper::Device &device, const tinygltf::Model &model);

/// @brief Overloaded constructor which accepts ModelFile as argument
/// @paran device The device wrapper
/// @param model_file The glTF2 model file
Model(const wrapper::Device &device, const ModelFile &model_file);

[[nodiscard]] std::size_t texture_count() const noexcept {
return m_textures.size();
}
Expand Down
6 changes: 3 additions & 3 deletions src/vulkan-renderer/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ void Application::load_shaders() {

void Application::load_gltf_example_model() {

const std::string file_names[] = {"5_objects.gltf"};
const std::array<std::string, 1> file_names = {"5_objects.gltf"};

for (const auto file : file_names) {
for (const auto &file : file_names) {
try {
const std::string full_file_name = "assets/models/inexor/" + file;
gltf2::ModelFile gltf_file(full_file_name, "example model");
gltf2::Model example_model(*m_device, gltf_file.model());
gltf2::Model example_model(*m_device, gltf_file);
} catch (InexorException &exception) { spdlog::critical("{}", exception.what()); }
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/vulkan-renderer/gltf2/gltf2_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Model::Model(const wrapper::Device &device, const tinygltf::Model &model) : m_de
load_nodes();
}

Model::Model(const wrapper::Device &device, const ModelFile &model_file) : Model(device, model_file.model()) {}

void Model::load_textures() {
spdlog::debug("Loading {} glTF2 model textures", m_model.images.size());

Expand Down

0 comments on commit e968a89

Please sign in to comment.