texture is now correctly detected and used,

there seams to be a problem with the UV. They are not correctly
This commit is contained in:
Anakin
2016-10-22 15:35:06 +02:00
parent be97fa8e6f
commit 4f52510ff9
5 changed files with 18 additions and 9 deletions

View File

@@ -135,9 +135,14 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
{
if (!strcmp("MATL", (*it)->name))
{
// "useless" information how many MATD follow
fsMesh.seekg((*it)->position);
std::uint32_t tempMatdCount;
fsMesh.read(reinterpret_cast<char*>(&tempMatdCount), sizeof(std::uint32_t));
// get all MATD from MATL list
std::list<ChunkHeader*> tempMatlChunks;
loadChunks(tempMatlChunks, (*it)->position, (*it)->size);
loadChunks(tempMatlChunks, fsMesh.tellg(), (*it)->size - 4);
// evaluate MATL subchunks
for (std::list<ChunkHeader*>::iterator it = tempMatlChunks.begin(); it != tempMatlChunks.end(); it++)
@@ -383,13 +388,13 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
fsMesh.seekg((*it)->position);
std::uint32_t tempIndex;
fsMesh.read(reinterpret_cast<char*>(&tempIndex), sizeof(tempIndex));
if (vTextures.size() < tempIndex - 1)
if (vTextures.size() <= tempIndex)
{
std::cout << "warning texture index <" << tempIndex << "> unknown" << std::endl;
dataDestination->texture = "";
continue;
}
dataDestination->texture = vTextures[tempIndex - 1];
dataDestination->texture = vTextures[tempIndex];
continue;
}