diff --git a/src/ObjLoading/Game/T6/BSP/BSP.h b/src/ObjLoading/Game/T6/BSP/BSP.h index d146734c..f64f738a 100644 --- a/src/ObjLoading/Game/T6/BSP/BSP.h +++ b/src/ObjLoading/Game/T6/BSP/BSP.h @@ -1,13 +1,12 @@ #pragma once -#include -#include -#include -#include - +#include "Game/T6/T6.h" #include "Utils/Logging/Log.h" -#include "Game/T6/T6.h" +#include +#include +#include +#include using namespace T6; namespace BSP @@ -71,40 +70,32 @@ namespace BSP BSP_DEFAULT_LIGHT_COUNT = 2 }; - inline const char* DEFENDER_SPAWN_POINT_NAMES[] = { - "mp_ctf_spawn_allies", - "mp_ctf_spawn_allies_start", - "mp_sd_spawn_defender", - "mp_dom_spawn_allies_start", - "mp_dem_spawn_defender_start", - "mp_dem_spawn_defenderOT_start", - "mp_dem_spawn_defender", - "mp_tdm_spawn_allies_start", - "mp_tdm_spawn_team1_start", - "mp_tdm_spawn_team2_start", - "mp_tdm_spawn_team3_start" - }; + inline const char* DEFENDER_SPAWN_POINT_NAMES[] = {"mp_ctf_spawn_allies", + "mp_ctf_spawn_allies_start", + "mp_sd_spawn_defender", + "mp_dom_spawn_allies_start", + "mp_dem_spawn_defender_start", + "mp_dem_spawn_defenderOT_start", + "mp_dem_spawn_defender", + "mp_tdm_spawn_allies_start", + "mp_tdm_spawn_team1_start", + "mp_tdm_spawn_team2_start", + "mp_tdm_spawn_team3_start"}; - inline const char* ATTACKER_SPAWN_POINT_NAMES[] = { - "mp_ctf_spawn_axis", - "mp_ctf_spawn_axis_start", - "mp_sd_spawn_attacker", - "mp_dom_spawn_axis_start", - "mp_dem_spawn_attacker_start", - "mp_dem_spawn_attackerOT_start", - "mp_dem_spawn_defender", - "mp_tdm_spawn_axis_start", - "mp_tdm_spawn_team4_start", - "mp_tdm_spawn_team5_start", - "mp_tdm_spawn_team6_start" - }; + inline const char* ATTACKER_SPAWN_POINT_NAMES[] = {"mp_ctf_spawn_axis", + "mp_ctf_spawn_axis_start", + "mp_sd_spawn_attacker", + "mp_dom_spawn_axis_start", + "mp_dem_spawn_attacker_start", + "mp_dem_spawn_attackerOT_start", + "mp_dem_spawn_defender", + "mp_tdm_spawn_axis_start", + "mp_tdm_spawn_team4_start", + "mp_tdm_spawn_team5_start", + "mp_tdm_spawn_team6_start"}; - inline const char* FFA_SPAWN_POINT_NAMES[] = { - "mp_tdm_spawn", - "mp_dm_spawn", - "mp_dom_spawn" - }; - } + inline const char* FFA_SPAWN_POINT_NAMES[] = {"mp_tdm_spawn", "mp_dm_spawn", "mp_dom_spawn"}; + } // namespace BSPGameConstants // BSPLinkingConstants: // These values are BSP linking constants that are required for the link to be successful @@ -134,7 +125,6 @@ namespace BSP ] })"; - constexpr const char* DEFAULT_MAP_ENTS_STRING = R"({ "entities": [ { @@ -152,7 +142,7 @@ namespace BSP } ] })"; - } + } // namespace BSPLinkingConstants // BSPEditableConstants: // These values are BSP constants that can be edited and may not break the linker/game if changed @@ -188,7 +178,7 @@ namespace BSP constexpr unsigned char LIGHTGRID_COLOUR = 128; // Sunlight values - constexpr vec4_t SUNLIGHT_COLOR = { 0.75f, 0.75f, 0.75f, 1.0f }; - constexpr vec3_t SUNLIGHT_DIRECTION = { 0.0f, 0.0f, 0.0f }; - }; -} \ No newline at end of file + constexpr vec4_t SUNLIGHT_COLOR = {0.75f, 0.75f, 0.75f, 1.0f}; + constexpr vec3_t SUNLIGHT_DIRECTION = {0.0f, 0.0f, 0.0f}; + }; // namespace BSPEditableConstants +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/BSPCalculation.cpp b/src/ObjLoading/Game/T6/BSP/BSPCalculation.cpp index b8a3a22b..61dccd92 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCalculation.cpp +++ b/src/ObjLoading/Game/T6/BSP/BSPCalculation.cpp @@ -148,4 +148,4 @@ namespace BSP } } } -} \ No newline at end of file +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/BSPCalculation.h b/src/ObjLoading/Game/T6/BSP/BSPCalculation.h index 9988f519..1d35cbe9 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCalculation.h +++ b/src/ObjLoading/Game/T6/BSP/BSPCalculation.h @@ -28,7 +28,6 @@ namespace BSP BSPObject(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int objPartitionIndex); }; - class BSPLeaf { public: @@ -47,7 +46,7 @@ namespace BSP std::unique_ptr front; std::unique_ptr back; - PlaneAxis axis; // axis that the split plane is on + PlaneAxis axis; // axis that the split plane is on float distance; // distance from the origin (0, 0, 0) to the plane BSPNode(std::unique_ptr frontTree, std::unique_ptr backTree, PlaneAxis nodeAxis, float nodeDistance); @@ -69,4 +68,4 @@ namespace BSP void splitTree(); void addObjectToTree(std::shared_ptr object); }; -} \ No newline at end of file +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp b/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp index 8aad76d0..6c14330b 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp +++ b/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp @@ -6,11 +6,8 @@ namespace { using namespace BSP; - void addFBXMeshToWorld(ufbx_node* node, - std::vector& surfaceVec, - std::vector& vertexVec, - std::vector& indexVec, - bool& hasTangentSpace) + void addFBXMeshToWorld( + ufbx_node* node, std::vector& surfaceVec, std::vector& vertexVec, std::vector& indexVec, bool& hasTangentSpace) { ufbx_mesh* mesh = node->mesh; @@ -43,7 +40,7 @@ namespace if (mesh->vertex_tangent.exists == false) hasTangentSpace = false; - // Fix the target_unit_meters ufbx opt not working + // Fix the target_unit_meters ufbx opt not working // UFBX stores the transform data in units that are 100x larger than what blender uses, so this converts them back ufbx_transform origTransform = node->local_transform; origTransform.translation.x /= 100.0f; @@ -53,12 +50,12 @@ namespace origTransform.scale.y /= 100.0f; origTransform.scale.z /= 100.0f; ufbx_matrix meshMatrix = ufbx_transform_to_matrix(&origTransform); - + for (ufbx_mesh_part& meshPart : mesh->material_parts) { if (meshPart.num_faces == 0) continue; - + BSPSurface surface; size_t partTriangleNum = meshPart.num_triangles; surface.triCount = static_cast(partTriangleNum); @@ -187,7 +184,7 @@ namespace if (hasTangentSpace == false) con::warn("warning: one or more meshes have no tangent space. Be sure to select the tangent space box when exporting the FBX."); } -} +} // namespace namespace BSP { @@ -201,7 +198,7 @@ namespace BSP con::error("Failed to open map gfx fbx file: {}", gfxFbxPath); return nullptr; } - + std::unique_ptr gfxMapData(new char[static_cast(gfxFile.m_length)]); gfxFile.m_stream->read(gfxMapData.get(), gfxFile.m_length); if (gfxFile.m_stream->gcount() != gfxFile.m_length) @@ -211,7 +208,7 @@ namespace BSP } ufbx_error errorGfx; - ufbx_load_opts optsGfx {}; + ufbx_load_opts optsGfx{}; optsGfx.target_axes = ufbx_axes_right_handed_y_up; optsGfx.generate_missing_normals = true; optsGfx.allow_missing_vertex_position = false; @@ -243,7 +240,7 @@ namespace BSP } ufbx_error errorCol; - ufbx_load_opts optsCol {}; + ufbx_load_opts optsCol{}; optsCol.target_axes = ufbx_axes_right_handed_y_up; optsCol.generate_missing_normals = true; optsCol.allow_missing_vertex_position = false; @@ -269,4 +266,4 @@ namespace BSP return bsp; } -} // namespace BSP \ No newline at end of file +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/BSPCreator.h b/src/ObjLoading/Game/T6/BSP/BSPCreator.h index 7a8395da..8ab85e61 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCreator.h +++ b/src/ObjLoading/Game/T6/BSP/BSPCreator.h @@ -6,4 +6,4 @@ namespace BSP { std::unique_ptr createBSPData(std::string& mapName, ISearchPath& searchPath); -}; \ No newline at end of file +}; // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp b/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp index a5473e1e..cd5ebe58 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp +++ b/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp @@ -1,169 +1,173 @@ #pragma once +#include "BSPUtil.h" + #include #include -#include "BSPUtil.h" - -std::string BSPUtil::getFileNameForBSPAsset(std::string& assetName) +namespace BSP { - return std::format("BSP/{}", assetName); -} + std::string BSPUtil::getFileNameForBSPAsset(std::string& assetName) + { + return std::format("BSP/{}", assetName); + } -vec3_t BSPUtil::convertToBO2Coords(vec3_t& coordinate) -{ - vec3_t result; - result.x = coordinate.x; - result.y = -coordinate.z; - result.z = coordinate.y; - return result; -} + vec3_t BSPUtil::convertToBO2Coords(vec3_t& coordinate) + { + vec3_t result; + result.x = coordinate.x; + result.y = -coordinate.z; + result.z = coordinate.y; + return result; + } -vec3_t BSPUtil::convertFromBO2Coords(vec3_t& coordinate) -{ - vec3_t result; - result.x = coordinate.x; - result.y = coordinate.z; - result.z = -coordinate.y; - return result; -} + vec3_t BSPUtil::convertFromBO2Coords(vec3_t& coordinate) + { + vec3_t result; + result.x = coordinate.x; + result.y = coordinate.z; + result.z = -coordinate.y; + return result; + } -void BSPUtil::updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs) -{ - if (AABBMins.x > newAABBMins.x) - AABBMins.x = newAABBMins.x; + void BSPUtil::updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs) + { + if (AABBMins.x > newAABBMins.x) + AABBMins.x = newAABBMins.x; - if (newAABBMaxs.x > AABBMaxs.x) - AABBMaxs.x = newAABBMaxs.x; + if (newAABBMaxs.x > AABBMaxs.x) + AABBMaxs.x = newAABBMaxs.x; - if (AABBMins.y > newAABBMins.y) - AABBMins.y = newAABBMins.y; + if (AABBMins.y > newAABBMins.y) + AABBMins.y = newAABBMins.y; - if (newAABBMaxs.y > AABBMaxs.y) - AABBMaxs.y = newAABBMaxs.y; + if (newAABBMaxs.y > AABBMaxs.y) + AABBMaxs.y = newAABBMaxs.y; - if (AABBMins.z > newAABBMins.z) - AABBMins.z = newAABBMins.z; + if (AABBMins.z > newAABBMins.z) + AABBMins.z = newAABBMins.z; - if (newAABBMaxs.z > AABBMaxs.z) - AABBMaxs.z = newAABBMaxs.z; -} + if (newAABBMaxs.z > AABBMaxs.z) + AABBMaxs.z = newAABBMaxs.z; + } -void BSPUtil::updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs) -{ - if (AABBMins.x > point.x) - AABBMins.x = point.x; + void BSPUtil::updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs) + { + if (AABBMins.x > point.x) + AABBMins.x = point.x; - if (point.x > AABBMaxs.x) - AABBMaxs.x = point.x; + if (point.x > AABBMaxs.x) + AABBMaxs.x = point.x; - if (AABBMins.y > point.y) - AABBMins.y = point.y; + if (AABBMins.y > point.y) + AABBMins.y = point.y; - if (point.y > AABBMaxs.y) - AABBMaxs.y = point.y; + if (point.y > AABBMaxs.y) + AABBMaxs.y = point.y; - if (AABBMins.z > point.z) - AABBMins.z = point.z; + if (AABBMins.z > point.z) + AABBMins.z = point.z; - if (point.z > AABBMaxs.z) - AABBMaxs.z = point.z; -} + if (point.z > AABBMaxs.z) + AABBMaxs.z = point.z; + } -vec3_t BSPUtil::calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs) -{ - vec3_t result; - result.x = (mins.x + maxs.x) * 0.5f; - result.y = (mins.y + maxs.y) * 0.5f; - result.z = (mins.z + maxs.z) * 0.5f; - return result; -} + vec3_t BSPUtil::calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs) + { + vec3_t result; + result.x = (mins.x + maxs.x) * 0.5f; + result.y = (mins.y + maxs.y) * 0.5f; + result.z = (mins.z + maxs.z) * 0.5f; + return result; + } -vec3_t BSPUtil::calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs) -{ - vec3_t result; - result.x = (maxs.x - mins.x) * 0.5f; - result.y = (maxs.y - mins.y) * 0.5f; - result.z = (maxs.z - mins.z) * 0.5f; - return result; -} + vec3_t BSPUtil::calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs) + { + vec3_t result; + result.x = (maxs.x - mins.x) * 0.5f; + result.y = (maxs.y - mins.y) * 0.5f; + result.z = (maxs.z - mins.z) * 0.5f; + return result; + } -size_t BSPUtil::allignBy128(size_t size) -{ - return ((size + 127) & 0xFFFFFF80); -} + size_t BSPUtil::allignBy128(size_t size) + { + return ((size + 127) & 0xFFFFFF80); + } -float BSPUtil::distBetweenPoints(vec3_t& p1, vec3_t& p2) -{ - float x = p2.x - p1.x; - float y = p2.y - p1.y; - float z = p2.z - p1.z; - return sqrtf((x * x) + (y * y) + (z * z)); -} + float BSPUtil::distBetweenPoints(vec3_t& p1, vec3_t& p2) + { + float x = p2.x - p1.x; + float y = p2.y - p1.y; + float z = p2.z - p1.z; + return sqrtf((x * x) + (y * y) + (z * z)); + } -// angles are in euler degrees -void BSPUtil::convertAnglesToAxis(vec3_t* angles, vec3_t* axis) -{ - float xRadians = angles->x * 0.017453292f; // M_PI / 180.0f - float yRadians = angles->y * 0.017453292f; // M_PI / 180.0f - float zRadians = angles->z * 0.017453292f; // M_PI / 180.0f - - float cosX = cos(xRadians); - float sinX = sin(xRadians); - float cosY = cos(yRadians); - float sinY = sin(yRadians); - float cosZ = cos(zRadians); - float sinZ = sin(zRadians); - - axis[0].x = cosX * cosY; - axis[0].y = cosX * sinY; - axis[0].z = -sinX; - axis[1].x = (sinZ * sinX * cosY) - (cosZ * sinY); - axis[1].y = (sinZ * sinX * sinY) + (cosZ * cosY); - axis[1].z = sinZ * cosX; - axis[2].x = (cosZ * sinX * cosY) + (sinZ * sinY); - axis[2].y = (cosZ * sinX * sinY) - (sinZ * cosY); - axis[2].z = cosZ * cosX; -} + // angles are in euler degrees + void BSPUtil::convertAnglesToAxis(vec3_t* angles, vec3_t* axis) + { + float xRadians = angles->x * 0.017453292f; // M_PI / 180.0f + float yRadians = angles->y * 0.017453292f; // M_PI / 180.0f + float zRadians = angles->z * 0.017453292f; // M_PI / 180.0f -void BSPUtil::matrixTranspose3x3(const vec3_t* in, vec3_t* out) -{ - out[0].x = in[0].x; - out[0].y = in[1].x; - out[0].z = in[2].x; - out[1].x = in[0].y; - out[1].y = in[1].y; - out[1].z = in[2].y; - out[2].x = in[0].z; - out[2].y = in[1].z; - out[2].z = in[2].z; -} + float cosX = cos(xRadians); + float sinX = sin(xRadians); + float cosY = cos(yRadians); + float sinY = sin(yRadians); + float cosZ = cos(zRadians); + float sinZ = sin(zRadians); -vec3_t BSPUtil::convertStringToVec3(std::string& str) -{ - std::string v1Str = str; + axis[0].x = cosX * cosY; + axis[0].y = cosX * sinY; + axis[0].z = -sinX; + axis[1].x = (sinZ * sinX * cosY) - (cosZ * sinY); + axis[1].y = (sinZ * sinX * sinY) + (cosZ * cosY); + axis[1].z = sinZ * cosX; + axis[2].x = (cosZ * sinX * cosY) + (sinZ * sinY); + axis[2].y = (cosZ * sinX * sinY) - (sinZ * cosY); + axis[2].z = cosZ * cosX; + } - int nextValIndex = 0; - while (v1Str[nextValIndex] != ' ') - nextValIndex++; - nextValIndex++; // skip past space - std::string v2Str = &v1Str[nextValIndex]; + void BSPUtil::matrixTranspose3x3(const vec3_t* in, vec3_t* out) + { + out[0].x = in[0].x; + out[0].y = in[1].x; + out[0].z = in[2].x; + out[1].x = in[0].y; + out[1].y = in[1].y; + out[1].z = in[2].y; + out[2].x = in[0].z; + out[2].y = in[1].z; + out[2].z = in[2].z; + } - nextValIndex = 0; - while (v2Str[nextValIndex] != ' ') - nextValIndex++; - nextValIndex++; // skip past space - std::string v3Str = &v2Str[nextValIndex]; + vec3_t BSPUtil::convertStringToVec3(std::string& str) + { + std::string v1Str = str; - vec3_t result; - result.x = static_cast(atof(v1Str.c_str())); - result.y = static_cast(atof(v2Str.c_str())); - result.z = static_cast(atof(v3Str.c_str())); - return result; -} + int nextValIndex = 0; + while (v1Str[nextValIndex] != ' ') + nextValIndex++; + nextValIndex++; // skip past space + std::string v2Str = &v1Str[nextValIndex]; -std::string BSPUtil::convertVec3ToString(vec3_t& vec) -{ - std::string result = std::format("{} {} {}", vec.x, vec.y, vec.z); - return result; -} \ No newline at end of file + nextValIndex = 0; + while (v2Str[nextValIndex] != ' ') + nextValIndex++; + nextValIndex++; // skip past space + std::string v3Str = &v2Str[nextValIndex]; + + vec3_t result; + result.x = static_cast(atof(v1Str.c_str())); + result.y = static_cast(atof(v2Str.c_str())); + result.z = static_cast(atof(v3Str.c_str())); + return result; + } + + std::string BSPUtil::convertVec3ToString(vec3_t& vec) + { + std::string result = std::format("{} {} {}", vec.x, vec.y, vec.z); + return result; + } + +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/BSPUtil.h b/src/ObjLoading/Game/T6/BSP/BSPUtil.h index 074cd4ab..54bdd0a5 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPUtil.h +++ b/src/ObjLoading/Game/T6/BSP/BSPUtil.h @@ -2,21 +2,23 @@ #include "BSP.h" - -class BSPUtil +namespace BSP { -public: - static std::string getFileNameForBSPAsset(std::string& assetName); - static vec3_t convertToBO2Coords(vec3_t& OGL_coordinate); - static vec3_t convertFromBO2Coords(vec3_t& bo2_coordinate); - static void updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs); - static void updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs); - static vec3_t calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs); - static vec3_t calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs); - static size_t allignBy128(size_t size); - static float distBetweenPoints(vec3_t& p1, vec3_t& p2); - static void convertAnglesToAxis(vec3_t* angles, vec3_t* axis); - static void matrixTranspose3x3(const vec3_t* in, vec3_t* out); - static vec3_t convertStringToVec3(std::string& str); - static std::string convertVec3ToString(vec3_t& vec); -}; + class BSPUtil + { + public: + static std::string getFileNameForBSPAsset(std::string& assetName); + static vec3_t convertToBO2Coords(vec3_t& OGL_coordinate); + static vec3_t convertFromBO2Coords(vec3_t& bo2_coordinate); + static void updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs); + static void updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs); + static vec3_t calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs); + static vec3_t calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs); + static size_t allignBy128(size_t size); + static float distBetweenPoints(vec3_t& p1, vec3_t& p2); + static void convertAnglesToAxis(vec3_t* angles, vec3_t* axis); + static void matrixTranspose3x3(const vec3_t* in, vec3_t* out); + static vec3_t convertStringToVec3(std::string& str); + static std::string convertVec3ToString(vec3_t& vec); + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp index ccd42bd7..0777491b 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp @@ -1,7 +1,6 @@ #include "BSPLinker.h" - -#include "ComWorldLinker.h" #include "ClipMapLinker.h" +#include "ComWorldLinker.h" #include "GameWorldMpLinker.h" #include "GfxWorldLinker.h" #include "MapEntsLinker.h" @@ -52,15 +51,15 @@ namespace BSP return true; } - BSPLinker::BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) - : m_memory(memory), - m_search_path(searchPath), - m_context(context) - { - } + BSPLinker::BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) + : m_memory(memory), + m_search_path(searchPath), + m_context(context) + { + } - AssetCreationResult BSPLinker::linkBSP(BSPData* bsp) - { + AssetCreationResult BSPLinker::linkBSP(BSPData* bsp) + { if (!addDefaultRequiredAssets(bsp)) return AssetCreationResult::Failure(); @@ -92,6 +91,5 @@ namespace BSP return AssetCreationResult::Failure(); return result; - } -} - + } +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h index be986f97..f51abf4e 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h @@ -7,18 +7,18 @@ namespace BSP { - class BSPLinker - { - public: - BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - AssetCreationResult linkBSP(BSPData* bsp); + class BSPLinker + { + public: + BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); + AssetCreationResult linkBSP(BSPData* bsp); - private: - FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName); - bool addDefaultRequiredAssets(BSPData* bsp); + private: + FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName); + bool addDefaultRequiredAssets(BSPData* bsp); - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; - }; -} \ No newline at end of file + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp index 8289c1a4..5a7b99cb 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp @@ -1,12 +1,12 @@ -#include "ClipMapLinker.h" #include "../BSPUtil.h" +#include "ClipMapLinker.h" namespace BSP { ClipMapLinker::ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) : m_memory(memory), - m_search_path(searchPath), - m_context(context) + m_search_path(searchPath), + m_context(context) { } @@ -18,7 +18,7 @@ namespace BSP clipMap->dynEntCount[1] = 0; clipMap->dynEntCount[2] = 0; clipMap->dynEntCount[3] = 0; - + clipMap->dynEntClientList[0] = m_memory.Alloc(clipMap->dynEntCount[0]); clipMap->dynEntClientList[1] = nullptr; @@ -50,7 +50,7 @@ namespace BSP void ClipMapLinker::loadBoxData(clipMap_t* clipMap) { - // box_model and box_brush are what are used by game traces as "temporary" collision when + // 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. // All values in this function are taken from official map BSPs @@ -128,7 +128,7 @@ namespace BSP // Right now there is only one submodel, the world sub model assert(gfxWorld->modelCount == 1); - + clipMap->numSubModels = 1; clipMap->cmodels = m_memory.Alloc(clipMap->numSubModels); @@ -282,9 +282,9 @@ namespace BSP return static_cast(parentAABBIndex); } - constexpr vec3_t normalX = { 1.0f, 0.0f, 0.0f }; - constexpr vec3_t normalY = { 0.0f, 1.0f, 0.0f }; - constexpr vec3_t normalZ = { 0.0f, 0.0f, 1.0f }; + constexpr vec3_t normalX = {1.0f, 0.0f, 0.0f}; + constexpr vec3_t normalY = {0.0f, 1.0f, 0.0f}; + constexpr vec3_t normalZ = {0.0f, 0.0f, 1.0f}; // returns the index of the node/leaf parsed by the function // Nodes are indexed by their index in the node array @@ -296,7 +296,7 @@ namespace BSP { cLeaf_s leaf; - leaf.cluster = 0; // always use cluster 0 + leaf.cluster = 0; // always use cluster 0 leaf.brushContents = 0; // no brushes used so contents is 0 leaf.terrainContents = BSPEditableConstants::LEAF_TERRAIN_CONTENTS; @@ -428,7 +428,8 @@ namespace BSP } BSPUtil::updateAABBWithPoint(vert, partitionMins, partitionMaxs); } - std::shared_ptr currObject = std::make_shared(partitionMins.x, partitionMins.y, partitionMins.z, partitionMaxs.x, partitionMaxs.y, partitionMaxs.z, partitionIdx); + std::shared_ptr currObject = + std::make_shared(partitionMins.x, partitionMins.y, partitionMins.z, partitionMaxs.x, partitionMaxs.y, partitionMaxs.z, partitionIdx); tree->addObjectToTree(std::move(currObject)); } @@ -493,7 +494,7 @@ namespace BSP } // the reinterpret_cast is used as triIndices is just a pointer to an array of indicies, and static_cast can't safely do the conversion clipMap->triCount = static_cast(triIndexVec.size() / 3); - clipMap->triIndices = reinterpret_cast(m_memory.Alloc(triIndexVec.size())); + clipMap->triIndices = reinterpret_cast(m_memory.Alloc(triIndexVec.size())); memcpy(clipMap->triIndices, &triIndexVec[0], sizeof(uint16_t) * triIndexVec.size()); // partitions are "containers" for vertices. BSP tree leafs contain a list of these partitions to determine the collision within a leaf. @@ -501,7 +502,7 @@ namespace BSP std::vector uniqueIndicesVec; for (BSPSurface& surface : bsp->colWorld.surfaces) { - // partitions are made for each triangle, not one for each surface. + // partitions are made for each triangle, not one for each surface. // one for each surface causes physics bugs, as the entire bounding box is considered solid instead of the surface itself (for some reason). // so a partition is made for each triangle which removes the physics bugs but likely makes the game run slower int indexOfFirstTri = surface.indexOfFirstIndex / 3; @@ -621,7 +622,7 @@ namespace BSP loadRopesAndConstraints(clipMap); loadSubModelCollision(clipMap, bsp); - + loadDynEnts(clipMap); loadXModelCollision(clipMap); @@ -648,5 +649,4 @@ namespace BSP auto clipMapAsset = m_context.AddAsset(clipMap->name, clipMap); return AssetCreationResult::Success(clipMapAsset); } -} - +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h index 44d8643b..c97833a5 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h @@ -1,39 +1,39 @@ #pragma once #include "../BSP.h" +#include "../BSPCalculation.h" #include "Asset/IAssetCreator.h" #include "SearchPath/ISearchPath.h" #include "Utils/MemoryManager.h" -#include "../BSPCalculation.h" namespace BSP { - class ClipMapLinker - { - public: - ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - AssetCreationResult linkClipMap(BSPData* bsp); + class ClipMapLinker + { + public: + ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); + AssetCreationResult linkClipMap(BSPData* bsp); - private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; + private: + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; - void loadBoxData(clipMap_t* clipMap); - void loadVisibility(clipMap_t* clipMap); - void loadDynEnts(clipMap_t* clipMap); - void loadRopesAndConstraints(clipMap_t* clipMap); - void loadSubModelCollision(clipMap_t* clipMap, BSPData* bsp); - void loadXModelCollision(clipMap_t* clipMap); + void loadBoxData(clipMap_t* clipMap); + void loadVisibility(clipMap_t* clipMap); + void loadDynEnts(clipMap_t* clipMap); + void loadRopesAndConstraints(clipMap_t* clipMap); + void loadSubModelCollision(clipMap_t* clipMap, BSPData* bsp); + void loadXModelCollision(clipMap_t* clipMap); - std::vector planeVec; - std::vector nodeVec; - std::vector leafVec; - std::vector AABBTreeVec; - int addAABBTreeFromLeaf(BSPTree* node, clipMap_t* clipMap); - int16_t loadBSPNode(clipMap_t* clipMap, BSPTree* tree); - void loadBSPTree(clipMap_t* clipMap, BSPData* bsp); - bool loadPartitions(clipMap_t* clipMap, BSPData* bsp); - bool loadWorldCollision(clipMap_t* clipMap, BSPData* bsp); - }; -} \ No newline at end of file + std::vector planeVec; + std::vector nodeVec; + std::vector leafVec; + std::vector AABBTreeVec; + int addAABBTreeFromLeaf(BSPTree* node, clipMap_t* clipMap); + int16_t loadBSPNode(clipMap_t* clipMap, BSPTree* tree); + void loadBSPTree(clipMap_t* clipMap, BSPData* bsp); + bool loadPartitions(clipMap_t* clipMap, BSPData* bsp); + bool loadWorldCollision(clipMap_t* clipMap, BSPData* bsp); + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp index 88e8b8a8..dd794d36 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp @@ -4,8 +4,8 @@ namespace BSP { ComWorldLinker::ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) : m_memory(memory), - m_search_path(searchPath), - m_context(context) + m_search_path(searchPath), + m_context(context) { } @@ -19,7 +19,7 @@ namespace BSP comWorld->primaryLights = m_memory.Alloc(comWorld->primaryLightCount); // first (static) light is always empty - + ComPrimaryLight* sunLight = &comWorld->primaryLights[1]; const vec4_t sunLightColor = BSPEditableConstants::SUNLIGHT_COLOR; const vec3_t sunLightDirection = BSPEditableConstants::SUNLIGHT_DIRECTION; @@ -35,5 +35,4 @@ namespace BSP auto comWorldAsset = m_context.AddAsset(comWorld->name, comWorld); return AssetCreationResult::Success(comWorldAsset); } -} - +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h index 21be6a16..ba5a39fb 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h @@ -7,15 +7,15 @@ namespace BSP { - class ComWorldLinker - { - public: - ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - AssetCreationResult linkComWorld(BSPData* bsp); + class ComWorldLinker + { + public: + ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); + AssetCreationResult linkComWorld(BSPData* bsp); - private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; - }; -} \ No newline at end of file + private: + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp index 460f71d3..56e57463 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp @@ -4,8 +4,8 @@ namespace BSP { GameWorldMpLinker::GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) : m_memory(memory), - m_search_path(searchPath), - m_context(context) + m_search_path(searchPath), + m_context(context) { } @@ -28,9 +28,8 @@ namespace BSP gameWorldMp->path.pathVis = nullptr; gameWorldMp->path.smoothCache = nullptr; gameWorldMp->path.nodeTree = nullptr; - + auto gameWorldMpAsset = m_context.AddAsset(gameWorldMp->name, gameWorldMp); return AssetCreationResult::Success(gameWorldMpAsset); } -} - +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h index a1ca459e..5f989105 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h @@ -7,15 +7,15 @@ namespace BSP { - class GameWorldMpLinker - { - public: - GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - AssetCreationResult linkGameWorldMp(BSPData* bsp); + class GameWorldMpLinker + { + public: + GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); + AssetCreationResult linkGameWorldMp(BSPData* bsp); - private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; - }; -} \ No newline at end of file + private: + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp index 813a8b56..bcfae3bb 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp @@ -1,16 +1,16 @@ -#include "GfxWorldLinker.h" #include "../BSPUtil.h" +#include "GfxWorldLinker.h" #include "Utils/Pack.h" namespace BSP { GfxWorldLinker::GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) : m_memory(memory), - m_search_path(searchPath), - m_context(context) + m_search_path(searchPath), + m_context(context) { } - + void GfxWorldLinker::loadDrawData(BSPData* bsp, GfxWorld* gfxWorld) { size_t vertexCount = bsp->gfxWorld.vertices.size(); @@ -157,18 +157,18 @@ namespace BSP /* Models are unsupported right now Code is left in in case it is supported later on - + unsigned int modelCount = projInfo->modelCount; gfxWorld->dpvs.smodelCount = modelCount; gfxWorld->dpvs.smodelInsts = new GfxStaticModelInst[modelCount]; gfxWorld->dpvs.smodelDrawInsts = new GfxStaticModelDrawInst[modelCount]; - + for (unsigned int i = 0; i < modelCount; i++) { auto currModel = &gfxWorld->dpvs.smodelDrawInsts[i]; auto currModelInst = &gfxWorld->dpvs.smodelInsts[i]; customMapModel* inModel = &projInfo->models[i]; - + auto xModelAsset = m_context.LoadDependency(inModel->name); if (xModelAsset == nullptr) { @@ -177,15 +177,15 @@ namespace BSP } else currModel->model = (XModel*)xModelAsset->Asset(); - + 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.scale = inModel->scale; - + BSPUtil::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 currModelInst->mins.x = currModel->model->mins.x + currModel->placement.origin.x; @@ -194,12 +194,12 @@ namespace BSP currModelInst->maxs.x = currModel->model->maxs.x + currModel->placement.origin.x; currModelInst->maxs.y = currModel->model->maxs.y + currModel->placement.origin.y; currModelInst->maxs.z = currModel->model->maxs.z + currModel->placement.origin.z; - + currModel->cullDist = DEFAULT_SMODEL_CULL_DIST; currModel->flags = DEFAULT_SMODEL_FLAGS; currModel->primaryLightIndex = DEFAULT_SMODEL_LIGHT; currModel->reflectionProbeIndex = DEFAULT_SMODEL_REFLECTION_PROBE; - + // unknown use / unused currModel->smid = i; memset(&currModel->lightingSH, 0, sizeof(GfxLightingSHQuantized)); @@ -207,7 +207,7 @@ namespace BSP currModel->lightingHandle = 0; currModel->colorsIndex = 0; currModel->visibility = 0; - + // setting these to nullptr makes any static/baked lighting go black when not rendered by real-time lighting or in a shadow // TODO: calculate lighting and store it here currModel->lmapVertexInfo[0].numLmapVertexColors = 0; @@ -376,8 +376,8 @@ namespace BSP gfxWorld->lightGrid.maxs[1] = 200; gfxWorld->lightGrid.maxs[2] = 50; - gfxWorld->lightGrid.rowAxis = 0; // default value - gfxWorld->lightGrid.colAxis = 1; // default value + gfxWorld->lightGrid.rowAxis = 0; // default value + gfxWorld->lightGrid.colAxis = 1; // default value gfxWorld->lightGrid.sunPrimaryLightIndex = BSPGameConstants::SUN_LIGHT_INDEX; gfxWorld->lightGrid.offset = 0.0f; // default value @@ -409,7 +409,7 @@ namespace BSP gfxWorld->lightGrid.entries = entryArray; // colours are looked up with a lightgrid entries colorsIndex - gfxWorld->lightGrid.colorCount = 0x1000; //0x1000 as it should be enough to hold every index + gfxWorld->lightGrid.colorCount = 0x1000; // 0x1000 as it should be enough to hold every index gfxWorld->lightGrid.colors = m_memory.Alloc(gfxWorld->lightGrid.colorCount); memset(gfxWorld->lightGrid.colors, BSPEditableConstants::LIGHTGRID_COLOUR, rowDataStartSize * sizeof(uint16_t)); @@ -519,7 +519,7 @@ namespace BSP // Other models aren't implemented yet // Code kept for future use - //for (size_t i = 0; i < entityModelList.size(); i++) + // for (size_t i = 0; i < entityModelList.size(); i++) //{ // auto currEntModel = &gfxWorld->models[i + 1]; // entModelBounds currEntModelBounds = entityModelList[i]; @@ -666,7 +666,7 @@ namespace BSP gfxWorld->dpvsDyn.dynEntClientCount[0] = dynEntCount + 256; // the game allocs 256 empty dynents, as they may be used ingame gfxWorld->dpvsDyn.dynEntClientCount[1] = 0; - // +100: there is a crash that happens when regdolls are created, and dynEntClientWordCount[0] is the issue. + // +100: there is a crash that happens when regdolls are created, and dynEntClientWordCount[0] is the issue. // Making the value much larger than required fixes it, but unsure what the root cause is gfxWorld->dpvsDyn.dynEntClientWordCount[0] = ((gfxWorld->dpvsDyn.dynEntClientCount[0] + 31) >> 5) + 100; gfxWorld->dpvsDyn.dynEntClientWordCount[1] = 0; @@ -772,5 +772,4 @@ namespace BSP auto gfxWorldAsset = m_context.AddAsset(gfxWorld->name, gfxWorld); return AssetCreationResult::Success(gfxWorldAsset); } -} - +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h index 43963c34..f48de580 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h @@ -7,31 +7,31 @@ namespace BSP { - class GfxWorldLinker - { - public: - GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - AssetCreationResult linkGfxWorld(BSPData* bsp); + class GfxWorldLinker + { + public: + GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); + AssetCreationResult linkGfxWorld(BSPData* bsp); - private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; + private: + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; - void loadDrawData(BSPData* projInfo, GfxWorld* gfxWorld); - bool loadMapSurfaces(BSPData* projInfo, GfxWorld* gfxWorld); - void loadXModels(BSPData* projInfo, GfxWorld* gfxWorld); - void cleanGfxWorld(GfxWorld* gfxWorld); - void loadGfxLights(GfxWorld* gfxWorld); - void loadLightGrid(GfxWorld* gfxWorld); - void loadGfxCells(GfxWorld* gfxWorld); - void loadModels(GfxWorld* gfxWorld); - bool loadReflectionProbeData(GfxWorld* gfxWorld); - bool loadLightmapData(GfxWorld* gfxWorld); - void loadSkyBox(BSPData* projInfo, GfxWorld* gfxWorld); - void loadDynEntData(GfxWorld* gfxWorld); - bool loadOutdoors(GfxWorld* gfxWorld); - void loadSunData(GfxWorld* gfxWorld); - void loadWorldBounds(GfxWorld* gfxWorld); - }; -} \ No newline at end of file + void loadDrawData(BSPData* projInfo, GfxWorld* gfxWorld); + bool loadMapSurfaces(BSPData* projInfo, GfxWorld* gfxWorld); + void loadXModels(BSPData* projInfo, GfxWorld* gfxWorld); + void cleanGfxWorld(GfxWorld* gfxWorld); + void loadGfxLights(GfxWorld* gfxWorld); + void loadLightGrid(GfxWorld* gfxWorld); + void loadGfxCells(GfxWorld* gfxWorld); + void loadModels(GfxWorld* gfxWorld); + bool loadReflectionProbeData(GfxWorld* gfxWorld); + bool loadLightmapData(GfxWorld* gfxWorld); + void loadSkyBox(BSPData* projInfo, GfxWorld* gfxWorld); + void loadDynEntData(GfxWorld* gfxWorld); + bool loadOutdoors(GfxWorld* gfxWorld); + void loadSunData(GfxWorld* gfxWorld); + void loadWorldBounds(GfxWorld* gfxWorld); + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp index c96f5678..5a75e614 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp @@ -1,5 +1,5 @@ -#include "MapEntsLinker.h" #include "../BSPUtil.h" +#include "MapEntsLinker.h" #include using namespace nlohmann; @@ -59,18 +59,15 @@ namespace } } - std::string loadMapEnts() - { - - } -} + std::string loadMapEnts() {} +} // namespace namespace BSP { MapEntsLinker::MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) : m_memory(memory), - m_search_path(searchPath), - m_context(context) + m_search_path(searchPath), + m_context(context) { } @@ -138,5 +135,4 @@ namespace BSP return AssetCreationResult::Failure(); } } -} - +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h index 921af16d..468989c8 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h @@ -7,15 +7,15 @@ namespace BSP { - class MapEntsLinker - { - public: - MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - AssetCreationResult linkMapEnts(BSPData* bsp); + class MapEntsLinker + { + public: + MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); + AssetCreationResult linkMapEnts(BSPData* bsp); - private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; - }; -} \ No newline at end of file + private: + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp index 2647a14b..9792d244 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp @@ -4,8 +4,8 @@ namespace BSP { SkinnedVertsLinker::SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) : m_memory(memory), - m_search_path(searchPath), - m_context(context) + m_search_path(searchPath), + m_context(context) { } @@ -22,5 +22,4 @@ namespace BSP auto skinnedVertsAsset = m_context.AddAsset(assetName, skinnedVerts); return AssetCreationResult::Success(skinnedVertsAsset); } -} - +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h index db7f03b7..605a95ac 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h @@ -7,15 +7,15 @@ namespace BSP { - class SkinnedVertsLinker - { - public: - SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - AssetCreationResult linkSkinnedVerts(BSPData* bsp); + class SkinnedVertsLinker + { + public: + SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); + AssetCreationResult linkSkinnedVerts(BSPData* bsp); - private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; - }; -} \ No newline at end of file + private: + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; + }; +} // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/LoaderBSP_T6.cpp b/src/ObjLoading/Game/T6/BSP/LoaderBSP_T6.cpp index 70f36ac7..118b265d 100644 --- a/src/ObjLoading/Game/T6/BSP/LoaderBSP_T6.cpp +++ b/src/ObjLoading/Game/T6/BSP/LoaderBSP_T6.cpp @@ -1,7 +1,7 @@ -#include "LoaderBSP_T6.h" #include "BSPCreator.h" #include "BSPUtil.h" #include "Linker/BSPLinker.h" +#include "LoaderBSP_T6.h" namespace { @@ -28,7 +28,7 @@ namespace std::unique_ptr bsp = BSP::createBSPData(m_zone.m_name, m_search_path); if (bsp == nullptr) return AssetCreationResult::Failure(); - + BSPLinker linker(m_memory, m_search_path, context); return linker.linkBSP(bsp.get()); }