fixed model asset cloning

This commit is contained in:
devZoGok
2022-03-19 21:10:45 +02:00
parent 95815c9ea3
commit 2cfafd7de6
6 changed files with 64 additions and 52 deletions
+5 -7
View File
@@ -20,14 +20,12 @@ using namespace std;
using namespace Assimp;
namespace vb01{
Model::Model(string path) : Node(((ModelAsset*)AssetManager::getSingleton()->getAsset(path))->rootNode){
vector<Node*> descendants;
getDescendants(descendants);
Model::Model(string path) : Node(){
ModelAsset *asset = ((ModelAsset*)AssetManager::getSingleton()->getAsset(path));
Node *clonedRoot = asset->rootNode->clone();
for(Node *desc : descendants)
for(Mesh *mesh : desc->getMeshes()){
mesh->construct();
}
for(Node *child : clonedRoot->getChildren())
attachChild(child);
}
Model::~Model(){