Some tests

This commit is contained in:
momo5502 2016-06-09 13:44:59 +02:00
parent 5a4ddb27d3
commit 06e91f9dd2
2 changed files with 26 additions and 5 deletions

View File

@ -12,7 +12,7 @@ namespace Assets
// Allocate new model and copy the base data to it
Game::XModel* model = builder->GetAllocator()->AllocateArray<Game::XModel>();
memcpy(model, baseModel, sizeof(Game::XModel));
std::memcpy(model, baseModel, sizeof(Game::XModel));
Utils::Stream::Reader reader(builder->GetAllocator(), modelFile.GetBuffer());
@ -43,7 +43,7 @@ namespace Assets
Game::XSurface* baseSurface = &baseModel->lods[0].surfaces[0].surfaces[0];
Game::XModelSurfs* surf = builder->GetAllocator()->AllocateArray<Game::XModelSurfs>();
memcpy(surf, baseModel->lods[0].surfaces, sizeof(Game::XModelSurfs));
std::memcpy(surf, baseModel->lods[0].surfaces, sizeof(Game::XModelSurfs));
surf->name = builder->GetAllocator()->DuplicateString(Utils::VA("%s1", model->name));
surf->surfaces = builder->GetAllocator()->AllocateArray<Game::XSurface>(model->numSurfaces);
surf->numSurfaces = model->numSurfaces;
@ -62,7 +62,7 @@ namespace Assets
for (int i = 0; i < surf->numSurfaces; ++i)
{
Game::XSurface* surface = &surf->surfaces[i];
memcpy(surface, baseSurface, sizeof(Game::XSurface));
std::memcpy(surface, baseSurface, sizeof(Game::XSurface));
surface->numVertices = reader.Read<unsigned short>();
surface->numPrimitives = reader.Read<unsigned short>();
@ -103,7 +103,15 @@ namespace Assets
for (char i = 0; i < model->numSurfaces; ++i)
{
model->materials[i] = Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_MATERIAL, reader.ReadString(), builder).material;
model->materials[i] = baseModel->materials[0];
//if (i < 9)
{
model->materials[i] = baseModel->materials[0];
}
// else
// {
// OutputDebugStringA(model->materials[i]->name);
// }
}
// Read collision surfaces
@ -199,6 +207,18 @@ namespace Assets
buffer->PushBlock(Game::XFILE_BLOCK_VIRTUAL);
// if (!strcmp(asset->name, "viewmodel_m40a3"))
// {
// for (char i = 0; i < asset->numBones; ++i)
// {
// OutputDebugStringA(Utils::VA("Bounds[%d][0]: %f - %X\n", i, asset->boneInfo[i].bounds[0], *(DWORD*)&asset->boneInfo[i].bounds[0]));
// OutputDebugStringA(Utils::VA("Bounds[%d][1]: %f - %X\n", i, asset->boneInfo[i].bounds[1], *(DWORD*)&asset->boneInfo[i].bounds[1]));
// OutputDebugStringA(Utils::VA("Bounds[%d][2]: %f - %X\n\n", i, asset->boneInfo[i].bounds[2], *(DWORD*)&asset->boneInfo[i].bounds[2]));
// }
//
// __debugbreak();
// }
if (asset->name)
{
buffer->SaveString(builder->GetAssetName(this->GetType(), asset->name));

View File

@ -1468,7 +1468,8 @@ namespace Game
struct XBoneInfo
{
float bounds[2][3];
float offset[3];
float bounds[3];
float radiusSquared;
};