Some model stuff

This commit is contained in:
momo5502 2016-11-06 02:24:30 +01:00
parent e482e3765f
commit 6626bc9fc7
3 changed files with 13 additions and 5 deletions

2
deps/fmt vendored

@ -1 +1 @@
Subproject commit 49ccb2e4497ce3d2acae9c0cca81756aa341627d
Subproject commit d8867a2b07b8be2adf5d503ecc9d9e65dcc59ec2

View File

@ -44,18 +44,19 @@ namespace Assets
Game::XModelSurfs* surf = builder->GetAllocator()->Allocate<Game::XModelSurfs>();
std::memcpy(surf, baseModel->lods[0].surfaces, sizeof(Game::XModelSurfs));
surf->name = builder->GetAllocator()->DuplicateString(fmt::sprintf("%s1", model->name));
surf->name = builder->GetAllocator()->DuplicateString(fmt::sprintf("%s_lod1", model->name));
surf->surfaces = builder->GetAllocator()->AllocateArray<Game::XSurface>(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
for (unsigned int i = 1; i < 4; ++i)
{
model->lods[i].numSurfs = 0;
model->lods[i].surfaces = nullptr;
ZeroMemory(&model->lods[i], sizeof(Game::XModelLodInfo));
}
// Read surfaces
@ -64,10 +65,16 @@ namespace Assets
Game::XSurface* surface = &surf->surfaces[i];
std::memcpy(surface, baseSurface, sizeof(Game::XSurface));
surface->tileMode = reader.Read<char>();
surface->deformed = reader.Read<char>();
surface->streamHandle = reader.Read<unsigned char>();
surface->something = reader.Read<int>();
surface->something2 = reader.Read<int>();
surface->pad2 = reader.Read<char>();
surface->pad3 = reader.Read<int>();
surface->numVertices = reader.Read<unsigned short>();
surface->numPrimitives = reader.Read<unsigned short>();
surface->numCT = reader.Read<int>();

View File

@ -1386,7 +1386,8 @@ namespace Game
struct XSurface
{
short pad; // +0
char tileMode;
char deformed;
unsigned short numVertices; // +2
unsigned short numPrimitives; // +4
unsigned char streamHandle; // something to do with buffers, +6