Skip to content

Commit e968a89

Browse files
committed
[gltf] Small improvements
1 parent c52f887 commit e968a89

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

include/inexor/vulkan-renderer/gltf2/gltf2_model.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ class Model {
8282
public:
8383
/// @brief Extract the model data from a model file.
8484
/// @paran device The device wrapper
85-
/// @param file The glTF2 model file
85+
/// @param model The glTF2 model
8686
Model(const wrapper::Device &device, const tinygltf::Model &model);
8787

88+
/// @brief Overloaded constructor which accepts ModelFile as argument
89+
/// @paran device The device wrapper
90+
/// @param model_file The glTF2 model file
91+
Model(const wrapper::Device &device, const ModelFile &model_file);
92+
8893
[[nodiscard]] std::size_t texture_count() const noexcept {
8994
return m_textures.size();
9095
}

src/vulkan-renderer/application.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ void Application::load_shaders() {
188188

189189
void Application::load_gltf_example_model() {
190190

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

193-
for (const auto file : file_names) {
193+
for (const auto &file : file_names) {
194194
try {
195195
const std::string full_file_name = "assets/models/inexor/" + file;
196196
gltf2::ModelFile gltf_file(full_file_name, "example model");
197-
gltf2::Model example_model(*m_device, gltf_file.model());
197+
gltf2::Model example_model(*m_device, gltf_file);
198198
} catch (InexorException &exception) { spdlog::critical("{}", exception.what()); }
199199
}
200200
}

src/vulkan-renderer/gltf2/gltf2_model.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Model::Model(const wrapper::Device &device, const tinygltf::Model &model) : m_de
1414
load_nodes();
1515
}
1616

17+
Model::Model(const wrapper::Device &device, const ModelFile &model_file) : Model(device, model_file.model()) {}
18+
1719
void Model::load_textures() {
1820
spdlog::debug("Loading {} glTF2 model textures", m_model.images.size());
1921

0 commit comments

Comments
 (0)