From 84ba063908639ad94db4c2e3b7f64c8412426232 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 26 Oct 2024 14:11:23 +0300 Subject: [PATCH] apply model offset to meshes --- src/coders/vec3.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/coders/vec3.cpp b/src/coders/vec3.cpp index a6c68927..d6fb5c08 100644 --- a/src/coders/vec3.cpp +++ b/src/coders/vec3.cpp @@ -177,6 +177,13 @@ static Model load_model( util::Buffer chars(nameLength); reader.get(chars.data(), nameLength); std::string name(chars.data(), nameLength); + + glm::vec3 offset {x, y, z}; + for (auto& mesh : meshes) { + for (auto& vertex : mesh.vertices) { + vertex.coord -= offset; + } + } return Model {std::move(name), model::Model {std::move(meshes)}, {x, y, z}}; }