mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-11 15:23:51 +00:00
feat: use M2 animation duration for spell visual lifetime
Spell visual effects previously used a fixed 3.5s duration for all effects, causing some to linger too long and overlap during combat. Now queries the M2 model's default animation duration via the new getInstanceAnimDuration() method and clamps it to 0.5-5s. Effects without animations fall back to a 2s default. This makes spell impacts feel more responsive and reduces visual clutter.
This commit is contained in:
parent
29c938dec2
commit
90edb3bc07
4 changed files with 28 additions and 5 deletions
|
|
@ -3956,6 +3956,18 @@ void M2Renderer::setInstanceAnimationFrozen(uint32_t instanceId, bool frozen) {
|
|||
}
|
||||
}
|
||||
|
||||
float M2Renderer::getInstanceAnimDuration(uint32_t instanceId) const {
|
||||
auto idxIt = instanceIndexById.find(instanceId);
|
||||
if (idxIt == instanceIndexById.end()) return 0.0f;
|
||||
const auto& inst = instances[idxIt->second];
|
||||
if (!inst.cachedModel) return 0.0f;
|
||||
const auto& seqs = inst.cachedModel->sequences;
|
||||
if (seqs.empty()) return 0.0f;
|
||||
int seqIdx = inst.currentSequenceIndex;
|
||||
if (seqIdx < 0 || seqIdx >= static_cast<int>(seqs.size())) seqIdx = 0;
|
||||
return seqs[seqIdx].duration; // in milliseconds
|
||||
}
|
||||
|
||||
void M2Renderer::setInstanceTransform(uint32_t instanceId, const glm::mat4& transform) {
|
||||
auto idxIt = instanceIndexById.find(instanceId);
|
||||
if (idxIt == instanceIndexById.end()) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue