mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Parse M2 render flags and apply per-batch blend modes
Water/lava batches in fountain and Ironforge M2 models use non-opaque blend modes (alpha, additive) defined in the M2 material table. Without parsing these, they rendered as solid surfaces extending visibly beyond their containers. Now each batch looks up its blend mode from the material array and sets the appropriate GL blend function.
This commit is contained in:
parent
ad04da31c3
commit
4d80b92c39
4 changed files with 76 additions and 1 deletions
|
|
@ -518,6 +518,20 @@ M2Model M2Loader::load(const std::vector<uint8_t>& m2Data) {
|
|||
model.textureLookup = readArray<uint16_t>(m2Data, header.ofsTexLookup, header.nTexLookup);
|
||||
}
|
||||
|
||||
// Read render flags / materials (blend modes)
|
||||
if (header.nRenderFlags > 0 && header.ofsRenderFlags > 0) {
|
||||
struct M2MaterialDisk { uint16_t flags; uint16_t blendMode; };
|
||||
auto diskMats = readArray<M2MaterialDisk>(m2Data, header.ofsRenderFlags, header.nRenderFlags);
|
||||
model.materials.reserve(diskMats.size());
|
||||
for (const auto& dm : diskMats) {
|
||||
M2Material mat;
|
||||
mat.flags = dm.flags;
|
||||
mat.blendMode = dm.blendMode;
|
||||
model.materials.push_back(mat);
|
||||
}
|
||||
core::Logger::getInstance().debug(" Materials: ", model.materials.size());
|
||||
}
|
||||
|
||||
// Read texture transforms (UV animation data)
|
||||
if (header.nUVAnimation > 0 && header.ofsUVAnimation > 0) {
|
||||
// Build per-sequence flags for skipping external .anim data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue