mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-14 17:15:52 +08:00
handle not having default scene
This commit is contained in:
parent
cba75b9927
commit
215e1fae61
@ -701,10 +701,11 @@ static void DrawModel(tinygltf::Model &model) {
|
|||||||
DrawCurves(scene, it->second);
|
DrawCurves(scene, it->second);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
//If the glTF asset has at least one scene, and doesn't define a default one
|
||||||
// TODO(syoyo): Support non-default scenes.
|
//just show the first one we can find
|
||||||
assert(model.defaultScene >= 0);
|
assert(model.scenes.size() > 0);
|
||||||
const tinygltf::Scene &scene = model.scenes[model.defaultScene];
|
int scene_to_display = model.defaultScene > -1 ? model.defaultScene : 0;
|
||||||
|
const tinygltf::Scene &scene = model.scenes[scene_to_display];
|
||||||
for (size_t i = 0; i < scene.nodes.size(); i++) {
|
for (size_t i = 0; i < scene.nodes.size(); i++) {
|
||||||
DrawNode(model, model.nodes[scene.nodes[i]]);
|
DrawNode(model, model.nodes[scene.nodes[i]]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user