evaluate most of MODL chunk,
missing GEOM chunk,
This commit is contained in:
@@ -33,9 +33,92 @@ Object::Object(const char* path)
|
||||
{
|
||||
if (!strcmp("MODL", (*it)->name))
|
||||
{
|
||||
std::list<chunkHeader*>* tempModlList = new std::list<chunkHeader*>;
|
||||
loadChunks(*tempModlList, (*it)->position, (*it)->size);
|
||||
lChunkModls.push_back(tempModlList);
|
||||
modl* tempModl = new modl;
|
||||
tempModl->size = (*it)->size;
|
||||
tempModl->position = (*it)->position;
|
||||
|
||||
std::list<chunkHeader*> tempChunks;
|
||||
|
||||
loadChunks(tempChunks, (*it)->position, (*it)->size);
|
||||
|
||||
// evaluate MODL subchunks
|
||||
for (std::list<chunkHeader*>::iterator it = tempChunks.begin(); it != tempChunks.end(); it++)
|
||||
{
|
||||
if (!strcmp("MTYP", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
std::uint32_t tempType;
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempType), sizeof(tempType));
|
||||
tempModl->type = (mtyp)tempType;
|
||||
}
|
||||
|
||||
if (!strcmp("MNDX", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->zeroBaseIndex), sizeof(tempModl->zeroBaseIndex));
|
||||
}
|
||||
|
||||
if (!strcmp("PRNT", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
char tempName[33] = { 0 };
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempName[0]), (*it)->size > 32 ? 32 : (*it)->size);
|
||||
tempModl->parent = tempName;
|
||||
}
|
||||
|
||||
if (!strcmp("NAME", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
char tempName[33] = { 0 };
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempName[0]), (*it)->size > 32 ? 32 : (*it)->size);
|
||||
tempModl->name = tempName;
|
||||
}
|
||||
|
||||
if (!strcmp("FLGS", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->renderFlags), sizeof(tempModl->renderFlags));
|
||||
}
|
||||
|
||||
if (!strcmp("TRAN", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.scale[0]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.scale[1]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.scale[2]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.rotation[0]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.rotation[1]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.rotation[2]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.rotation[3]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.translation[0]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.translation[1]), sizeof(float));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->tran.translation[2]), sizeof(float));
|
||||
}
|
||||
|
||||
if (!strcmp("GEOM", (*it)->name))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (!strcmp("SWCI", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->swci.type), sizeof(tempModl->swci.type));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->swci.data1), sizeof(tempModl->swci.data1));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->swci.data2), sizeof(tempModl->swci.data2));
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempModl->swci.data3), sizeof(tempModl->swci.data3));
|
||||
}
|
||||
}
|
||||
|
||||
lModls.push_back(tempModl);
|
||||
|
||||
//clean up
|
||||
while (!tempChunks.empty())
|
||||
{
|
||||
chunkHeader* tempCursor = tempChunks.front();
|
||||
tempChunks.pop_front();
|
||||
delete tempCursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user