Some model stuff
This commit is contained in:
parent
e482e3765f
commit
6626bc9fc7
2
deps/fmt
vendored
2
deps/fmt
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 49ccb2e4497ce3d2acae9c0cca81756aa341627d
|
Subproject commit d8867a2b07b8be2adf5d503ecc9d9e65dcc59ec2
|
@ -44,18 +44,19 @@ namespace Assets
|
|||||||
Game::XModelSurfs* surf = builder->GetAllocator()->Allocate<Game::XModelSurfs>();
|
Game::XModelSurfs* surf = builder->GetAllocator()->Allocate<Game::XModelSurfs>();
|
||||||
|
|
||||||
std::memcpy(surf, baseModel->lods[0].surfaces, sizeof(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->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].numSurfs = model->numSurfaces;
|
||||||
model->lods[0].surfaces = surf;
|
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)
|
||||||
{
|
{
|
||||||
model->lods[i].numSurfs = 0;
|
ZeroMemory(&model->lods[i], sizeof(Game::XModelLodInfo));
|
||||||
model->lods[i].surfaces = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read surfaces
|
// Read surfaces
|
||||||
@ -64,10 +65,16 @@ namespace Assets
|
|||||||
Game::XSurface* surface = &surf->surfaces[i];
|
Game::XSurface* surface = &surf->surfaces[i];
|
||||||
std::memcpy(surface, baseSurface, sizeof(Game::XSurface));
|
std::memcpy(surface, baseSurface, sizeof(Game::XSurface));
|
||||||
|
|
||||||
|
surface->tileMode = reader.Read<char>();
|
||||||
|
surface->deformed = reader.Read<char>();
|
||||||
|
|
||||||
surface->streamHandle = reader.Read<unsigned char>();
|
surface->streamHandle = reader.Read<unsigned char>();
|
||||||
surface->something = reader.Read<int>();
|
surface->something = reader.Read<int>();
|
||||||
surface->something2 = 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->numVertices = reader.Read<unsigned short>();
|
||||||
surface->numPrimitives = reader.Read<unsigned short>();
|
surface->numPrimitives = reader.Read<unsigned short>();
|
||||||
surface->numCT = reader.Read<int>();
|
surface->numCT = reader.Read<int>();
|
||||||
|
@ -1386,7 +1386,8 @@ namespace Game
|
|||||||
|
|
||||||
struct XSurface
|
struct XSurface
|
||||||
{
|
{
|
||||||
short pad; // +0
|
char tileMode;
|
||||||
|
char deformed;
|
||||||
unsigned short numVertices; // +2
|
unsigned short numVertices; // +2
|
||||||
unsigned short numPrimitives; // +4
|
unsigned short numPrimitives; // +4
|
||||||
unsigned char streamHandle; // something to do with buffers, +6
|
unsigned char streamHandle; // something to do with buffers, +6
|
||||||
|
Loading…
Reference in New Issue
Block a user