gr2: align curve sampling with Granny 2.11 (loop window, cubic, degree 0)
- Curve::eval rebuilds the B-spline window like ConstructBSplineBuffers: clamped ends repeat the endpoint; underflow/overflow looping takes knots from the other end (+-duration, skipping the duplicated last knot); equal trailing knots get +1e-5. - Degree 3 (CubicCoefficients) supported; degrees 0..3 share one path. - Degree 0 takes the control of the first knot > t (SampleBSpline0 = pi[0]); DaKeyframes32f curves are marked keyframed and keep frame trunc(t/dt). - Loop flags threaded through BoneTrack::sample, Animation::sample_local and sample_pose; control_loop_state() mirrors GetControlLoopState. - Gr2ModelInstance::SetAnimationLoop(); animated attachments (fmod) loop. - Quaternion continuity stays on for every span (Granny: buffer path only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
86759bb726
commit
de8fa40098
@@ -53,6 +53,9 @@ public:
|
||||
bool LoadExternalAnimation(const std::string& anim_filepath);
|
||||
bool LoadExternalAnimationFromMemory(const uint8_t* data, size_t size);
|
||||
float GetAnimationDuration() const;
|
||||
// granny Control 的循环状态(gr2::control_loop_state)。循环播放的动作传 (true, true):
|
||||
// 首尾附近的 B 样条窗口跨到上一遍/下一遍取 knot,接缝处不再夹到端点。默认都不循环。
|
||||
void SetAnimationLoop(bool underflow_loop, bool overflow_loop);
|
||||
|
||||
// Bone queries & attachments
|
||||
bool GetBoneWorldTransform(const std::string& bone_name, float* out_matrix, float animation_time = -1.0f) const;
|
||||
@@ -99,6 +102,7 @@ private:
|
||||
mutable bool m_poseValid = false;
|
||||
mutable float m_poseTime = -1;
|
||||
mutable const gr2::Animation* m_poseAnimation = nullptr;
|
||||
bool m_loopUnderflow = false, m_loopOverflow = false;
|
||||
mutable std::vector<gr2::Mat4> m_worldPose, m_skinPose, m_trackPose, m_localPose;
|
||||
mutable std::vector<int> m_trackBones;
|
||||
mutable size_t m_poseEvaluations = 0;
|
||||
|
||||
Reference in New Issue
Block a user