MCPcopy Create free account
hub / github.com/assimp/assimp / MergeScenes

Method MergeScenes

code/Common/SceneCombiner.cpp:178–210  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Merges two scenes. Currently only used by the LWS loader.

Source from the content-addressed store, hash-verified

176// ------------------------------------------------------------------------------------------------
177// Merges two scenes. Currently only used by the LWS loader.
178void SceneCombiner::MergeScenes(aiScene **_dest, std::vector<aiScene *> &src, unsigned int flags) {
179 if (nullptr == _dest) {
180 return;
181 }
182
183 // if _dest points to nullptr allocate a new scene. Otherwise clear the old and reuse it
184 if (src.empty()) {
185 if (*_dest) {
186 (*_dest)->~aiScene();
187 SceneCombiner::CopySceneFlat(_dest, src[0]);
188 } else
189 *_dest = src[0];
190 return;
191 }
192 if (*_dest) {
193 (*_dest)->~aiScene();
194 new (*_dest) aiScene();
195 } else
196 *_dest = new aiScene();
197
198 // Create a dummy scene to serve as master for the others
199 aiScene *master = new aiScene();
200 master->mRootNode = new aiNode();
201 master->mRootNode->mName.Set("<MergeRoot>");
202
203 std::vector<AttachmentInfo> srcList(src.size());
204 for (unsigned int i = 0; i < srcList.size(); ++i) {
205 srcList[i] = AttachmentInfo(src[i], master->mRootNode);
206 }
207
208 // 'master' will be deleted afterwards
209 MergeScenes(_dest, master, srcList, flags);
210}
211
212// ------------------------------------------------------------------------------------------------
213void SceneCombiner::AttachToGraph(aiNode *attach, std::vector<NodeAttachmentInfo> &srcList) {

Callers

nothing calls this directly

Calls 15

AttachmentInfoClass · 0.85
SceneHelperClass · 0.85
ai_snprintfFunction · 0.85
SuperFastHashFunction · 0.85
CopyFunction · 0.85
strtoul10Function · 0.85
ASSIMP_itoa10Function · 0.85
PrefixStringFunction · 0.85
~aiSceneMethod · 0.80
emplace_backMethod · 0.80
emptyMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected