Skip to content

Commit b53f6bc

Browse files
committed
Fixed animation end being cropped, cleanup
- fixed a bug that caused the end of animations to be cropped sometimes - removed COLLADA implementation - prepare loading data from vanilla game dump
1 parent 9f4738c commit b53f6bc

9 files changed

Lines changed: 89 additions & 841 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ CPMAddPackage(
3535
add_compile_definitions(cimg_display=0)
3636

3737
# --- Tools ---
38-
SET(SOURCE_FILES ${SOURCE_FILES} "src/main.cpp" "src/TIM.cpp" "src/Collada.cpp" "src/Animation.cpp" "src/CLUTMap.cpp"
38+
SET(SOURCE_FILES ${SOURCE_FILES} "src/main.cpp" "src/TIM.cpp" "src/Animation.cpp" "src/CLUTMap.cpp"
3939
"src/Model.cpp" "src/GLTF.cpp")
4040

4141
ADD_EXECUTABLE(DW1ModelConverter ${SOURCE_FILES})

src/Animation.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ Animation::Animation(const MMDAnimation& anim)
3535
momentumData.emplace_back();
3636
}
3737

38-
while (mtnFrame <= anim.frameCount)
38+
do
3939
{
4040
while (anim.instructions.size() > currentIndex && anim.instructions[currentIndex]->run(*this))
4141
currentIndex++;
4242

4343
mtnFrame++;
4444
keyFrame++;
4545
keyFrameTime = (keyFrame - 1) / 20.0f;
46-
}
46+
} while (mtnFrame < anim.frameCount);
4747

4848
for (uint32_t node = 0; node < momentumData.size(); node++)
4949
{
50-
setMomentum(Axis::SCALE_X, node, 0.0f);
51-
setMomentum(Axis::SCALE_Y, node, 0.0f);
52-
setMomentum(Axis::SCALE_Z, node, 0.0f);
53-
setMomentum(Axis::ROT_X, node, 0.0f);
54-
setMomentum(Axis::ROT_Y, node, 0.0f);
55-
setMomentum(Axis::ROT_Z, node, 0.0f);
56-
setMomentum(Axis::POS_X, node, 0.0f);
57-
setMomentum(Axis::POS_Y, node, 0.0f);
58-
setMomentum(Axis::POS_Z, node, 0.0f);
50+
updateData(Axis::SCALE_X, node);
51+
updateData(Axis::SCALE_Y, node);
52+
updateData(Axis::SCALE_Z, node);
53+
updateData(Axis::ROT_X, node);
54+
updateData(Axis::ROT_Y, node);
55+
updateData(Axis::ROT_Z, node);
56+
updateData(Axis::POS_X, node);
57+
updateData(Axis::POS_Y, node);
58+
updateData(Axis::POS_Z, node);
5959
}
6060
}
6161

0 commit comments

Comments
 (0)