2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-22 21:02:07 +00:00

chore: adjust method naming to PascalCase

This commit is contained in:
Jan Laupetin
2025-11-04 22:52:34 +00:00
parent 4b1e81056c
commit 3d1fa7c6d9
19 changed files with 148 additions and 148 deletions

View File

@@ -18,17 +18,17 @@ namespace BSP
partitionIndex = objPartitionIndex;
}
void BSPLeaf::addObject(std::shared_ptr<BSPObject> object)
void BSPLeaf::AddObject(std::shared_ptr<BSPObject> object)
{
objectList.emplace_back(std::move(object));
}
BSPObject* BSPLeaf::getObject(const size_t index) const
BSPObject* BSPLeaf::GetObject(const size_t index) const
{
return objectList.at(index).get();
}
size_t BSPLeaf::getObjectCount() const
size_t BSPLeaf::GetObjectCount() const
{
return objectList.size();
}
@@ -41,7 +41,7 @@ namespace BSP
distance = nodeDistance;
}
PlaneSide BSPNode::objectIsInFront(const BSPObject& object) const
PlaneSide BSPNode::ObjectIsInFront(const BSPObject& object) const
{
float minCoord, maxCoord;
@@ -89,10 +89,10 @@ namespace BSP
max.z = zMax;
level = treeLevel;
splitTree();
SplitTree();
}
void BSPTree::splitTree()
void BSPTree::SplitTree()
{
std::unique_ptr<BSPTree> front;
std::unique_ptr<BSPTree> back;
@@ -139,28 +139,28 @@ namespace BSP
}
}
void BSPTree::addObjectToTree(std::shared_ptr<BSPObject> object) const
void BSPTree::AddObjectToTree(std::shared_ptr<BSPObject> object) const
{
if (isLeaf)
{
leaf->addObject(std::move(object));
leaf->AddObject(std::move(object));
}
else
{
const auto side = node->objectIsInFront(*object);
const auto side = node->ObjectIsInFront(*object);
if (side == PlaneSide::SIDE_FRONT)
{
node->front->addObjectToTree(std::move(object));
node->front->AddObjectToTree(std::move(object));
}
else if (side == PlaneSide::SIDE_BACK)
{
node->back->addObjectToTree(std::move(object));
node->back->AddObjectToTree(std::move(object));
}
else // intersects
{
node->front->addObjectToTree(object);
node->back->addObjectToTree(object);
node->front->AddObjectToTree(object);
node->back->AddObjectToTree(object);
}
}
}

View File

