2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-27 15:02:06 +00:00

chore: do not use class wrapper for bsp utils methods

This commit is contained in:
Jan Laupetin
2025-11-04 21:30:05 +00:00
parent 0a9dae11af
commit 4b1e81056c
6 changed files with 42 additions and 40 deletions

View File

@@ -146,7 +146,7 @@ namespace BSP
clipMap.cmodels[0].maxs.x = gfxModel->bounds[1].x;
clipMap.cmodels[0].maxs.y = gfxModel->bounds[1].y;
clipMap.cmodels[0].maxs.z = gfxModel->bounds[1].z;
clipMap.cmodels[0].radius = BSPUtil::distBetweenPoints(clipMap.cmodels[0].mins, clipMap.cmodels[0].maxs) / 2;
clipMap.cmodels[0].radius = DistBetweenPoints(clipMap.cmodels[0].mins, clipMap.cmodels[0].maxs) / 2;
// The world sub model has no leafs associated with it
clipMap.cmodels[0].leaf.firstCollAabbIndex = 0;
@@ -262,14 +262,14 @@ namespace BSP
parentMaxs = vert;
}
BSPUtil::updateAABBWithPoint(vert, parentMins, parentMaxs);
UpdateAABBWithPoint(vert, parentMins, parentMaxs);
}
}
size_t childObjectStartIndex = AABBTreeVec.size();
CollisionAabbTree parentAABB;
parentAABB.origin = BSPUtil::calcMiddleOfAABB(parentMins, parentMaxs);
parentAABB.halfSize = BSPUtil::calcHalfSizeOfAABB(parentMins, parentMaxs);
parentAABB.origin = CalcMiddleOfAABB(parentMins, parentMaxs);
parentAABB.halfSize = CalcHalfSizeOfAABB(parentMins, parentMaxs);
parentAABB.materialIndex = 0; // always use the first material
parentAABB.childCount = static_cast<uint16_t>(childObjectCount);
parentAABB.u.firstChildIndex = static_cast<int>(childObjectStartIndex);
@@ -294,15 +294,15 @@ namespace BSP
childMaxs = vert;
}
BSPUtil::updateAABBWithPoint(vert, childMins, childMaxs);
UpdateAABBWithPoint(vert, childMins, childMaxs);
}
CollisionAabbTree childAABBTree{};
childAABBTree.materialIndex = 0; // always use the first material
childAABBTree.childCount = 0;
childAABBTree.u.partitionIndex = partitionIndex;
childAABBTree.origin = BSPUtil::calcMiddleOfAABB(childMins, childMaxs);
childAABBTree.halfSize = BSPUtil::calcHalfSizeOfAABB(childMins, childMaxs);
childAABBTree.origin = CalcMiddleOfAABB(childMins, childMaxs);
childAABBTree.halfSize = CalcHalfSizeOfAABB(childMins, childMaxs);
AABBTreeVec.emplace_back(childAABBTree);
}
@@ -428,7 +428,7 @@ namespace BSP
worldMins = vertex;
worldMaxs = vertex;
}
BSPUtil::updateAABBWithPoint(vertex, worldMins, worldMaxs);
UpdateAABBWithPoint(vertex, worldMins, worldMaxs);
}
const auto tree = std::make_unique<BSPTree>(worldMins.x, worldMins.y, worldMins.z, worldMaxs.x, worldMaxs.y, worldMaxs.z, 0);
assert(!tree->isLeaf);
@@ -448,7 +448,7 @@ namespace BSP
partitionMins = vert;
partitionMaxs = vert;
}
BSPUtil::updateAABBWithPoint(vert, partitionMins, partitionMaxs);
UpdateAABBWithPoint(vert, partitionMins, partitionMaxs);
}
auto currObject =
std::make_shared<BSPObject>(partitionMins.x, partitionMins.y, partitionMins.z, partitionMaxs.x, partitionMaxs.y, partitionMaxs.z, partitionIdx);

View File

@@ -110,7 +110,7 @@ namespace BSP
for (size_t indexIdx = 0; indexIdx < static_cast<size_t>(gfxSurface->tris.triCount * 3); indexIdx++)
{
uint16_t vertIndex = gfxWorld.draw.indices[gfxSurface->tris.baseIndex + indexIdx];
BSPUtil::updateAABBWithPoint(firstVert[vertIndex].xyz, gfxSurface->bounds[0], gfxSurface->bounds[1]);
UpdateAABBWithPoint(firstVert[vertIndex].xyz, gfxSurface->bounds[0], gfxSurface->bounds[1]);
}
// unused values
@@ -500,7 +500,7 @@ namespace BSP
for (int surfIdx = 0; surfIdx < gfxWorld.surfaceCount; surfIdx++)
{
BSPUtil::updateAABB(gfxWorld.dpvs.surfaces[surfIdx].bounds[0], gfxWorld.dpvs.surfaces[surfIdx].bounds[1], gfxWorld.mins, gfxWorld.maxs);
UpdateAABB(gfxWorld.dpvs.surfaces[surfIdx].bounds[0], gfxWorld.dpvs.surfaces[surfIdx].bounds[1], gfxWorld.mins, gfxWorld.maxs);
}
}

View File

@@ -77,7 +77,7 @@ namespace BSP
try
{
json entJs;
const auto entityFilePath = BSPUtil::getFileNameForBSPAsset("entities.json");
const auto entityFilePath = GetFileNameForBSPAsset("entities.json");
const auto entFile = m_search_path.Open(entityFilePath);
if (!entFile.IsOpen())
{
@@ -93,7 +93,7 @@ namespace BSP
return nullptr;
json spawnJs;
const auto spawnFilePath = BSPUtil::getFileNameForBSPAsset("spawns.json");
const auto spawnFilePath = GetFileNameForBSPAsset("spawns.json");
const auto spawnFile = m_search_path.Open(spawnFilePath);
if (!spawnFile.IsOpen())
{