mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add M2 idle animation variations, dedup instances, fix terrain textures
- Add idle variation system: creatures randomly play Stand variations (stretch, flap, look around) every 4-10s, then return to idle loop - Deduplicate M2 instances at same position (was hidden before animation made duplicates visible with different random start times) - Adaptive M2 render distance: 350 units in open terrain, 180 in cities - Restore terrain sampler-to-unit uniform bindings lost during texture bind optimization (roads were invisible under grass) - Safety: clamp bone count to 128, validate sequence indices, sanitize scale
This commit is contained in:
parent
15fa055726
commit
f7cd871895
2 changed files with 95 additions and 13 deletions
|
|
@ -56,6 +56,7 @@ struct M2ModelGPU {
|
|||
std::vector<pipeline::M2Bone> bones;
|
||||
std::vector<pipeline::M2Sequence> sequences;
|
||||
bool hasAnimation = false; // True if any bone has keyframes
|
||||
std::vector<int> idleVariationIndices; // Sequence indices for idle variations (animId 0)
|
||||
|
||||
bool isValid() const { return vao != 0 && indexCount > 0; }
|
||||
};
|
||||
|
|
@ -77,11 +78,15 @@ struct M2Instance {
|
|||
// Animation state
|
||||
float animTime = 0.0f; // Current animation time (ms)
|
||||
float animSpeed = 1.0f; // Animation playback speed
|
||||
uint32_t animId = 0; // Current animation sequence
|
||||
int currentSequenceIndex = 0;// Index into sequences array
|
||||
float animDuration = 0.0f; // Duration of current animation (ms)
|
||||
std::vector<glm::mat4> boneMatrices;
|
||||
|
||||
// Idle variation state
|
||||
int idleSequenceIndex = 0; // Default idle sequence index
|
||||
float variationTimer = 0.0f; // Time until next variation attempt (ms)
|
||||
bool playingVariation = false;// Currently playing a one-shot variation
|
||||
|
||||
void updateModelMatrix();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue