mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix M2 particle rendering: color, gravity, transparency, and animation
- Fix FBlock color keys from 3-byte BGR to 4-byte RGBA (CImVector) to prevent garbled purple/red colors from byte misalignment - Add circular soft-edge falloff in particle fragment shader (GL_POINTS rendered as squares by default) - Apply default gravity (4.0 spray, 1.5 mist) when M2 gravity is 0 since bone animation from .anim files isn't loaded yet - Add drift velocity to speed=0 emitters so particles spread as mist instead of clustering at static bone positions - Run particle updates for all nearby instances, not just those in boneWorkIndices_, to prevent particles freezing when bone culled - Wrap animation time for particle models to keep emission tracks looping - Cap particle scale to 1.5 and reduce point size multiplier (800→400) - Desaturate FBlock colors 70% toward white for natural water appearance - Reduce additive blend alpha to 5% and volume particles to 2%
This commit is contained in:
parent
35034ca544
commit
bbcc18aa22
2 changed files with 76 additions and 20 deletions
|
|
@ -572,7 +572,7 @@ void parseAnimTrackVanilla(const std::vector<uint8_t>& data,
|
|||
// FBlocks are like M2Track but WITHOUT the interpolationType/globalSequence prefix.
|
||||
void parseFBlock(const std::vector<uint8_t>& data, uint32_t offset,
|
||||
M2FBlock& fb, int valueType) {
|
||||
// valueType: 0 = color (3 bytes RGB), 1 = alpha (uint16), 2 = scale (float pair)
|
||||
// valueType: 0 = color (CImVector, 4 bytes RGBA), 1 = alpha (uint16), 2 = scale (float pair)
|
||||
if (offset + sizeof(FBlockDisk) > data.size()) return;
|
||||
|
||||
FBlockDisk disk = readValue<FBlockDisk>(data, offset);
|
||||
|
|
@ -595,15 +595,14 @@ void parseFBlock(const std::vector<uint8_t>& data, uint32_t offset,
|
|||
uint32_t ofsKeys = disk.ofsKeys;
|
||||
|
||||
if (valueType == 0) {
|
||||
// Color: 3 bytes per key.
|
||||
// WotLK particle FBlock color keys are stored as BGR in practice for many assets
|
||||
// (notably water/waterfall emitters). Decode to RGB explicitly.
|
||||
if (ofsKeys + nKeys * 3 > data.size()) return;
|
||||
// Color: CImVector (4 bytes RGBA) per key. We extract RGB, ignore A.
|
||||
if (ofsKeys + nKeys * 4 > data.size()) return;
|
||||
fb.vec3Values.reserve(nKeys);
|
||||
for (uint32_t i = 0; i < nKeys; i++) {
|
||||
uint8_t b = data[ofsKeys + i * 3 + 0];
|
||||
uint8_t g = data[ofsKeys + i * 3 + 1];
|
||||
uint8_t r = data[ofsKeys + i * 3 + 2];
|
||||
uint8_t r = data[ofsKeys + i * 4 + 0];
|
||||
uint8_t g = data[ofsKeys + i * 4 + 1];
|
||||
uint8_t b = data[ofsKeys + i * 4 + 2];
|
||||
// byte 3 is alpha, handled separately by the alpha FBlock
|
||||
fb.vec3Values.emplace_back(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
}
|
||||
} else if (valueType == 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue