gr2_render: cache part->parent bone map and parent bind pose

BuildDrawCommandsWithPalette recomputed gr2::bind_pose of the parent
skeleton and an O(part bones x parent bones) name match every frame for
every hair/armor part. Both depend only on the two skeletons; rebuild
them when the parent skeleton changes and reuse the palette buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-12 16:13:22 +09:00
co-authored by Claude Opus 5.5
parent a1b3938159
commit e354b92e08
2 changed files with 37 additions and 19 deletions
+6
View File
@@ -99,6 +99,12 @@ private:
std::vector<Gr2MeshDraw> m_gpuMain, m_gpuParts;
const gr2::Skeleton* m_gpuPartParent = nullptr;
size_t m_gpuPartPaletteSize = 0;
// Part bone -> parent bone by name, and the parent bind world per part bone; both depend only
// on the two skeletons, so they are rebuilt when the parent skeleton changes, not every frame.
const gr2::Skeleton* m_partMapParent = nullptr;
size_t m_partMapParentBones = 0;
std::vector<int> m_partToParent;
std::vector<gr2::Mat4> m_partParentBind, m_partSkin;
void EvaluatePose(float animation_time) const;
mutable bool m_poseValid = false;
mutable float m_poseTime = -1;