Skip to content

Commit

Permalink
Warning about non-support for non-skeletal glTF animation.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimi309 committed Sep 30, 2023
1 parent d7657f5 commit 6ed99e0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ and the use of cutting edge methods and technologies.
- Font rendering
- Sound (ogg and native files)
- Collision detection
- Frame-based animation
- Skeletal animation (only based on rigs read from glb files; animation linked directly to models without bones/joints is ignored)
- Frame-based animation (Wavefront)
- Skeletal animation (glTF)

# Partly humorous list of things NOT supported

- Animation read from glTF and linked directly to models without bones/joints
- Non-PNG images
- Scenes - no Scene data structure; just SceneObjects rendered in an infinite space
- Ray tracing
- ECS
Expand Down
22 changes: 21 additions & 1 deletion src/GlbFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,24 @@ namespace small3d {
model.origTransformation = tmpNode.transformation * model.origTransformation;
}


uint32_t animationIdx = 0;
bool warnedNonSkeletal = false;
while (existAnimation(animationIdx)) {
auto animation = getAnimation(animationIdx);
for (auto& channel : animation.channels) {
if (channel.target.node == meshNode.index) {
LOGDEBUG("Non-skeletal animation ignored.");
warnedNonSkeletal = true;
break;
}
}
if (warnedNonSkeletal) {
break;
}
++animationIdx;
}

if (!meshNode.noSkin && existSkin(meshNode.skin)) {

auto skin = getSkin(meshNode.skin);
Expand Down Expand Up @@ -1024,7 +1042,7 @@ namespace small3d {
bool inputStored = false;
uint32_t storedInput = 0;

uint32_t animationIdx = 0;
animationIdx = 0;
while (existAnimation(animationIdx)) {
auto animation = getAnimation(animationIdx);

Expand All @@ -1046,6 +1064,7 @@ namespace small3d {

auto output = getBufferByAccessor(sampler.output);


for (auto& joint : model.joints) {
if (joint.animations.size() < animationIdx + 1) {
joint.animations.emplace_back(Model::JointAnimation());
Expand Down Expand Up @@ -1096,6 +1115,7 @@ namespace small3d {
}
}
}

}
++animationIdx;
} // end existAnimation loop
Expand Down

0 comments on commit 6ed99e0

Please sign in to comment.