load mtxf ADT chunk, no saving/usage yet. credit Adspartan
This commit is contained in:
@@ -74,7 +74,7 @@ struct MHDR
|
||||
/*020h*/ uint32_t modf; //WMO Positioning Information
|
||||
/*024h*/ uint32_t mfbo; // tbc, wotlk; only when flags&1
|
||||
/*028h*/ uint32_t mh2o; // wotlk
|
||||
/*02Ch*/ uint32_t mtfx; // wotlk
|
||||
/*02Ch*/ uint32_t mtxf; // wotlk
|
||||
/*030h*/ uint32_t pad4;
|
||||
/*034h*/ uint32_t pad5;
|
||||
/*038h*/ uint32_t pad6;
|
||||
@@ -300,3 +300,15 @@ struct MPHD
|
||||
uint32_t something;
|
||||
uint32_t unused[6];
|
||||
};
|
||||
|
||||
struct mtxf_entry
|
||||
{
|
||||
uint32_t use_cubemap : 1; // do_not_load_specular_or_height_texture_but_use_cubemap
|
||||
/*
|
||||
uint32_t : 3;
|
||||
uint32_t texture_scale : 4; // MOP+ Texture scale here is not an actual "scale".
|
||||
// Default value is 0 (no extra scaling applied). The values are computed as 1 << SMTextureFlags.texture_scale.
|
||||
uint32_t : 24;
|
||||
*/
|
||||
uint32_t unused : 31;
|
||||
};
|
||||
@@ -125,6 +125,8 @@ void MapTile::finishLoading()
|
||||
std::vector<std::string> mModelFilenames;
|
||||
std::vector<std::string> mWMOFilenames;
|
||||
|
||||
// std::map<std::string, mtxf_entry> _mtxf_entries;
|
||||
|
||||
uint32_t fourcc;
|
||||
uint32_t size;
|
||||
|
||||
@@ -302,35 +304,31 @@ void MapTile::finishLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// - MTFX ----------------------------------------------
|
||||
/*
|
||||
//! \todo Implement this or just use Terrain Cube maps?
|
||||
Log << "MTFX offs: " << Header.mtfx << std::endl;
|
||||
if(Header.mtfx != 0){
|
||||
Log << "Try to load MTFX" << std::endl;
|
||||
theFile.seek( Header.mtfx + 0x14 );
|
||||
// - MTXF ----------------------------------------------
|
||||
if (Header.mtxf != 0)
|
||||
{
|
||||
theFile.seek(Header.mtxf + 0x14);
|
||||
|
||||
theFile.read(&fourcc, 4);
|
||||
theFile.read(&size, 4);
|
||||
|
||||
assert( fourcc == 'MTFX' );
|
||||
assert(fourcc == 'MTXF');
|
||||
|
||||
int count = size / 0x4;
|
||||
|
||||
std::vector<mtxf_entry> mtxf_data(count);
|
||||
|
||||
theFile.read(mtxf_data.data(), size);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
char* lCurPos = reinterpret_cast<char*>( theFile.getPointer() );
|
||||
char* lEnd = lCurPos + size;
|
||||
int tCount = 0;
|
||||
while( lCurPos < lEnd ) {
|
||||
int temp = 0;
|
||||
theFile.read(&temp, 4);
|
||||
Log << "Adding to " << mTextureFilenames[tCount].first << " texture effect: " << temp << std::endl;
|
||||
mTextureFilenames[tCount++].second = temp;
|
||||
lCurPos += 4;
|
||||
// _mtxf_entries[mTextureFilenames[i]] = mtxf_data[i];
|
||||
// only save those with flags set
|
||||
if (mtxf_data[i].use_cubemap)
|
||||
_mtxf_entries[mTextureFilenames[i]] = mtxf_data[i];
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
// - Done. ---------------------------------------------
|
||||
|
||||
// - Load textures -------------------------------------
|
||||
@@ -374,6 +372,7 @@ void MapTile::finishLoading()
|
||||
}
|
||||
// can be cleared after texture sets are loaded in chunks.
|
||||
mTextureFilenames.clear();
|
||||
_mtxf_entries.clear();
|
||||
|
||||
theFile.close();
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ private:
|
||||
std::vector<std::string> mTextureFilenames;
|
||||
// std::vector<std::string> mModelFilenames;
|
||||
// std::vector<std::string> mWMOFilenames;
|
||||
std::map<std::string, mtxf_entry> _mtxf_entries;
|
||||
|
||||
std::vector<uint32_t> uids;
|
||||
tsl::robin_map<AsyncObject*, std::vector<SceneObject*>> object_instances; // only includes M2 and WMO. perhaps a medium common ancestor then?
|
||||
|
||||
@@ -128,6 +128,7 @@ struct scoped_blp_texture_reference
|
||||
|
||||
bool operator== (scoped_blp_texture_reference const& other) const;
|
||||
|
||||
bool use_cubemap = false;
|
||||
private:
|
||||
struct Deleter
|
||||
{
|
||||
|
||||
@@ -34,7 +34,15 @@ TextureSet::TextureSet (MapChunk* chunk, BlizzardArchive::ClientFile* f, size_t
|
||||
{
|
||||
f->read (&tmp_entry_mcly[i], sizeof(ENTRY_MCLY)); // f->read (&_layers_info[i], sizeof(ENTRY_MCLY));
|
||||
|
||||
textures.emplace_back (tile->mTextureFilenames[tmp_entry_mcly[i].textureID], _context);
|
||||
std::string const& texturefilename = tile->mTextureFilenames[tmp_entry_mcly[i].textureID];
|
||||
textures.emplace_back (texturefilename, _context);
|
||||
|
||||
if (tile->_mtxf_entries.contains(texturefilename))
|
||||
{
|
||||
if (tile->_mtxf_entries[texturefilename].use_cubemap)
|
||||
textures.back().use_cubemap = true;
|
||||
}
|
||||
|
||||
_layers_info[i].effectID = tmp_entry_mcly[i].effectID;
|
||||
_layers_info[i].flags = tmp_entry_mcly[i].flags;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user