From 5a63062d8efb6a4bb9b75ca8b4346c1a9e8063e2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 01:55:23 +0000 Subject: [PATCH 1/5] Initial plan From 3c5169753f672a393bce7ce1c98eb517316ff8f5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 02:00:49 +0000 Subject: [PATCH 2/5] Fix animation system bugs: slerp components, keyframe sampling, function name, asset loading 1. Fix quaternion slerp (AnimSphericalLinear) component assignment - was using wrong components (w instead of y, duplicated w) 2. Fix AnimSampleChannel to properly extract keyframe data and compute interpolation parameter t from actual channel data instead of using uninitialized defaults 3. Fix function name mismatch: SphericalLinear -> AnimSphericalLinear 4. Fix AnimInterpolateLinear to use member operator* (T*float) instead of non-existent free function (float*T) 5. Fix copy-paste bug in AnimationAsset::Load - rotation time was loaded into position.time instead of rotation.time 6. Implement AnimationNodeChannel::Sample() with actual keyframe sampling 7. Add AnimNodeSampleResult struct for node channel sampling output Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com> --- .../adaptor/src/assets/AnimationAsset.cpp | 2 +- .../animation/core/AnimationInterpolation.h | 20 +++++++++++++------ .../animation/core/AnimationNodeChannel.h | 6 ++++++ .../src/croe/AnimationInterpolation.cpp | 6 +++--- .../src/croe/AnimationNodeChannel.cpp | 13 ++++++++++++ 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/runtime/render/adaptor/src/assets/AnimationAsset.cpp b/runtime/render/adaptor/src/assets/AnimationAsset.cpp index d83dcb38..05230fca 100644 --- a/runtime/render/adaptor/src/assets/AnimationAsset.cpp +++ b/runtime/render/adaptor/src/assets/AnimationAsset.cpp @@ -36,7 +36,7 @@ namespace sky { archive.LoadValue(channelSize); channel.rotation.time.resize(channelSize / sizeof(float)); - archive.LoadValue(reinterpret_cast(channel.position.time.data()), channelSize); + archive.LoadValue(reinterpret_cast(channel.rotation.time.data()), channelSize); archive.LoadValue(channelSize); channel.rotation.keys.resize(channelSize / sizeof(Quaternion)); diff --git a/runtime/render/animation/include/animation/core/AnimationInterpolation.h b/runtime/render/animation/include/animation/core/AnimationInterpolation.h index c9308ad6..d6e7a212 100644 --- a/runtime/render/animation/include/animation/core/AnimationInterpolation.h +++ b/runtime/render/animation/include/animation/core/AnimationInterpolation.h @@ -20,7 +20,7 @@ namespace sky { template T AnimInterpolateLinear(const T &vk, const T &vk1, float t) { - return (1 - t) * vk + t * vk1; + return vk * (1 - t) + vk1 * t; } Quaternion AnimSphericalLinear(const Quaternion &vk, const Quaternion &vk1, float t); @@ -38,22 +38,30 @@ namespace sky { } } - const T vk1 = {}; - const T vk2 = {}; - float t = 0.f; + if (k == 0) { + return data.keys[0]; + } + + if (k >= data.time.size()) { + return data.keys[data.keys.size() - 1]; + } + + const T &vk1 = data.keys[k - 1]; + const T &vk2 = data.keys[k]; + float t = (param.timePoint - data.time[k - 1]) / (data.time[k] - data.time[k - 1]); switch (param.interpolation) { case Interpolation::STEP: return vk1; - break; case Interpolation::CUBIC_SPLINE: // not supported yet. case Interpolation::LINEAR: if constexpr (std::is_same_v) { - return SphericalLinear(vk1, vk2, t); + return AnimSphericalLinear(vk1, vk2, t); } else { return AnimInterpolateLinear(vk1, vk2, t); } } + return data.keys[0]; } } // namespace sky \ No newline at end of file diff --git a/runtime/render/animation/include/animation/core/AnimationNodeChannel.h b/runtime/render/animation/include/animation/core/AnimationNodeChannel.h index b295f6b9..2e2b7a1b 100644 --- a/runtime/render/animation/include/animation/core/AnimationNodeChannel.h +++ b/runtime/render/animation/include/animation/core/AnimationNodeChannel.h @@ -22,6 +22,12 @@ namespace sky { AnimChannelData rotation; }; + struct AnimNodeSampleResult : AnimSampleResult { + Vector3 position = {0.f, 0.f, 0.f}; + Vector3 scale = {1.f, 1.f, 1.f}; + Quaternion rotation = {}; + }; + class AnimationNodeChannel : public AnimationChannel { public: explicit AnimationNodeChannel(const Name &name) : AnimationChannel(name) {} diff --git a/runtime/render/animation/src/croe/AnimationInterpolation.cpp b/runtime/render/animation/src/croe/AnimationInterpolation.cpp index bf3ee3bd..0bdc801c 100644 --- a/runtime/render/animation/src/croe/AnimationInterpolation.cpp +++ b/runtime/render/animation/src/croe/AnimationInterpolation.cpp @@ -23,10 +23,10 @@ namespace sky { } return { - k1 * vk.x + k2 * vk1.x, k1 * vk.w + k2 * vk1.w, - k1 * vk.z + k2 * vk1.z, - k1 * vk.w + k2 * vk1.w + k1 * vk.x + k2 * vk1.x, + k1 * vk.y + k2 * vk1.y, + k1 * vk.z + k2 * vk1.z }; } diff --git a/runtime/render/animation/src/croe/AnimationNodeChannel.cpp b/runtime/render/animation/src/croe/AnimationNodeChannel.cpp index 324a22d5..8d5572a0 100644 --- a/runtime/render/animation/src/croe/AnimationNodeChannel.cpp +++ b/runtime/render/animation/src/croe/AnimationNodeChannel.cpp @@ -16,6 +16,19 @@ namespace sky { void AnimationNodeChannel::Sample(const SampleParam ¶m, const AnimSampleResultPtr &ptr) { + auto *result = static_cast(ptr.Get()); + if (result == nullptr) { + return; + } + if (!position.time.empty()) { + result->position = AnimSampleChannel(position, param); + } + if (!scale.time.empty()) { + result->scale = AnimSampleChannel(scale, param); + } + if (!rotation.time.empty()) { + result->rotation = AnimSampleChannel(rotation, param); + } } } // namespace sky \ No newline at end of file From d0a1c9a307e0e874239a8ca0078a43354ea3fdc7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 02:01:56 +0000 Subject: [PATCH 3/5] Address code review: add assertions for null checks and unreachable fallback Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com> --- .../animation/include/animation/core/AnimationInterpolation.h | 1 + runtime/render/animation/src/croe/AnimationNodeChannel.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/runtime/render/animation/include/animation/core/AnimationInterpolation.h b/runtime/render/animation/include/animation/core/AnimationInterpolation.h index d6e7a212..f1be773c 100644 --- a/runtime/render/animation/include/animation/core/AnimationInterpolation.h +++ b/runtime/render/animation/include/animation/core/AnimationInterpolation.h @@ -61,6 +61,7 @@ namespace sky { return AnimInterpolateLinear(vk1, vk2, t); } } + SKY_ASSERT(false); return data.keys[0]; } diff --git a/runtime/render/animation/src/croe/AnimationNodeChannel.cpp b/runtime/render/animation/src/croe/AnimationNodeChannel.cpp index 8d5572a0..c3ab92c4 100644 --- a/runtime/render/animation/src/croe/AnimationNodeChannel.cpp +++ b/runtime/render/animation/src/croe/AnimationNodeChannel.cpp @@ -17,6 +17,7 @@ namespace sky { void AnimationNodeChannel::Sample(const SampleParam ¶m, const AnimSampleResultPtr &ptr) { auto *result = static_cast(ptr.Get()); + SKY_ASSERT(result != nullptr); if (result == nullptr) { return; } From ed3d422305970779f6d941961c89799fa236871f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 02:02:12 +0000 Subject: [PATCH 4/5] Final: animation system fixes complete Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com> --- _codeql_detected_source_root | 1 + 1 file changed, 1 insertion(+) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file From fb8323ff9748ec28985022a56b4f8e39aa27995c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 02:02:30 +0000 Subject: [PATCH 5/5] Remove CodeQL artifact and add to .gitignore Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com> --- .gitignore | 1 + _codeql_detected_source_root | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 120000 _codeql_detected_source_root diff --git a/.gitignore b/.gitignore index 9309668d..a38f0748 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /active_project /test/assets/assets.db /test/products/ +_codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root deleted file mode 120000 index 945c9b46..00000000 --- a/_codeql_detected_source_root +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file