Open Kevin-WangXing opened 6 years ago
Not sure if I understand your question. You could load each model in its own world and merge these worlds.
Was this the question?
I want load two models,finally in one world can control them do diffent motion
now use the function of mergeWithAnotherWorld,but have a problem ,two models cannot fully dispaly,
What do you mean with "fully display"? Have you tested both models if the contents are valid?
two models are valid, because I had serverally load every models. when I load two models, I found those models merger together, But I hope get two unbroken models, don't know how to deal with it. whether when I load models , also need to set coordinate? I neeed to control each model separately move. Thanks
Ah ok,
take a look here:
void GLC_World::mergeWithAnotherWorld(GLC_World& anotherWorld) { GLC_StructOccurrence pAnotherRoot= anotherWorld.rootOccurrence(); GLC_StructOccurrence pRoot= rootOccurrence(); if (pAnotherRoot->childCount() > 0) { QList<GLC_StructOccurrence*> childs= pAnotherRoot->children(); const int size= childs.size(); for (int i= 0; i < size; ++i) { pRoot->addChild(childs.at(i)->clone(m_pWorldHandle, false)); } pRoot->updateChildrenAbsoluteMatrix(); } else { pRoot->addChild(anotherWorld.rootOccurrence()->clone(m_pWorldHandle, false)); } }
So if you check for the added occurrences of the second model, you could modify the matrix of these to move them (never tried it, but should work)
yes, if want to control two models,must separate those, may modify matrix can work, however don't konw which function I should change, which function is right, saw most function,also test ,no work, can you give me some advices. thank U
You could use the instance (GLC_StructInstance) from an occurrence. It has methods for move, translate and direct matrix assignment.
I want to load two models,where this lib can load two models?Thanks