modified scene system
This commit is contained in:
@@ -61,7 +61,6 @@ std::shared_ptr<Model> ModelManager::load_from_file(std::string_view _path, bool
|
||||
model->materials.push_back(std::make_shared<Material>(mat));
|
||||
}
|
||||
|
||||
model->meshes.resize(scene->mNumMeshes);
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; i++) {
|
||||
aiMesh* aiMesh = scene->mMeshes[i];
|
||||
Mesh mesh{};
|
||||
@@ -80,22 +79,22 @@ std::shared_ptr<Model> ModelManager::load_from_file(std::string_view _path, bool
|
||||
return model;
|
||||
}
|
||||
|
||||
void process_ai_node(aiNode* aiNode, const aiScene* scene, glm::mat4 transform, ModelNode* node)
|
||||
void process_ai_node(aiNode* aiNode, const aiScene* scene, glm::mat4 transform, ModelNode& node)
|
||||
{
|
||||
const auto t = aiNode->mTransformation;
|
||||
transform = transform * glm::mat4(t.a1, t.a2, t.a3, t.a4, t.b1, t.b2, t.b3, t.b4, t.c1, t.c2, t.c3, t.c4, t.d1, t.d2, t.d3, t.d4);
|
||||
|
||||
node->transform = transform;
|
||||
node.transform = transform;
|
||||
|
||||
for (unsigned int i = 0; i < aiNode->mNumMeshes; i++) {
|
||||
node->meshIndices.push_back(aiNode->mMeshes[i]);
|
||||
node.meshIndices.push_back(aiNode->mMeshes[i]);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < aiNode->mNumChildren; i++)
|
||||
{
|
||||
ModelNode newNode{};
|
||||
process_ai_node(aiNode->mChildren[i], scene, transform, newNode);
|
||||
node->children.push_back(newNode);
|
||||
node.children.push_back(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user