mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-27 09:03:51 +00:00
Parallelize M2 bone matrix computation across worker threads
Split the M2 animation update loop into three phases: sequential animation state update, parallel bone matrix computation via std::async (when 32+ animated instances), and sequential particle update. Each thread processes a disjoint slice of instances so no synchronization is needed.
This commit is contained in:
parent
5bfe4b61aa
commit
249c4fa842
2 changed files with 61 additions and 4 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include <string>
|
||||
#include <optional>
|
||||
#include <random>
|
||||
#include <future>
|
||||
|
||||
namespace wowee {
|
||||
|
||||
|
|
@ -354,6 +355,9 @@ private:
|
|||
static constexpr size_t MAX_M2_PARTICLES = 4000;
|
||||
std::mt19937 particleRng_{123};
|
||||
|
||||
// Thread count for parallel bone animation
|
||||
uint32_t numAnimThreads_ = 1;
|
||||
|
||||
float interpFloat(const pipeline::M2AnimationTrack& track, float animTime, int seqIdx,
|
||||
const std::vector<pipeline::M2Sequence>& seqs,
|
||||
const std::vector<uint32_t>& globalSeqDurations);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue