Model stuff

This commit is contained in:
momo5502 2016-11-06 14:03:51 +01:00
parent e3b96b3586
commit 51bbbdd588
3 changed files with 27 additions and 7 deletions

View File

@ -48,17 +48,26 @@ namespace Assets
surf->surfaces = builder->GetAllocator()->AllocateArray<Game::XSurface>(model->numSurfaces); surf->surfaces = builder->GetAllocator()->AllocateArray<Game::XSurface>(model->numSurfaces);
surf->numSurfaces = model->numSurfaces; surf->numSurfaces = model->numSurfaces;
ZeroMemory(&model->lods[0], sizeof(Game::XModelLodInfo));
model->lods[0].numSurfs = model->numSurfaces;
model->lods[0].surfaces = surf;
model->numLods = 1;
// Reset surfaces in remaining lods // Reset surfaces in remaining lods
for (unsigned int i = 1; i < 4; ++i) for (unsigned int i = 1; i < 4; ++i)
{ {
ZeroMemory(&model->lods[i], sizeof(Game::XModelLodInfo)); ZeroMemory(&model->lods[i], sizeof(Game::XModelLodInfo));
} }
model->lods[0].dist = reader.Read<float>();
model->lods[0].numSurfs = reader.Read<short>();
model->lods[0].maxSurfs = reader.Read<short>();
model->lods[0].partBits[0] = reader.Read<int>();
model->lods[0].partBits[1] = reader.Read<int>();
model->lods[0].partBits[2] = reader.Read<int>();
model->lods[0].partBits[3] = reader.Read<int>();
model->lods[0].numSurfs = model->numSurfaces; // This is needed in case we have more than 1 LOD
model->lods[0].surfaces = surf;
model->lods[0].surfs = surf->surfaces;
model->numLods = 1;
// Read surfaces // Read surfaces
for (int i = 0; i < surf->numSurfaces; ++i) for (int i = 0; i < surf->numSurfaces; ++i)
{ {
@ -207,6 +216,11 @@ namespace Assets
Game::XModel* dest = buffer->Dest<Game::XModel>(); Game::XModel* dest = buffer->Dest<Game::XModel>();
buffer->Save(asset); buffer->Save(asset);
if(asset->name == "viewmodel_m40a3"s)
{
OutputDebugStringA("");
}
buffer->PushBlock(Game::XFILE_BLOCK_VIRTUAL); buffer->PushBlock(Game::XFILE_BLOCK_VIRTUAL);
if (asset->name) if (asset->name)

View File

@ -165,6 +165,11 @@ namespace Components
void FileSystem::RegisterFolders() void FileSystem::RegisterFolders()
{ {
if (ZoneBuilder::IsEnabled())
{
FileSystem::RegisterFolder("zonedata");
}
FileSystem::RegisterFolder("userraw"); FileSystem::RegisterFolder("userraw");
} }

View File

@ -1419,11 +1419,12 @@ namespace Game
struct XModelLodInfo struct XModelLodInfo
{ {
char pad[4]; float dist;
short numSurfs; // +4 short numSurfs; // +4
short maxSurfs;// +6 short maxSurfs;// +6
XModelSurfs* surfaces; // +8 XModelSurfs* surfaces; // +8
char pad3[24]; // +12 int partBits[4];
char pad3[8]; // +12
XSurface* surfs; XSurface* surfs;
char pad4[4]; char pad4[4];
}; };