Skip to content

fix(m2): use USE_TEXTURE_COMBINERS flag for texture_combiner_combos#47

Merged
danielsreichenbach merged 3 commits intomainfrom
fix/issue-35-texture-combiner-combos-flag
Feb 16, 2026
Merged

fix(m2): use USE_TEXTURE_COMBINERS flag for texture_combiner_combos#47
danielsreichenbach merged 3 commits intomainfrom
fix/issue-35-texture-combiner-combos-flag

Conversation

@danielsreichenbach
Copy link
Member

Summary

Fixes incorrect parsing of texture_combiner_combos field in M2 models.

Problem

The texture_combiner_combos field was being read based on M2 version (>= Cataclysm) instead of checking the USE_TEXTURE_COMBINERS flag (0x0008).

This caused two issues:

  1. Pre-Cataclysm M2 files WITH the flag set were ignored (combos not parsed)
  2. Cataclysm+ M2 files WITHOUT the flag set would attempt to read garbage data

Solution

Changed all locations that check for texture_combiner_combos to use the USE_TEXTURE_COMBINERS flag instead of version:

  • header.rs:parse() - Check flag for presence
  • header.rs:new() - Field defaults to None (flag not set by default)
  • header.rs:convert() - Preserve flag during version conversion
  • model.rs:parse_chunked() - Check flag for presence in chunked M2 files

Updated tests to properly set the flag when testing Cataclysm and Legion versions.

Issue

Fixes #35

@danielsreichenbach danielsreichenbach force-pushed the fix/issue-35-texture-combiner-combos-flag branch from 08a183b to bfc977f Compare February 16, 2026 12:43
Fixed issues in convert() function where:
- Flag-based check was incorrectly requiring both version >= Cataclysm AND flag set
- Now properly respects flag regardless of source version
- Tests updated to verify flag behavior works correctly

Also fixed test issues:
- Added flags parameter to create_test_header()
- Made classic_header mutable in conversion test
- Updated all test calls to include proper flags
@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
file-formats/graphics/wow-m2/src/model.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Fixed clippy error 'if_same_then_else' by removing redundant
version check that was checking same condition as flag check.

The USE_TEXTURE_COMBINERS flag alone determines whether
texture_combiner_combos field exists, regardless of M2 version.
@danielsreichenbach danielsreichenbach merged commit 79fca9d into main Feb 16, 2026
17 checks passed
@danielsreichenbach danielsreichenbach deleted the fix/issue-35-texture-combiner-combos-flag branch February 16, 2026 13:07
danielsreichenbach added a commit that referenced this pull request Feb 16, 2026
- Added entry for BLP1 alpha scaling fix (issue #32)
- Added entry for M2 texture_combiner_combos flag fix (issue #35)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: texture_combiner_combos header is version-dependent

1 participant