@@ -34,9 +34,9 @@ namespace BSP
class BSPLeaf
{
public:
void addObject(std::shared_ptr<BSPObject> object);
[[nodiscard]] BSPObject* getObject(size_t index) const;
[[nodiscard]] size_t getObjectCount() const;
void AddObject(std::shared_ptr<BSPObject> object);
[[nodiscard]] BSPObject* GetObject(size_t index) const;
[[nodiscard]] size_t GetObjectCount() const;
std::vector<std::shared_ptr<BSPObject>> objectList;
};
@@ -47,7 +47,7 @@ namespace BSP
{
public:
BSPNode(std::unique_ptr<BSPTree> frontTree, std::unique_ptr<BSPTree> backTree, PlaneAxis nodeAxis, float nodeDistance);
[[nodiscard]] PlaneSide objectIsInFront(const BSPObject& object) const;
[[nodiscard]] PlaneSide ObjectIsInFront(const BSPObject& object) const;
std::unique_ptr<BSPTree> front;
std::unique_ptr<BSPTree> back;
@@ -61,8 +61,8 @@ namespace BSP
public:
BSPTree(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int treeLevel);
void splitTree();
void addObjectToTree(std::shared_ptr<BSPObject> object) const;
void SplitTree();
void AddObjectToTree(std::shared_ptr<BSPObject> object) const;
bool isLeaf;
std::unique_ptr<BSPLeaf> leaf;

View File

@@ -11,7 +11,7 @@ using namespace BSP;
namespace
{
void addFBXMeshToWorld(
void AddFBXMeshToWorld(
ufbx_node* node, std::vector<BSPSurface>& surfaceVec, std::vector<BSPVertex>& vertexVec, std::vector<uint16_t>& indexVec, bool& hasTangentSpace)
{
ufbx_mesh* mesh = node->mesh;
@@ -176,7 +176,7 @@ namespace
}
}
void loadWorldData(const ufbx_scene& scene, BSPData& bsp, const bool isGfxData)
void LoadWorldData(const ufbx_scene& scene, BSPData& bsp, const bool isGfxData)
{
bool hasTangentSpace = true;
for (ufbx_node* node : scene.nodes)
@@ -184,9 +184,9 @@ namespace
if (node->attrib_type == UFBX_ELEMENT_MESH)
{
if (isGfxData)
addFBXMeshToWorld(node, bsp.gfxWorld.surfaces, bsp.gfxWorld.vertices, bsp.gfxWorld.indices, hasTangentSpace);
AddFBXMeshToWorld(node, bsp.gfxWorld.surfaces, bsp.gfxWorld.vertices, bsp.gfxWorld.indices, hasTangentSpace);
else
addFBXMeshToWorld(node, bsp.colWorld.surfaces, bsp.colWorld.vertices, bsp.colWorld.indices, hasTangentSpace);
AddFBXMeshToWorld(node, bsp.colWorld.surfaces, bsp.colWorld.vertices, bsp.colWorld.indices, hasTangentSpace);
}
else
{
@@ -201,7 +201,7 @@ namespace
namespace BSP
{
std::unique_ptr<BSPData> createBSPData(const std::string& mapName, ISearchPath& searchPath)
std::unique_ptr<BSPData> CreateBSPData(const std::string& mapName, ISearchPath& searchPath)
{
const auto gfxFbxPath = GetFileNameForBSPAsset("map_gfx.fbx");
const auto gfxFile = searchPath.Open(gfxFbxPath);
@@ -268,8 +268,8 @@ namespace BSP
bsp->name = mapName;
bsp->bspName = std::format("maps/mp/{}.d3dbsp", mapName);
loadWorldData(*gfxScene, *bsp, true);
loadWorldData(*colScene, *bsp, false);
LoadWorldData(*gfxScene, *bsp, true);
LoadWorldData(*colScene, *bsp, false);
ufbx_free_scene(gfxScene);
if (gfxScene != colScene)

View File

@@ -5,5 +5,5 @@
namespace BSP
{
std::unique_ptr<BSPData> createBSPData(const std::string& mapName, ISearchPath& searchPath);
std::unique_ptr<BSPData> CreateBSPData(const std::string& mapName, ISearchPath& searchPath);
}; // namespace BSP

View File

@@ -14,7 +14,7 @@ using namespace T6;
namespace BSP
{
void BSPLinker::addEmptyFootstepTableAsset(const std::string& assetName) const
void BSPLinker::AddEmptyFootstepTableAsset(const std::string& assetName) const
{
if (assetName.empty())
return;
@@ -26,7 +26,7 @@ namespace BSP
m_context.AddAsset<AssetFootstepTable>(assetName, footstepTable);
}
bool BSPLinker::addDefaultRequiredAssets(const BSPData& bsp) const
bool BSPLinker::AddDefaultRequiredAssets(const BSPData& bsp) const
{
if (!m_context.LoadDependency<AssetScript>(std::format("maps/mp/{}.gsc", bsp.name)))
return false;
@@ -42,12 +42,12 @@ namespace BSP
if (!m_context.LoadDependency<AssetScript>(std::format("clientscripts/mp/{}_fx.csc", bsp.name)))
return false;
addEmptyFootstepTableAsset("default_1st_person");
addEmptyFootstepTableAsset("default_3rd_person");
addEmptyFootstepTableAsset("default_1st_person_quiet");
addEmptyFootstepTableAsset("default_3rd_person_quiet");
addEmptyFootstepTableAsset("default_3rd_person_loud");
addEmptyFootstepTableAsset("default_ai");
AddEmptyFootstepTableAsset("default_1st_person");
AddEmptyFootstepTableAsset("default_3rd_person");
AddEmptyFootstepTableAsset("default_1st_person_quiet");
AddEmptyFootstepTableAsset("default_3rd_person_quiet");
AddEmptyFootstepTableAsset("default_3rd_person_loud");
AddEmptyFootstepTableAsset("default_ai");
if (!m_context.LoadDependency<AssetRawFile>("animtrees/fxanim_props.atr"))
return false;
@@ -62,9 +62,9 @@ namespace BSP
{
}
bool BSPLinker::linkBSP(const BSPData& bsp) const
bool BSPLinker::LinkBSP(const BSPData& bsp) const
{
if (!addDefaultRequiredAssets(bsp))
if (!AddDefaultRequiredAssets(bsp))
return false;
ComWorldLinker comWorldLinker(m_memory, m_search_path, m_context);
@@ -74,32 +74,32 @@ namespace BSP
MapEntsLinker mapEntsLinker(m_memory, m_search_path, m_context);
SkinnedVertsLinker skinnedVertsLinker(m_memory, m_search_path, m_context);
auto* comWorld = comWorldLinker.linkComWorld(bsp);
auto* comWorld = comWorldLinker.LinkComWorld(bsp);
if (!comWorld)
return false;
m_context.AddAsset<AssetComWorld>(comWorld->name, comWorld);
auto* mapEnts = mapEntsLinker.linkMapEnts(bsp);
auto* mapEnts = mapEntsLinker.LinkMapEnts(bsp);
if (!mapEnts)
return false;
m_context.AddAsset<AssetMapEnts>(mapEnts->name, mapEnts);
auto* gameWorldMp = gameWorldMpLinker.linkGameWorldMp(bsp);
auto* gameWorldMp = gameWorldMpLinker.LinkGameWorldMp(bsp);
if (!gameWorldMp)
return false;
m_context.AddAsset<AssetGameWorldMp>(gameWorldMp->name, gameWorldMp);
auto* skinnedVerts = skinnedVertsLinker.linkSkinnedVerts(bsp);
auto* skinnedVerts = skinnedVertsLinker.LinkSkinnedVerts(bsp);
if (!skinnedVerts)
return false;
m_context.AddAsset<AssetSkinnedVerts>(skinnedVerts->name, skinnedVerts);
auto* gfxWorld = gfxWorldLinker.linkGfxWorld(bsp); // requires mapents asset
auto* gfxWorld = gfxWorldLinker.LinkGfxWorld(bsp); // requires mapents asset
if (!gfxWorld)
return false;
m_context.AddAsset<AssetGfxWorld>(gfxWorld->name, gfxWorld);
auto* clipMap = clipMapLinker.linkClipMap(bsp); // requires gfxworld and mapents asset
auto* clipMap = clipMapLinker.LinkClipMap(bsp); // requires gfxworld and mapents asset
if (!clipMap)
return false;
m_context.AddAsset<AssetClipMap>(clipMap->name, clipMap);

View File

@@ -12,11 +12,11 @@ namespace BSP
public:
BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
[[nodiscard]] bool linkBSP(const BSPData& bsp) const;
[[nodiscard]] bool LinkBSP(const BSPData& bsp) const;
private:
void addEmptyFootstepTableAsset(const std::string& assetName) const;
[[nodiscard]] bool addDefaultRequiredAssets(const BSPData& bsp) const;
void AddEmptyFootstepTableAsset(const std::string& assetName) const;
[[nodiscard]] bool AddDefaultRequiredAssets(const BSPData& bsp) const;
MemoryManager& m_memory;
ISearchPath& m_search_path;

View File

@@ -17,7 +17,7 @@ namespace BSP
{
}
void ClipMapLinker::loadDynEnts(clipMap_t& clipMap) const
void ClipMapLinker::LoadDynEnts(clipMap_t& clipMap) const
{
uint16_t dynEntCount = 0;
clipMap.originalDynEntCount = dynEntCount;
@@ -44,7 +44,7 @@ namespace BSP
clipMap.dynEntDefList[1] = nullptr;
}
void ClipMapLinker::loadVisibility(clipMap_t& clipMap) const
void ClipMapLinker::LoadVisibility(clipMap_t& clipMap) const
{
// Only use one visbility cluster for the entire map
clipMap.numClusters = 1;
@@ -55,7 +55,7 @@ namespace BSP
memset(clipMap.visibility, 0xFF, clipMap.clusterBytes);
}
void ClipMapLinker::loadBoxData(clipMap_t& clipMap) const
void ClipMapLinker::LoadBoxData(clipMap_t& clipMap) const
{
// box_model and box_brush are what are used by game traces as "temporary" collision when
// no brush or model is specified to do the trace with.
@@ -116,7 +116,7 @@ namespace BSP
clipMap.box_brush->verts = nullptr;
}
void ClipMapLinker::loadRopesAndConstraints(clipMap_t& clipMap) const
void ClipMapLinker::LoadRopesAndConstraints(clipMap_t& clipMap) const
{
clipMap.num_constraints = 0; // max 511
clipMap.constraints = nullptr;
@@ -126,7 +126,7 @@ namespace BSP
clipMap.ropes = m_memory.Alloc<rope_t>(clipMap.max_ropes);
}
void ClipMapLinker::loadSubModelCollision(clipMap_t& clipMap, const BSPData& bsp) const
void ClipMapLinker::LoadSubModelCollision(clipMap_t& clipMap, const BSPData& bsp) const
{
// Submodels are used for the world and map ent collision (triggers, bomb zones, etc)
auto gfxWorldAsset = m_context.LoadDependency<AssetGfxWorld>(bsp.bspName);
@@ -165,7 +165,7 @@ namespace BSP
clipMap.cmodels[0].info = nullptr; // always set to 0
}
void ClipMapLinker::loadXModelCollision(clipMap_t& clipMap) const
void ClipMapLinker::LoadXModelCollision(clipMap_t& clipMap) const
{
// Right now XModels aren't supported
clipMap.numStaticModels = 0;
@@ -215,11 +215,11 @@ namespace BSP
*/
}
void ClipMapLinker::addAABBTreeFromLeaf(clipMap_t& clipMap, const BSPTree& tree, size_t& outParentCount, size_t& outParentStartIndex)
void ClipMapLinker::AddAABBTreeFromLeaf(clipMap_t& clipMap, const BSPTree& tree, size_t& outParentCount, size_t& outParentStartIndex)
{
assert(tree.isLeaf);
size_t leafObjectCount = tree.leaf->getObjectCount();
size_t leafObjectCount = tree.leaf->GetObjectCount();
assert(leafObjectCount > 0);
highestLeafObjectCount = std::max(leafObjectCount, highestLeafObjectCount);
@@ -248,7 +248,7 @@ namespace BSP
vec3_t parentMaxs;
for (size_t objectIdx = 0; objectIdx < childObjectCount; objectIdx++)
{
int partitionIndex = tree.leaf->getObject(addedObjectCount + objectIdx)->partitionIndex;
int partitionIndex = tree.leaf->GetObject(addedObjectCount + objectIdx)->partitionIndex;
CollisionPartition* partition = &clipMap.partitions[partitionIndex];
for (int uindIdx = 0; uindIdx < partition->nuinds; uindIdx++)
{
@@ -278,7 +278,7 @@ namespace BSP
// add child AABBs
for (size_t objectIdx = 0; objectIdx < childObjectCount; objectIdx++)
{
int partitionIndex = tree.leaf->getObject(addedObjectCount + objectIdx)->partitionIndex;
int partitionIndex = tree.leaf->GetObject(addedObjectCount + objectIdx)->partitionIndex;
CollisionPartition* partition = &clipMap.partitions[partitionIndex];
vec3_t childMins;
vec3_t childMaxs;
@@ -327,7 +327,7 @@ namespace BSP
// Nodes are indexed by their index in the node array
// Leafs are indexed by (-1 - <leaf index>)
// See https://developer.valvesoftware.com/wiki/BSP_(Source)
int16_t ClipMapLinker::loadBSPNode(clipMap_t& clipMap, const BSPTree& tree)
int16_t ClipMapLinker::LoadBSPNode(clipMap_t& clipMap, const BSPTree& tree)
{
if (tree.isLeaf)
{
@@ -346,11 +346,11 @@ namespace BSP
leaf.maxs.z = 0.0f;
leaf.leafBrushNode = 0;
if (tree.leaf->getObjectCount() > 0)
if (tree.leaf->GetObjectCount() > 0)
{
size_t parentCount = 0;
size_t parentStartIndex = 0;
addAABBTreeFromLeaf(clipMap, tree, parentCount, parentStartIndex);
AddAABBTreeFromLeaf(clipMap, tree, parentCount, parentStartIndex);
leaf.collAabbCount = static_cast<uint16_t>(parentCount);
leaf.firstCollAabbIndex = static_cast<uint16_t>(parentStartIndex);
}
@@ -400,14 +400,14 @@ namespace BSP
planeVec.emplace_back(plane);
// The recursion of adding the children through loadBSPNode means the parent node needs to be added before the chilren are loaded
// The recursion of adding the children through LoadBSPNode means the parent node needs to be added before the children are loaded
size_t nodeIndex = nodeVec.size();
nodeVec.emplace_back();
cNode_t node;
node.plane = nullptr; // initialised after the BSP tree has been loaded
node.children[0] = loadBSPNode(clipMap, *tree.node->front);
node.children[1] = loadBSPNode(clipMap, *tree.node->back);
node.children[0] = LoadBSPNode(clipMap, *tree.node->front);
node.children[1] = LoadBSPNode(clipMap, *tree.node->back);
nodeVec.at(nodeIndex) = node;
@@ -415,7 +415,7 @@ namespace BSP
}
}
void ClipMapLinker::loadBSPTree(clipMap_t& clipMap, const BSPData& bsp)
void ClipMapLinker::LoadBSPTree(clipMap_t& clipMap, const BSPData& bsp)
{
vec3_t worldMins;
vec3_t worldMaxs;
@@ -452,11 +452,11 @@ namespace BSP
}
auto currObject =
std::make_shared<BSPObject>(partitionMins.x, partitionMins.y, partitionMins.z, partitionMaxs.x, partitionMaxs.y, partitionMaxs.z, partitionIdx);
tree->addObjectToTree(std::move(currObject));
tree->AddObjectToTree(std::move(currObject));
}
// load planes, nodes, leafs, and AABB trees
loadBSPNode(clipMap, *tree);
LoadBSPNode(clipMap, *tree);
clipMap.info.planeCount = static_cast<int>(planeVec.size());
clipMap.info.planes = m_memory.Alloc<cplane_s>(planeVec.size());
@@ -481,7 +481,7 @@ namespace BSP
con::info("Highest leaf object count: {}", highestLeafObjectCount);
}
bool ClipMapLinker::loadPartitions(clipMap_t& clipMap, const BSPData& bsp) const
bool ClipMapLinker::LoadPartitions(clipMap_t& clipMap, const BSPData& bsp) const
{
// due to tris using uint16_t as the type for indexing the vert array,
// any vertex count over the uint16_t max means the vertices above the uint16_t max can't be indexed
@@ -592,7 +592,7 @@ namespace BSP
*/
}
bool ClipMapLinker::loadWorldCollision(clipMap_t& clipMap, const BSPData& bsp)
bool ClipMapLinker::LoadWorldCollision(clipMap_t& clipMap, const BSPData& bsp)
{
// No support for brushes, only tris right now
clipMap.info.numBrushSides = 0;
@@ -609,15 +609,15 @@ namespace BSP
clipMap.info.brushContents = nullptr;
// load verts, tris, uinds and partitions
if (!loadPartitions(clipMap, bsp))
if (!LoadPartitions(clipMap, bsp))
return false;
loadBSPTree(clipMap, bsp);
LoadBSPTree(clipMap, bsp);
return true;
}
clipMap_t* ClipMapLinker::linkClipMap(const BSPData& bsp)
clipMap_t* ClipMapLinker::LinkClipMap(const BSPData& bsp)
{
clipMap_t* clipMap = m_memory.Alloc<clipMap_t>();
clipMap->name = m_memory.Dup(bsp.bspName.c_str());
@@ -631,17 +631,17 @@ namespace BSP
assert(mapEntsAsset != nullptr);
clipMap->mapEnts = mapEntsAsset->Asset();
loadBoxData(*clipMap);
LoadBoxData(*clipMap);
loadVisibility(*clipMap);
LoadVisibility(*clipMap);
loadRopesAndConstraints(*clipMap);
LoadRopesAndConstraints(*clipMap);
loadSubModelCollision(*clipMap, bsp);
LoadSubModelCollision(*clipMap, bsp);
loadDynEnts(*clipMap);
LoadDynEnts(*clipMap);
loadXModelCollision(*clipMap);
LoadXModelCollision(*clipMap);
// Clipmap materials define the properties of a material (bullet penetration, no collision, water, etc)
// Right now there is no way to define properties per material so only one material is used
@@ -657,7 +657,7 @@ namespace BSP
clipMap->triEdgeIsWalkable = new char[walkableEdgeSize];
memset(clipMap->triEdgeIsWalkable, 1, walkableEdgeSize * sizeof(char));
if (!loadWorldCollision(*clipMap, bsp))
if (!LoadWorldCollision(*clipMap, bsp))
return nullptr;
return clipMap;

View File

@@ -13,21 +13,21 @@ namespace BSP
public:
ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
[[nodiscard]] T6::clipMap_t* linkClipMap(const BSPData& bsp);
[[nodiscard]] T6::clipMap_t* LinkClipMap(const BSPData& bsp);
private:
void loadBoxData(T6::clipMap_t& clipMap) const;
void loadVisibility(T6::clipMap_t& clipMap) const;
void loadDynEnts(T6::clipMap_t& clipMap) const;
void loadRopesAndConstraints(T6::clipMap_t& clipMap) const;
void loadSubModelCollision(T6::clipMap_t& clipMap, const BSPData& bsp) const;
void loadXModelCollision(T6::clipMap_t& clipMap) const;
void LoadBoxData(T6::clipMap_t& clipMap) const;
void LoadVisibility(T6::clipMap_t& clipMap) const;
void LoadDynEnts(T6::clipMap_t& clipMap) const;
void LoadRopesAndConstraints(T6::clipMap_t& clipMap) const;
void LoadSubModelCollision(T6::clipMap_t& clipMap, const BSPData& bsp) const;
void LoadXModelCollision(T6::clipMap_t& clipMap) const;
void addAABBTreeFromLeaf(T6::clipMap_t& clipMap, const BSPTree& tree, size_t& out_parentCount, size_t& out_parentStartIndex);
int16_t loadBSPNode(T6::clipMap_t& clipMap, const BSPTree& tree);
void loadBSPTree(T6::clipMap_t& clipMap, const BSPData& bsp);
bool loadPartitions(T6::clipMap_t& clipMap, const BSPData& bsp) const;
bool loadWorldCollision(T6::clipMap_t& clipMap, const BSPData& bsp);
void AddAABBTreeFromLeaf(T6::clipMap_t& clipMap, const BSPTree& tree, size_t& outParentCount, size_t& outParentStartIndex);
int16_t LoadBSPNode(T6::clipMap_t& clipMap, const BSPTree& tree);
void LoadBSPTree(T6::clipMap_t& clipMap, const BSPData& bsp);
bool LoadPartitions(T6::clipMap_t& clipMap, const BSPData& bsp) const;
bool LoadWorldCollision(T6::clipMap_t& clipMap, const BSPData& bsp);
MemoryManager& m_memory;
ISearchPath& m_search_path;

View File

@@ -11,7 +11,7 @@ namespace BSP
{
}
ComWorld* ComWorldLinker::linkComWorld(const BSPData& bsp) const
ComWorld* ComWorldLinker::LinkComWorld(const BSPData& bsp) const
{
// all lights that aren't the sunlight or default light need their own GfxLightDef asset
ComWorld* comWorld = m_memory.Alloc<ComWorld>();

View File

@@ -12,7 +12,7 @@ namespace BSP
public:
ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
[[nodiscard]] T6::ComWorld* linkComWorld(const BSPData& bsp) const;
[[nodiscard]] T6::ComWorld* LinkComWorld(const BSPData& bsp) const;
private:
MemoryManager& m_memory;

View File

@@ -11,7 +11,7 @@ namespace BSP
{
}
GameWorldMp* GameWorldMpLinker::linkGameWorldMp(const BSPData& bsp) const
GameWorldMp* GameWorldMpLinker::LinkGameWorldMp(const BSPData& bsp) const
{
GameWorldMp* gameWorldMp = m_memory.Alloc<GameWorldMp>();

View File

@@ -12,7 +12,7 @@ namespace BSP
public:
GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
[[nodiscard]] T6::GameWorldMp* linkGameWorldMp(const BSPData& bsp) const;
[[nodiscard]] T6::GameWorldMp* LinkGameWorldMp(const BSPData& bsp) const;
private:
MemoryManager& m_memory;

View File

@@ -19,7 +19,7 @@ namespace BSP
{
}
void GfxWorldLinker::loadDrawData(const BSPData& bsp, GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadDrawData(const BSPData& bsp, GfxWorld& gfxWorld) const
{
size_t vertexCount = bsp.gfxWorld.vertices.size();
gfxWorld.draw.vertexCount = static_cast<unsigned int>(vertexCount);
@@ -57,9 +57,9 @@ namespace BSP
}
}
bool GfxWorldLinker::loadMapSurfaces(const BSPData& bsp, GfxWorld& gfxWorld) const
bool GfxWorldLinker::LoadMapSurfaces(const BSPData& bsp, GfxWorld& gfxWorld) const
{
loadDrawData(bsp, gfxWorld);
LoadDrawData(bsp, gfxWorld);
size_t surfaceCount = bsp.gfxWorld.surfaces.size();
gfxWorld.surfaceCount = static_cast<int>(surfaceCount);
@@ -157,7 +157,7 @@ namespace BSP
return true;
}
void GfxWorldLinker::loadXModels(const BSPData& bsp, GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadXModels(const BSPData& bsp, GfxWorld& gfxWorld) const
{
/*
Models are unsupported right now
@@ -186,10 +186,10 @@ namespace BSP
currModel->placement.origin.x = inModel->origin.x;
currModel->placement.origin.y = inModel->origin.y;
currModel->placement.origin.z = inModel->origin.z;
currModel->placement.origin = BSPUtil::convertToBO2Coords(currModel->placement.origin);
currModel->placement.origin = ConvertToBO2Coords(currModel->placement.origin);
currModel->placement.scale = inModel->scale;
BSPUtil::convertAnglesToAxis(&inModel->rotation, currModel->placement.axis);
ConvertAnglesToAxis(&inModel->rotation, currModel->placement.axis);
// mins and maxs are calculated in world space not local space
// TODO: this does not account for model rotation or scale
@@ -252,7 +252,7 @@ namespace BSP
gfxWorld.dpvs.usageCount = 0;
}
void GfxWorldLinker::cleanGfxWorld(GfxWorld& gfxWorld) const
void GfxWorldLinker::CleanGfxWorld(GfxWorld& gfxWorld) const
{
// checksum is generated by the game
gfxWorld.checksum = 0;
@@ -338,7 +338,7 @@ namespace BSP
gfxWorld.sunLight = m_memory.Alloc<GfxLight>();
}
void GfxWorldLinker::loadGfxLights(GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadGfxLights(GfxWorld& gfxWorld) const
{
// there must be 2 or more lights, first is the static light and second is the sun light
gfxWorld.primaryLightCount = BSPGameConstants::BSP_DEFAULT_LIGHT_COUNT;
@@ -367,7 +367,7 @@ namespace BSP
gfxWorld.primaryLightEntityShadowVis = nullptr;
}
void GfxWorldLinker::loadLightGrid(GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadLightGrid(GfxWorld& gfxWorld) const
{
// there is almost no basis for the values in this code, they were chosen based on what looks correct when reverse engineering.
@@ -425,7 +425,7 @@ namespace BSP
gfxWorld.lightGrid.skyGridVolumes = nullptr;
}
void GfxWorldLinker::loadGfxCells(GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadGfxCells(GfxWorld& gfxWorld) const
{
// Cells are basically data used to determine what can be seen and what cant be seen
// Right now custom maps have no optimisation so there is only 1 cell
@@ -489,7 +489,7 @@ namespace BSP
gfxWorld.dpvsPlanes.planes = nullptr;
}
void GfxWorldLinker::loadWorldBounds(GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadWorldBounds(GfxWorld& gfxWorld) const
{
gfxWorld.mins.x = 0.0f;
gfxWorld.mins.y = 0.0f;
@@ -504,7 +504,7 @@ namespace BSP
}
}
void GfxWorldLinker::loadModels(GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadModels(GfxWorld& gfxWorld) const
{
// Models (Submodels in the clipmap code) are used for the world and map ent collision (triggers, bomb zones, etc)
// Right now there is only one submodel, the world sub model
@@ -541,7 +541,7 @@ namespace BSP
//}
}
void GfxWorldLinker::loadSunData(GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadSunData(GfxWorld& gfxWorld) const
{
// default values taken from mp_dig
gfxWorld.sunParse.fogTransitionTime = 0.001f;
@@ -587,7 +587,7 @@ namespace BSP
gfxWorld.sunParse.initWorldFog->sunFogYaw = 254.0f;
}
bool GfxWorldLinker::loadReflectionProbeData(GfxWorld& gfxWorld) const
bool GfxWorldLinker::LoadReflectionProbeData(GfxWorld& gfxWorld) const
{
gfxWorld.draw.reflectionProbeCount = 1;
@@ -627,7 +627,7 @@ namespace BSP
return true;
}
bool GfxWorldLinker::loadLightmapData(GfxWorld& gfxWorld) const
bool GfxWorldLinker::LoadLightmapData(GfxWorld& gfxWorld) const
{
gfxWorld.draw.lightmapCount = 1;
@@ -648,7 +648,7 @@ namespace BSP
return true;
}
void GfxWorldLinker::loadSkyBox(const BSPData& projInfo, GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadSkyBox(const BSPData& projInfo, GfxWorld& gfxWorld) const
{
const auto skyBoxName = std::format("skybox_{}", projInfo.name);
gfxWorld.skyBoxModel = m_memory.Dup(skyBoxName.c_str());
@@ -665,7 +665,7 @@ namespace BSP
gfxWorld.skyDynIntensity.factor1 = 1.0f;
}
void GfxWorldLinker::loadDynEntData(GfxWorld& gfxWorld) const
void GfxWorldLinker::LoadDynEntData(GfxWorld& gfxWorld) const
{
unsigned dynEntCount = 0u;
gfxWorld.dpvsDyn.dynEntClientCount[0] = dynEntCount + 256; // the game allocs 256 empty dynents, as they may be used ingame
@@ -697,7 +697,7 @@ namespace BSP
gfxWorld.sceneDynBrush = nullptr;
}
bool GfxWorldLinker::loadOutdoors(GfxWorld& gfxWorld) const
bool GfxWorldLinker::LoadOutdoors(GfxWorld& gfxWorld) const
{
const auto xRecip = 1.0f / (gfxWorld.maxs.x - gfxWorld.mins.x);
const auto xScale = -(xRecip * gfxWorld.mins.x);
@@ -729,7 +729,7 @@ namespace BSP
return true;
}
GfxWorld* GfxWorldLinker::linkGfxWorld(const BSPData& bsp) const
GfxWorld* GfxWorldLinker::LinkGfxWorld(const BSPData& bsp) const
{
GfxWorld* gfxWorld = m_memory.Alloc<GfxWorld>();
gfxWorld->baseName = m_memory.Dup(bsp.name.c_str());
@@ -739,39 +739,39 @@ namespace BSP
gfxWorld->lightingFlags = 0;
gfxWorld->lightingQuality = 4096;
cleanGfxWorld(*gfxWorld);
CleanGfxWorld(*gfxWorld);
if (!loadMapSurfaces(bsp, *gfxWorld))
if (!LoadMapSurfaces(bsp, *gfxWorld))
return nullptr;
loadXModels(bsp, *gfxWorld);
LoadXModels(bsp, *gfxWorld);
if (!loadLightmapData(*gfxWorld))
if (!LoadLightmapData(*gfxWorld))
return nullptr;
loadSkyBox(bsp, *gfxWorld);
LoadSkyBox(bsp, *gfxWorld);
if (!loadReflectionProbeData(*gfxWorld))
if (!LoadReflectionProbeData(*gfxWorld))
return nullptr;
// world bounds are based on loaded surface mins/maxs
loadWorldBounds(*gfxWorld);
LoadWorldBounds(*gfxWorld);
if (!loadOutdoors(*gfxWorld))
if (!LoadOutdoors(*gfxWorld))
return nullptr;
// gfx cells depend on surface/smodel count
loadGfxCells(*gfxWorld);
LoadGfxCells(*gfxWorld);
loadLightGrid(*gfxWorld);
LoadLightGrid(*gfxWorld);
loadGfxLights(*gfxWorld);
LoadGfxLights(*gfxWorld);
loadModels(*gfxWorld);
LoadModels(*gfxWorld);
loadSunData(*gfxWorld);
LoadSunData(*gfxWorld);
loadDynEntData(*gfxWorld);
LoadDynEntData(*gfxWorld);
return gfxWorld;
}

View File

@@ -12,24 +12,24 @@ namespace BSP
public:
GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
[[nodiscard]] T6::GfxWorld* linkGfxWorld(const BSPData& bsp) const;
[[nodiscard]] T6::GfxWorld* LinkGfxWorld(const BSPData& bsp) const;
private:
void loadDrawData(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
bool loadMapSurfaces(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
void loadXModels(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
void cleanGfxWorld(T6::GfxWorld& gfxWorld) const;
void loadGfxLights(T6::GfxWorld& gfxWorld) const;
void loadLightGrid(T6::GfxWorld& gfxWorld) const;
void loadGfxCells(T6::GfxWorld& gfxWorld) const;
void loadModels(T6::GfxWorld& gfxWorld) const;
bool loadReflectionProbeData(T6::GfxWorld& gfxWorld) const;
bool loadLightmapData(T6::GfxWorld& gfxWorld) const;
void loadSkyBox(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
void loadDynEntData(T6::GfxWorld& gfxWorld) const;
bool loadOutdoors(T6::GfxWorld& gfxWorld) const;
void loadSunData(T6::GfxWorld& gfxWorld) const;
void loadWorldBounds(T6::GfxWorld& gfxWorld) const;
void LoadDrawData(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
bool LoadMapSurfaces(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
void LoadXModels(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
void CleanGfxWorld(T6::GfxWorld& gfxWorld) const;
void LoadGfxLights(T6::GfxWorld& gfxWorld) const;
void LoadLightGrid(T6::GfxWorld& gfxWorld) const;
void LoadGfxCells(T6::GfxWorld& gfxWorld) const;
void LoadModels(T6::GfxWorld& gfxWorld) const;
bool LoadReflectionProbeData(T6::GfxWorld& gfxWorld) const;
bool LoadLightmapData(T6::GfxWorld& gfxWorld) const;
void LoadSkyBox(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const;
void LoadDynEntData(T6::GfxWorld& gfxWorld) const;
bool LoadOutdoors(T6::GfxWorld& gfxWorld) const;
void LoadSunData(T6::GfxWorld& gfxWorld) const;
void LoadWorldBounds(T6::GfxWorld& gfxWorld) const;
MemoryManager& m_memory;
ISearchPath& m_search_path;

View File

@@ -72,7 +72,7 @@ namespace BSP
{
}
MapEnts* MapEntsLinker::linkMapEnts(const BSPData& bsp) const
MapEnts* MapEntsLinker::LinkMapEnts(const BSPData& bsp) const
{
try
{

View File

@@ -12,7 +12,7 @@ namespace BSP
public:
MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
[[nodiscard]] T6::MapEnts* linkMapEnts(const BSPData& bsp) const;
[[nodiscard]] T6::MapEnts* LinkMapEnts(const BSPData& bsp) const;
private:
MemoryManager& m_memory;

View File

@@ -9,7 +9,7 @@ namespace BSP
{
}
T6::SkinnedVertsDef* SkinnedVertsLinker::linkSkinnedVerts(const BSPData& bsp) const
T6::SkinnedVertsDef* SkinnedVertsLinker::LinkSkinnedVerts(const BSPData& bsp) const
{
// Pretty sure maxSkinnedVerts relates to the max amount of xmodel skinned verts a map will have
// But setting it to the world vertex count seems to work

View File

@@ -12,7 +12,7 @@ namespace BSP
public:
SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
[[nodiscard]] T6::SkinnedVertsDef* linkSkinnedVerts(const BSPData& bsp) const;
[[nodiscard]] T6::SkinnedVertsDef* LinkSkinnedVerts(const BSPData& bsp) const;
private:
MemoryManager& m_memory;

View File

@@ -32,12 +32,12 @@ namespace
bool FinalizeZone(AssetCreationContext& context) override
{
const auto bsp = BSP::createBSPData(m_zone.m_name, m_search_path);
const auto bsp = CreateBSPData(m_zone.m_name, m_search_path);
if (!bsp)
return false;
BSPLinker linker(m_memory, m_search_path, context);
const auto result = linker.linkBSP(*bsp);
const auto result = linker.LinkBSP(*bsp);
if (!result)
con::error("BSP link has failed.");