mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Per-instance NPC hair/skin textures, fix binary search float comparison
- NPC hair/skin textures now use per-instance overrides instead of shared model-level textures, so each NPC shows its own hair color/style - Hair/skin DBC lookup runs for every NPC instance (including cached models) rather than only on first load - Fix keyframe binary search to use float comparison matching original linear scan semantics
This commit is contained in:
parent
e6acb4ac9a
commit
84b04446c1
3 changed files with 77 additions and 6 deletions
|
|
@ -1580,9 +1580,9 @@ int CharacterRenderer::findKeyframeIndex(const std::vector<uint32_t>& timestamps
|
|||
if (timestamps.empty()) return -1;
|
||||
if (timestamps.size() == 1) return 0;
|
||||
|
||||
// Binary search: find first element > t, then back up one
|
||||
uint32_t t = static_cast<uint32_t>(time);
|
||||
auto it = std::upper_bound(timestamps.begin(), timestamps.end(), t);
|
||||
// Binary search using float comparison to match original semantics exactly
|
||||
auto it = std::upper_bound(timestamps.begin(), timestamps.end(), time,
|
||||
[](float t, uint32_t ts) { return t < static_cast<float>(ts); });
|
||||
if (it == timestamps.begin()) return 0;
|
||||
size_t idx = static_cast<size_t>(it - timestamps.begin()) - 1;
|
||||
return static_cast<int>(std::min(idx, timestamps.size() - 2));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue