mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-23 05:12:05 +00:00
Formatted all BSP loading files using clang.
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include "Game/T6/T6.h"
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "Utils/Logging/Log.h"
|
#include "Utils/Logging/Log.h"
|
||||||
|
|
||||||
#include "Game/T6/T6.h"
|
#include <cassert>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
using namespace T6;
|
using namespace T6;
|
||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
@@ -71,40 +70,32 @@ namespace BSP
|
|||||||
BSP_DEFAULT_LIGHT_COUNT = 2
|
BSP_DEFAULT_LIGHT_COUNT = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const char* DEFENDER_SPAWN_POINT_NAMES[] = {
|
inline const char* DEFENDER_SPAWN_POINT_NAMES[] = {"mp_ctf_spawn_allies",
|
||||||
"mp_ctf_spawn_allies",
|
"mp_ctf_spawn_allies_start",
|
||||||
"mp_ctf_spawn_allies_start",
|
"mp_sd_spawn_defender",
|
||||||
"mp_sd_spawn_defender",
|
"mp_dom_spawn_allies_start",
|
||||||
"mp_dom_spawn_allies_start",
|
"mp_dem_spawn_defender_start",
|
||||||
"mp_dem_spawn_defender_start",
|
"mp_dem_spawn_defenderOT_start",
|
||||||
"mp_dem_spawn_defenderOT_start",
|
"mp_dem_spawn_defender",
|
||||||
"mp_dem_spawn_defender",
|
"mp_tdm_spawn_allies_start",
|
||||||
"mp_tdm_spawn_allies_start",
|
"mp_tdm_spawn_team1_start",
|
||||||
"mp_tdm_spawn_team1_start",
|
"mp_tdm_spawn_team2_start",
|
||||||
"mp_tdm_spawn_team2_start",
|
"mp_tdm_spawn_team3_start"};
|
||||||
"mp_tdm_spawn_team3_start"
|
|
||||||
};
|
|
||||||
|
|
||||||
inline const char* ATTACKER_SPAWN_POINT_NAMES[] = {
|
inline const char* ATTACKER_SPAWN_POINT_NAMES[] = {"mp_ctf_spawn_axis",
|
||||||
"mp_ctf_spawn_axis",
|
"mp_ctf_spawn_axis_start",
|
||||||
"mp_ctf_spawn_axis_start",
|
"mp_sd_spawn_attacker",
|
||||||
"mp_sd_spawn_attacker",
|
"mp_dom_spawn_axis_start",
|
||||||
"mp_dom_spawn_axis_start",
|
"mp_dem_spawn_attacker_start",
|
||||||
"mp_dem_spawn_attacker_start",
|
"mp_dem_spawn_attackerOT_start",
|
||||||
"mp_dem_spawn_attackerOT_start",
|
"mp_dem_spawn_defender",
|
||||||
"mp_dem_spawn_defender",
|
"mp_tdm_spawn_axis_start",
|
||||||
"mp_tdm_spawn_axis_start",
|
"mp_tdm_spawn_team4_start",
|
||||||
"mp_tdm_spawn_team4_start",
|
"mp_tdm_spawn_team5_start",
|
||||||
"mp_tdm_spawn_team5_start",
|
"mp_tdm_spawn_team6_start"};
|
||||||
"mp_tdm_spawn_team6_start"
|
|
||||||
};
|
|
||||||
|
|
||||||
inline const char* FFA_SPAWN_POINT_NAMES[] = {
|
inline const char* FFA_SPAWN_POINT_NAMES[] = {"mp_tdm_spawn", "mp_dm_spawn", "mp_dom_spawn"};
|
||||||
"mp_tdm_spawn",
|
} // namespace BSPGameConstants
|
||||||
"mp_dm_spawn",
|
|
||||||
"mp_dom_spawn"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// BSPLinkingConstants:
|
// BSPLinkingConstants:
|
||||||
// These values are BSP linking constants that are required for the link to be successful
|
// 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"({
|
constexpr const char* DEFAULT_MAP_ENTS_STRING = R"({
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
@@ -152,7 +142,7 @@ namespace BSP
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})";
|
})";
|
||||||
}
|
} // namespace BSPLinkingConstants
|
||||||
|
|
||||||
// BSPEditableConstants:
|
// BSPEditableConstants:
|
||||||
// These values are BSP constants that can be edited and may not break the linker/game if changed
|
// 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;
|
constexpr unsigned char LIGHTGRID_COLOUR = 128;
|
||||||
|
|
||||||
// Sunlight values
|
// Sunlight values
|
||||||
constexpr vec4_t SUNLIGHT_COLOR = { 0.75f, 0.75f, 0.75f, 1.0f };
|
constexpr vec4_t SUNLIGHT_COLOR = {0.75f, 0.75f, 0.75f, 1.0f};
|
||||||
constexpr vec3_t SUNLIGHT_DIRECTION = { 0.0f, 0.0f, 0.0f };
|
constexpr vec3_t SUNLIGHT_DIRECTION = {0.0f, 0.0f, 0.0f};
|
||||||
};
|
}; // namespace BSPEditableConstants
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -148,4 +148,4 @@ namespace BSP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ namespace BSP
|
|||||||
BSPObject(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int objPartitionIndex);
|
BSPObject(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int objPartitionIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BSPLeaf
|
class BSPLeaf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -47,7 +46,7 @@ namespace BSP
|
|||||||
std::unique_ptr<BSPTree> front;
|
std::unique_ptr<BSPTree> front;
|
||||||
std::unique_ptr<BSPTree> back;
|
std::unique_ptr<BSPTree> 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
|
float distance; // distance from the origin (0, 0, 0) to the plane
|
||||||
|
|
||||||
BSPNode(std::unique_ptr<BSPTree> frontTree, std::unique_ptr<BSPTree> backTree, PlaneAxis nodeAxis, float nodeDistance);
|
BSPNode(std::unique_ptr<BSPTree> frontTree, std::unique_ptr<BSPTree> backTree, PlaneAxis nodeAxis, float nodeDistance);
|
||||||
@@ -69,4 +68,4 @@ namespace BSP
|
|||||||
void splitTree();
|
void splitTree();
|
||||||
void addObjectToTree(std::shared_ptr<BSPObject> object);
|
void addObjectToTree(std::shared_ptr<BSPObject> object);
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -6,11 +6,8 @@ namespace
|
|||||||
{
|
{
|
||||||
using namespace BSP;
|
using namespace BSP;
|
||||||
|
|
||||||
void addFBXMeshToWorld(ufbx_node* node,
|
void addFBXMeshToWorld(
|
||||||
std::vector<BSPSurface>& surfaceVec,
|
ufbx_node* node, std::vector<BSPSurface>& surfaceVec, std::vector<BSPVertex>& vertexVec, std::vector<uint16_t>& indexVec, bool& hasTangentSpace)
|
||||||
std::vector<BSPVertex>& vertexVec,
|
|
||||||
std::vector<uint16_t>& indexVec,
|
|
||||||
bool& hasTangentSpace)
|
|
||||||
{
|
{
|
||||||
ufbx_mesh* mesh = node->mesh;
|
ufbx_mesh* mesh = node->mesh;
|
||||||
|
|
||||||
@@ -187,7 +184,7 @@ namespace
|
|||||||
if (hasTangentSpace == false)
|
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.");
|
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
|
namespace BSP
|
||||||
{
|
{
|
||||||
@@ -211,7 +208,7 @@ namespace BSP
|
|||||||
}
|
}
|
||||||
|
|
||||||
ufbx_error errorGfx;
|
ufbx_error errorGfx;
|
||||||
ufbx_load_opts optsGfx {};
|
ufbx_load_opts optsGfx{};
|
||||||
optsGfx.target_axes = ufbx_axes_right_handed_y_up;
|
optsGfx.target_axes = ufbx_axes_right_handed_y_up;
|
||||||
optsGfx.generate_missing_normals = true;
|
optsGfx.generate_missing_normals = true;
|
||||||
optsGfx.allow_missing_vertex_position = false;
|
optsGfx.allow_missing_vertex_position = false;
|
||||||
@@ -243,7 +240,7 @@ namespace BSP
|
|||||||
}
|
}
|
||||||
|
|
||||||
ufbx_error errorCol;
|
ufbx_error errorCol;
|
||||||
ufbx_load_opts optsCol {};
|
ufbx_load_opts optsCol{};
|
||||||
optsCol.target_axes = ufbx_axes_right_handed_y_up;
|
optsCol.target_axes = ufbx_axes_right_handed_y_up;
|
||||||
optsCol.generate_missing_normals = true;
|
optsCol.generate_missing_normals = true;
|
||||||
optsCol.allow_missing_vertex_position = false;
|
optsCol.allow_missing_vertex_position = false;
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
std::unique_ptr<BSPData> createBSPData(std::string& mapName, ISearchPath& searchPath);
|
std::unique_ptr<BSPData> createBSPData(std::string& mapName, ISearchPath& searchPath);
|
||||||
};
|
}; // namespace BSP
|
||||||
|
|||||||
@@ -1,169 +1,173 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "BSPUtil.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
#include "BSPUtil.h"
|
namespace BSP
|
||||||
|
|
||||||
std::string BSPUtil::getFileNameForBSPAsset(std::string& assetName)
|
|
||||||
{
|
{
|
||||||
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 BSPUtil::convertToBO2Coords(vec3_t& coordinate)
|
||||||
{
|
{
|
||||||
vec3_t result;
|
vec3_t result;
|
||||||
result.x = coordinate.x;
|
result.x = coordinate.x;
|
||||||
result.y = -coordinate.z;
|
result.y = -coordinate.z;
|
||||||
result.z = coordinate.y;
|
result.z = coordinate.y;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3_t BSPUtil::convertFromBO2Coords(vec3_t& coordinate)
|
vec3_t BSPUtil::convertFromBO2Coords(vec3_t& coordinate)
|
||||||
{
|
{
|
||||||
vec3_t result;
|
vec3_t result;
|
||||||
result.x = coordinate.x;
|
result.x = coordinate.x;
|
||||||
result.y = coordinate.z;
|
result.y = coordinate.z;
|
||||||
result.z = -coordinate.y;
|
result.z = -coordinate.y;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSPUtil::updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs)
|
void BSPUtil::updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs)
|
||||||
{
|
{
|
||||||
if (AABBMins.x > newAABBMins.x)
|
if (AABBMins.x > newAABBMins.x)
|
||||||
AABBMins.x = newAABBMins.x;
|
AABBMins.x = newAABBMins.x;
|
||||||
|
|
||||||
if (newAABBMaxs.x > AABBMaxs.x)
|
if (newAABBMaxs.x > AABBMaxs.x)
|
||||||
AABBMaxs.x = newAABBMaxs.x;
|
AABBMaxs.x = newAABBMaxs.x;
|
||||||
|
|
||||||
if (AABBMins.y > newAABBMins.y)
|
if (AABBMins.y > newAABBMins.y)
|
||||||
AABBMins.y = newAABBMins.y;
|
AABBMins.y = newAABBMins.y;
|
||||||
|
|
||||||
if (newAABBMaxs.y > AABBMaxs.y)
|
if (newAABBMaxs.y > AABBMaxs.y)
|
||||||
AABBMaxs.y = newAABBMaxs.y;
|
AABBMaxs.y = newAABBMaxs.y;
|
||||||
|
|
||||||
if (AABBMins.z > newAABBMins.z)
|
if (AABBMins.z > newAABBMins.z)
|
||||||
AABBMins.z = newAABBMins.z;
|
AABBMins.z = newAABBMins.z;
|
||||||
|
|
||||||
if (newAABBMaxs.z > AABBMaxs.z)
|
if (newAABBMaxs.z > AABBMaxs.z)
|
||||||
AABBMaxs.z = newAABBMaxs.z;
|
AABBMaxs.z = newAABBMaxs.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSPUtil::updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs)
|
void BSPUtil::updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs)
|
||||||
{
|
{
|
||||||
if (AABBMins.x > point.x)
|
if (AABBMins.x > point.x)
|
||||||
AABBMins.x = point.x;
|
AABBMins.x = point.x;
|
||||||
|
|
||||||
if (point.x > AABBMaxs.x)
|
if (point.x > AABBMaxs.x)
|
||||||
AABBMaxs.x = point.x;
|
AABBMaxs.x = point.x;
|
||||||
|
|
||||||
if (AABBMins.y > point.y)
|
if (AABBMins.y > point.y)
|
||||||
AABBMins.y = point.y;
|
AABBMins.y = point.y;
|
||||||
|
|
||||||
if (point.y > AABBMaxs.y)
|
if (point.y > AABBMaxs.y)
|
||||||
AABBMaxs.y = point.y;
|
AABBMaxs.y = point.y;
|
||||||
|
|
||||||
if (AABBMins.z > point.z)
|
if (AABBMins.z > point.z)
|
||||||
AABBMins.z = point.z;
|
AABBMins.z = point.z;
|
||||||
|
|
||||||
if (point.z > AABBMaxs.z)
|
if (point.z > AABBMaxs.z)
|
||||||
AABBMaxs.z = point.z;
|
AABBMaxs.z = point.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3_t BSPUtil::calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs)
|
vec3_t BSPUtil::calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs)
|
||||||
{
|
{
|
||||||
vec3_t result;
|
vec3_t result;
|
||||||
result.x = (mins.x + maxs.x) * 0.5f;
|
result.x = (mins.x + maxs.x) * 0.5f;
|
||||||
result.y = (mins.y + maxs.y) * 0.5f;
|
result.y = (mins.y + maxs.y) * 0.5f;
|
||||||
result.z = (mins.z + maxs.z) * 0.5f;
|
result.z = (mins.z + maxs.z) * 0.5f;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3_t BSPUtil::calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs)
|
vec3_t BSPUtil::calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs)
|
||||||
{
|
{
|
||||||
vec3_t result;
|
vec3_t result;
|
||||||
result.x = (maxs.x - mins.x) * 0.5f;
|
result.x = (maxs.x - mins.x) * 0.5f;
|
||||||
result.y = (maxs.y - mins.y) * 0.5f;
|
result.y = (maxs.y - mins.y) * 0.5f;
|
||||||
result.z = (maxs.z - mins.z) * 0.5f;
|
result.z = (maxs.z - mins.z) * 0.5f;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BSPUtil::allignBy128(size_t size)
|
size_t BSPUtil::allignBy128(size_t size)
|
||||||
{
|
{
|
||||||
return ((size + 127) & 0xFFFFFF80);
|
return ((size + 127) & 0xFFFFFF80);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BSPUtil::distBetweenPoints(vec3_t& p1, vec3_t& p2)
|
float BSPUtil::distBetweenPoints(vec3_t& p1, vec3_t& p2)
|
||||||
{
|
{
|
||||||
float x = p2.x - p1.x;
|
float x = p2.x - p1.x;
|
||||||
float y = p2.y - p1.y;
|
float y = p2.y - p1.y;
|
||||||
float z = p2.z - p1.z;
|
float z = p2.z - p1.z;
|
||||||
return sqrtf((x * x) + (y * y) + (z * z));
|
return sqrtf((x * x) + (y * y) + (z * z));
|
||||||
}
|
}
|
||||||
|
|
||||||
// angles are in euler degrees
|
// angles are in euler degrees
|
||||||
void BSPUtil::convertAnglesToAxis(vec3_t* angles, vec3_t* axis)
|
void BSPUtil::convertAnglesToAxis(vec3_t* angles, vec3_t* axis)
|
||||||
{
|
{
|
||||||
float xRadians = angles->x * 0.017453292f; // M_PI / 180.0f
|
float xRadians = angles->x * 0.017453292f; // M_PI / 180.0f
|
||||||
float yRadians = angles->y * 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 zRadians = angles->z * 0.017453292f; // M_PI / 180.0f
|
||||||
|
|
||||||
float cosX = cos(xRadians);
|
float cosX = cos(xRadians);
|
||||||
float sinX = sin(xRadians);
|
float sinX = sin(xRadians);
|
||||||
float cosY = cos(yRadians);
|
float cosY = cos(yRadians);
|
||||||
float sinY = sin(yRadians);
|
float sinY = sin(yRadians);
|
||||||
float cosZ = cos(zRadians);
|
float cosZ = cos(zRadians);
|
||||||
float sinZ = sin(zRadians);
|
float sinZ = sin(zRadians);
|
||||||
|
|
||||||
axis[0].x = cosX * cosY;
|
axis[0].x = cosX * cosY;
|
||||||
axis[0].y = cosX * sinY;
|
axis[0].y = cosX * sinY;
|
||||||
axis[0].z = -sinX;
|
axis[0].z = -sinX;
|
||||||
axis[1].x = (sinZ * sinX * cosY) - (cosZ * sinY);
|
axis[1].x = (sinZ * sinX * cosY) - (cosZ * sinY);
|
||||||
axis[1].y = (sinZ * sinX * sinY) + (cosZ * cosY);
|
axis[1].y = (sinZ * sinX * sinY) + (cosZ * cosY);
|
||||||
axis[1].z = sinZ * cosX;
|
axis[1].z = sinZ * cosX;
|
||||||
axis[2].x = (cosZ * sinX * cosY) + (sinZ * sinY);
|
axis[2].x = (cosZ * sinX * cosY) + (sinZ * sinY);
|
||||||
axis[2].y = (cosZ * sinX * sinY) - (sinZ * cosY);
|
axis[2].y = (cosZ * sinX * sinY) - (sinZ * cosY);
|
||||||
axis[2].z = cosZ * cosX;
|
axis[2].z = cosZ * cosX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSPUtil::matrixTranspose3x3(const vec3_t* in, vec3_t* out)
|
void BSPUtil::matrixTranspose3x3(const vec3_t* in, vec3_t* out)
|
||||||
{
|
{
|
||||||
out[0].x = in[0].x;
|
out[0].x = in[0].x;
|
||||||
out[0].y = in[1].x;
|
out[0].y = in[1].x;
|
||||||
out[0].z = in[2].x;
|
out[0].z = in[2].x;
|
||||||
out[1].x = in[0].y;
|
out[1].x = in[0].y;
|
||||||
out[1].y = in[1].y;
|
out[1].y = in[1].y;
|
||||||
out[1].z = in[2].y;
|
out[1].z = in[2].y;
|
||||||
out[2].x = in[0].z;
|
out[2].x = in[0].z;
|
||||||
out[2].y = in[1].z;
|
out[2].y = in[1].z;
|
||||||
out[2].z = in[2].z;
|
out[2].z = in[2].z;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3_t BSPUtil::convertStringToVec3(std::string& str)
|
vec3_t BSPUtil::convertStringToVec3(std::string& str)
|
||||||
{
|
{
|
||||||
std::string v1Str = str;
|
std::string v1Str = str;
|
||||||
|
|
||||||
int nextValIndex = 0;
|
int nextValIndex = 0;
|
||||||
while (v1Str[nextValIndex] != ' ')
|
while (v1Str[nextValIndex] != ' ')
|
||||||
nextValIndex++;
|
nextValIndex++;
|
||||||
nextValIndex++; // skip past space
|
nextValIndex++; // skip past space
|
||||||
std::string v2Str = &v1Str[nextValIndex];
|
std::string v2Str = &v1Str[nextValIndex];
|
||||||
|
|
||||||
nextValIndex = 0;
|
nextValIndex = 0;
|
||||||
while (v2Str[nextValIndex] != ' ')
|
while (v2Str[nextValIndex] != ' ')
|
||||||
nextValIndex++;
|
nextValIndex++;
|
||||||
nextValIndex++; // skip past space
|
nextValIndex++; // skip past space
|
||||||
std::string v3Str = &v2Str[nextValIndex];
|
std::string v3Str = &v2Str[nextValIndex];
|
||||||
|
|
||||||
vec3_t result;
|
vec3_t result;
|
||||||
result.x = static_cast<float>(atof(v1Str.c_str()));
|
result.x = static_cast<float>(atof(v1Str.c_str()));
|
||||||
result.y = static_cast<float>(atof(v2Str.c_str()));
|
result.y = static_cast<float>(atof(v2Str.c_str()));
|
||||||
result.z = static_cast<float>(atof(v3Str.c_str()));
|
result.z = static_cast<float>(atof(v3Str.c_str()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BSPUtil::convertVec3ToString(vec3_t& vec)
|
std::string BSPUtil::convertVec3ToString(vec3_t& vec)
|
||||||
{
|
{
|
||||||
std::string result = std::format("{} {} {}", vec.x, vec.y, vec.z);
|
std::string result = std::format("{} {} {}", vec.x, vec.y, vec.z);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace BSP
|
||||||
|
|||||||
@@ -2,21 +2,23 @@
|
|||||||
|
|
||||||
#include "BSP.h"
|
#include "BSP.h"
|
||||||
|
|
||||||
|
namespace BSP
|
||||||
class BSPUtil
|
|
||||||
{
|
{
|
||||||
public:
|
class BSPUtil
|
||||||
static std::string getFileNameForBSPAsset(std::string& assetName);
|
{
|
||||||
static vec3_t convertToBO2Coords(vec3_t& OGL_coordinate);
|
public:
|
||||||
static vec3_t convertFromBO2Coords(vec3_t& bo2_coordinate);
|
static std::string getFileNameForBSPAsset(std::string& assetName);
|
||||||
static void updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs);
|
static vec3_t convertToBO2Coords(vec3_t& OGL_coordinate);
|
||||||
static void updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs);
|
static vec3_t convertFromBO2Coords(vec3_t& bo2_coordinate);
|
||||||
static vec3_t calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs);
|
static void updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs);
|
||||||
static vec3_t calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs);
|
static void updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs);
|
||||||
static size_t allignBy128(size_t size);
|
static vec3_t calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs);
|
||||||
static float distBetweenPoints(vec3_t& p1, vec3_t& p2);
|
static vec3_t calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs);
|
||||||
static void convertAnglesToAxis(vec3_t* angles, vec3_t* axis);
|
static size_t allignBy128(size_t size);
|
||||||
static void matrixTranspose3x3(const vec3_t* in, vec3_t* out);
|
static float distBetweenPoints(vec3_t& p1, vec3_t& p2);
|
||||||
static vec3_t convertStringToVec3(std::string& str);
|
static void convertAnglesToAxis(vec3_t* angles, vec3_t* axis);
|
||||||
static std::string convertVec3ToString(vec3_t& vec);
|
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
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "BSPLinker.h"
|
#include "BSPLinker.h"
|
||||||
|
|
||||||
#include "ComWorldLinker.h"
|
|
||||||
#include "ClipMapLinker.h"
|
#include "ClipMapLinker.h"
|
||||||
|
#include "ComWorldLinker.h"
|
||||||
#include "GameWorldMpLinker.h"
|
#include "GameWorldMpLinker.h"
|
||||||
#include "GfxWorldLinker.h"
|
#include "GfxWorldLinker.h"
|
||||||
#include "MapEntsLinker.h"
|
#include "MapEntsLinker.h"
|
||||||
@@ -52,15 +51,15 @@ namespace BSP
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BSPLinker::BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
BSPLinker::BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||||
: m_memory(memory),
|
: m_memory(memory),
|
||||||
m_search_path(searchPath),
|
m_search_path(searchPath),
|
||||||
m_context(context)
|
m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetCreationResult BSPLinker::linkBSP(BSPData* bsp)
|
AssetCreationResult BSPLinker::linkBSP(BSPData* bsp)
|
||||||
{
|
{
|
||||||
if (!addDefaultRequiredAssets(bsp))
|
if (!addDefaultRequiredAssets(bsp))
|
||||||
return AssetCreationResult::Failure();
|
return AssetCreationResult::Failure();
|
||||||
|
|
||||||
@@ -92,6 +91,5 @@ namespace BSP
|
|||||||
return AssetCreationResult::Failure();
|
return AssetCreationResult::Failure();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,18 @@
|
|||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
class BSPLinker
|
class BSPLinker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
BSPLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||||
AssetCreationResult linkBSP(BSPData* bsp);
|
AssetCreationResult linkBSP(BSPData* bsp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName);
|
FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName);
|
||||||
bool addDefaultRequiredAssets(BSPData* bsp);
|
bool addDefaultRequiredAssets(BSPData* bsp);
|
||||||
|
|
||||||
MemoryManager& m_memory;
|
MemoryManager& m_memory;
|
||||||
ISearchPath& m_search_path;
|
ISearchPath& m_search_path;
|
||||||
AssetCreationContext& m_context;
|
AssetCreationContext& m_context;
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#include "ClipMapLinker.h"
|
|
||||||
#include "../BSPUtil.h"
|
#include "../BSPUtil.h"
|
||||||
|
#include "ClipMapLinker.h"
|
||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
ClipMapLinker::ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
ClipMapLinker::ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||||
: m_memory(memory),
|
: m_memory(memory),
|
||||||
m_search_path(searchPath),
|
m_search_path(searchPath),
|
||||||
m_context(context)
|
m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,9 +282,9 @@ namespace BSP
|
|||||||
return static_cast<int>(parentAABBIndex);
|
return static_cast<int>(parentAABBIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr vec3_t normalX = { 1.0f, 0.0f, 0.0f };
|
constexpr vec3_t normalX = {1.0f, 0.0f, 0.0f};
|
||||||
constexpr vec3_t normalY = { 0.0f, 1.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 normalZ = {0.0f, 0.0f, 1.0f};
|
||||||
|
|
||||||
// returns the index of the node/leaf parsed by the function
|
// returns the index of the node/leaf parsed by the function
|
||||||
// Nodes are indexed by their index in the node array
|
// Nodes are indexed by their index in the node array
|
||||||
@@ -296,7 +296,7 @@ namespace BSP
|
|||||||
{
|
{
|
||||||
cLeaf_s leaf;
|
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.brushContents = 0; // no brushes used so contents is 0
|
||||||
leaf.terrainContents = BSPEditableConstants::LEAF_TERRAIN_CONTENTS;
|
leaf.terrainContents = BSPEditableConstants::LEAF_TERRAIN_CONTENTS;
|
||||||
|
|
||||||
@@ -428,7 +428,8 @@ namespace BSP
|
|||||||
}
|
}
|
||||||
BSPUtil::updateAABBWithPoint(vert, partitionMins, partitionMaxs);
|
BSPUtil::updateAABBWithPoint(vert, partitionMins, partitionMaxs);
|
||||||
}
|
}
|
||||||
std::shared_ptr<BSPObject> currObject = std::make_shared<BSPObject>(partitionMins.x, partitionMins.y, partitionMins.z, partitionMaxs.x, partitionMaxs.y, partitionMaxs.z, partitionIdx);
|
std::shared_ptr<BSPObject> 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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
|
// 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<int>(triIndexVec.size() / 3);
|
clipMap->triCount = static_cast<int>(triIndexVec.size() / 3);
|
||||||
clipMap->triIndices = reinterpret_cast<uint16_t(*)[3]>(m_memory.Alloc<uint16_t>(triIndexVec.size()));
|
clipMap->triIndices = reinterpret_cast<uint16_t (*)[3]>(m_memory.Alloc<uint16_t>(triIndexVec.size()));
|
||||||
memcpy(clipMap->triIndices, &triIndexVec[0], sizeof(uint16_t) * 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.
|
// partitions are "containers" for vertices. BSP tree leafs contain a list of these partitions to determine the collision within a leaf.
|
||||||
@@ -648,5 +649,4 @@ namespace BSP
|
|||||||
auto clipMapAsset = m_context.AddAsset<AssetClipMap>(clipMap->name, clipMap);
|
auto clipMapAsset = m_context.AddAsset<AssetClipMap>(clipMap->name, clipMap);
|
||||||
return AssetCreationResult::Success(clipMapAsset);
|
return AssetCreationResult::Success(clipMapAsset);
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../BSP.h"
|
#include "../BSP.h"
|
||||||
|
#include "../BSPCalculation.h"
|
||||||
#include "Asset/IAssetCreator.h"
|
#include "Asset/IAssetCreator.h"
|
||||||
#include "SearchPath/ISearchPath.h"
|
#include "SearchPath/ISearchPath.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
#include "../BSPCalculation.h"
|
|
||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
class ClipMapLinker
|
class ClipMapLinker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||||
AssetCreationResult linkClipMap(BSPData* bsp);
|
AssetCreationResult linkClipMap(BSPData* bsp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MemoryManager& m_memory;
|
MemoryManager& m_memory;
|
||||||
ISearchPath& m_search_path;
|
ISearchPath& m_search_path;
|
||||||
AssetCreationContext& m_context;
|
AssetCreationContext& m_context;
|
||||||
|
|
||||||
void loadBoxData(clipMap_t* clipMap);
|
void loadBoxData(clipMap_t* clipMap);
|
||||||
void loadVisibility(clipMap_t* clipMap);
|
void loadVisibility(clipMap_t* clipMap);
|
||||||
void loadDynEnts(clipMap_t* clipMap);
|
void loadDynEnts(clipMap_t* clipMap);
|
||||||
void loadRopesAndConstraints(clipMap_t* clipMap);
|
void loadRopesAndConstraints(clipMap_t* clipMap);
|
||||||
void loadSubModelCollision(clipMap_t* clipMap, BSPData* bsp);
|
void loadSubModelCollision(clipMap_t* clipMap, BSPData* bsp);
|
||||||
void loadXModelCollision(clipMap_t* clipMap);
|
void loadXModelCollision(clipMap_t* clipMap);
|
||||||
|
|
||||||
std::vector<cplane_s> planeVec;
|
std::vector<cplane_s> planeVec;
|
||||||
std::vector<cNode_t> nodeVec;
|
std::vector<cNode_t> nodeVec;
|
||||||
std::vector<cLeaf_s> leafVec;
|
std::vector<cLeaf_s> leafVec;
|
||||||
std::vector<CollisionAabbTree> AABBTreeVec;
|
std::vector<CollisionAabbTree> AABBTreeVec;
|
||||||
int addAABBTreeFromLeaf(BSPTree* node, clipMap_t* clipMap);
|
int addAABBTreeFromLeaf(BSPTree* node, clipMap_t* clipMap);
|
||||||
int16_t loadBSPNode(clipMap_t* clipMap, BSPTree* tree);
|
int16_t loadBSPNode(clipMap_t* clipMap, BSPTree* tree);
|
||||||
void loadBSPTree(clipMap_t* clipMap, BSPData* bsp);
|
void loadBSPTree(clipMap_t* clipMap, BSPData* bsp);
|
||||||
bool loadPartitions(clipMap_t* clipMap, BSPData* bsp);
|
bool loadPartitions(clipMap_t* clipMap, BSPData* bsp);
|
||||||
bool loadWorldCollision(clipMap_t* clipMap, BSPData* bsp);
|
bool loadWorldCollision(clipMap_t* clipMap, BSPData* bsp);
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ namespace BSP
|
|||||||
{
|
{
|
||||||
ComWorldLinker::ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
ComWorldLinker::ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||||
: m_memory(memory),
|
: m_memory(memory),
|
||||||
m_search_path(searchPath),
|
m_search_path(searchPath),
|
||||||
m_context(context)
|
m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,5 +35,4 @@ namespace BSP
|
|||||||
auto comWorldAsset = m_context.AddAsset<AssetComWorld>(comWorld->name, comWorld);
|
auto comWorldAsset = m_context.AddAsset<AssetComWorld>(comWorld->name, comWorld);
|
||||||
return AssetCreationResult::Success(comWorldAsset);
|
return AssetCreationResult::Success(comWorldAsset);
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
class ComWorldLinker
|
class ComWorldLinker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||||
AssetCreationResult linkComWorld(BSPData* bsp);
|
AssetCreationResult linkComWorld(BSPData* bsp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MemoryManager& m_memory;
|
MemoryManager& m_memory;
|
||||||
ISearchPath& m_search_path;
|
ISearchPath& m_search_path;
|
||||||
AssetCreationContext& m_context;
|
AssetCreationContext& m_context;
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ namespace BSP
|
|||||||
{
|
{
|
||||||
GameWorldMpLinker::GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
GameWorldMpLinker::GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||||
: m_memory(memory),
|
: m_memory(memory),
|
||||||
m_search_path(searchPath),
|
m_search_path(searchPath),
|
||||||
m_context(context)
|
m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,5 +32,4 @@ namespace BSP
|
|||||||
auto gameWorldMpAsset = m_context.AddAsset<AssetGameWorldMp>(gameWorldMp->name, gameWorldMp);
|
auto gameWorldMpAsset = m_context.AddAsset<AssetGameWorldMp>(gameWorldMp->name, gameWorldMp);
|
||||||
return AssetCreationResult::Success(gameWorldMpAsset);
|
return AssetCreationResult::Success(gameWorldMpAsset);
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
class GameWorldMpLinker
|
class GameWorldMpLinker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||||
AssetCreationResult linkGameWorldMp(BSPData* bsp);
|
AssetCreationResult linkGameWorldMp(BSPData* bsp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MemoryManager& m_memory;
|
MemoryManager& m_memory;
|
||||||
ISearchPath& m_search_path;
|
ISearchPath& m_search_path;
|
||||||
AssetCreationContext& m_context;
|
AssetCreationContext& m_context;
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "GfxWorldLinker.h"
|
|
||||||
#include "../BSPUtil.h"
|
#include "../BSPUtil.h"
|
||||||
|
#include "GfxWorldLinker.h"
|
||||||
#include "Utils/Pack.h"
|
#include "Utils/Pack.h"
|
||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
GfxWorldLinker::GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
GfxWorldLinker::GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||||
: m_memory(memory),
|
: m_memory(memory),
|
||||||
m_search_path(searchPath),
|
m_search_path(searchPath),
|
||||||
m_context(context)
|
m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,8 +376,8 @@ namespace BSP
|
|||||||
gfxWorld->lightGrid.maxs[1] = 200;
|
gfxWorld->lightGrid.maxs[1] = 200;
|
||||||
gfxWorld->lightGrid.maxs[2] = 50;
|
gfxWorld->lightGrid.maxs[2] = 50;
|
||||||
|
|
||||||
gfxWorld->lightGrid.rowAxis = 0; // default value
|
gfxWorld->lightGrid.rowAxis = 0; // default value
|
||||||
gfxWorld->lightGrid.colAxis = 1; // default value
|
gfxWorld->lightGrid.colAxis = 1; // default value
|
||||||
gfxWorld->lightGrid.sunPrimaryLightIndex = BSPGameConstants::SUN_LIGHT_INDEX;
|
gfxWorld->lightGrid.sunPrimaryLightIndex = BSPGameConstants::SUN_LIGHT_INDEX;
|
||||||
gfxWorld->lightGrid.offset = 0.0f; // default value
|
gfxWorld->lightGrid.offset = 0.0f; // default value
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ namespace BSP
|
|||||||
gfxWorld->lightGrid.entries = entryArray;
|
gfxWorld->lightGrid.entries = entryArray;
|
||||||
|
|
||||||
// colours are looked up with a lightgrid entries colorsIndex
|
// 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<GfxCompressedLightGridColors>(gfxWorld->lightGrid.colorCount);
|
gfxWorld->lightGrid.colors = m_memory.Alloc<GfxCompressedLightGridColors>(gfxWorld->lightGrid.colorCount);
|
||||||
memset(gfxWorld->lightGrid.colors, BSPEditableConstants::LIGHTGRID_COLOUR, rowDataStartSize * sizeof(uint16_t));
|
memset(gfxWorld->lightGrid.colors, BSPEditableConstants::LIGHTGRID_COLOUR, rowDataStartSize * sizeof(uint16_t));
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ namespace BSP
|
|||||||
|
|
||||||
// Other models aren't implemented yet
|
// Other models aren't implemented yet
|
||||||
// Code kept for future use
|
// 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];
|
// auto currEntModel = &gfxWorld->models[i + 1];
|
||||||
// entModelBounds currEntModelBounds = entityModelList[i];
|
// entModelBounds currEntModelBounds = entityModelList[i];
|
||||||
@@ -772,5 +772,4 @@ namespace BSP
|
|||||||
auto gfxWorldAsset = m_context.AddAsset<AssetGfxWorld>(gfxWorld->name, gfxWorld);
|
auto gfxWorldAsset = m_context.AddAsset<AssetGfxWorld>(gfxWorld->name, gfxWorld);
|
||||||
return AssetCreationResult::Success(gfxWorldAsset);
|
return AssetCreationResult::Success(gfxWorldAsset);
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|
||||||
|
|||||||
@@ -7,31 +7,31 @@
|
|||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
class GfxWorldLinker
|
class GfxWorldLinker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||||
AssetCreationResult linkGfxWorld(BSPData* bsp);
|
AssetCreationResult linkGfxWorld(BSPData* bsp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MemoryManager& m_memory;
|
MemoryManager& m_memory;
|
||||||
ISearchPath& m_search_path;
|
ISearchPath& m_search_path;
|
||||||
AssetCreationContext& m_context;
|
AssetCreationContext& m_context;
|
||||||
|
|
||||||
void loadDrawData(BSPData* projInfo, GfxWorld* gfxWorld);
|
void loadDrawData(BSPData* projInfo, GfxWorld* gfxWorld);
|
||||||
bool loadMapSurfaces(BSPData* projInfo, GfxWorld* gfxWorld);
|
bool loadMapSurfaces(BSPData* projInfo, GfxWorld* gfxWorld);
|
||||||
void loadXModels(BSPData* projInfo, GfxWorld* gfxWorld);
|
void loadXModels(BSPData* projInfo, GfxWorld* gfxWorld);
|
||||||
void cleanGfxWorld(GfxWorld* gfxWorld);
|
void cleanGfxWorld(GfxWorld* gfxWorld);
|
||||||
void loadGfxLights(GfxWorld* gfxWorld);
|
void loadGfxLights(GfxWorld* gfxWorld);
|
||||||
void loadLightGrid(GfxWorld* gfxWorld);
|
void loadLightGrid(GfxWorld* gfxWorld);
|
||||||
void loadGfxCells(GfxWorld* gfxWorld);
|
void loadGfxCells(GfxWorld* gfxWorld);
|
||||||
void loadModels(GfxWorld* gfxWorld);
|
void loadModels(GfxWorld* gfxWorld);
|
||||||
bool loadReflectionProbeData(GfxWorld* gfxWorld);
|
bool loadReflectionProbeData(GfxWorld* gfxWorld);
|
||||||
bool loadLightmapData(GfxWorld* gfxWorld);
|
bool loadLightmapData(GfxWorld* gfxWorld);
|
||||||
void loadSkyBox(BSPData* projInfo, GfxWorld* gfxWorld);
|
void loadSkyBox(BSPData* projInfo, GfxWorld* gfxWorld);
|
||||||
void loadDynEntData(GfxWorld* gfxWorld);
|
void loadDynEntData(GfxWorld* gfxWorld);
|
||||||
bool loadOutdoors(GfxWorld* gfxWorld);
|
bool loadOutdoors(GfxWorld* gfxWorld);
|
||||||
void loadSunData(GfxWorld* gfxWorld);
|
void loadSunData(GfxWorld* gfxWorld);
|
||||||
void loadWorldBounds(GfxWorld* gfxWorld);
|
void loadWorldBounds(GfxWorld* gfxWorld);
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "MapEntsLinker.h"
|
|
||||||
#include "../BSPUtil.h"
|
#include "../BSPUtil.h"
|
||||||
|
#include "MapEntsLinker.h"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
@@ -59,18 +59,15 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string loadMapEnts()
|
std::string loadMapEnts() {}
|
||||||
{
|
} // namespace
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
MapEntsLinker::MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
MapEntsLinker::MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||||
: m_memory(memory),
|
: m_memory(memory),
|
||||||
m_search_path(searchPath),
|
m_search_path(searchPath),
|
||||||
m_context(context)
|
m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,5 +135,4 @@ namespace BSP
|
|||||||
return AssetCreationResult::Failure();
|
return AssetCreationResult::Failure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
class MapEntsLinker
|
class MapEntsLinker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||||
AssetCreationResult linkMapEnts(BSPData* bsp);
|
AssetCreationResult linkMapEnts(BSPData* bsp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MemoryManager& m_memory;
|
MemoryManager& m_memory;
|
||||||
ISearchPath& m_search_path;
|
ISearchPath& m_search_path;
|
||||||
AssetCreationContext& m_context;
|
AssetCreationContext& m_context;
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ namespace BSP
|
|||||||
{
|
{
|
||||||
SkinnedVertsLinker::SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
SkinnedVertsLinker::SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||||
: m_memory(memory),
|
: m_memory(memory),
|
||||||
m_search_path(searchPath),
|
m_search_path(searchPath),
|
||||||
m_context(context)
|
m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,5 +22,4 @@ namespace BSP
|
|||||||
auto skinnedVertsAsset = m_context.AddAsset<AssetSkinnedVerts>(assetName, skinnedVerts);
|
auto skinnedVertsAsset = m_context.AddAsset<AssetSkinnedVerts>(assetName, skinnedVerts);
|
||||||
return AssetCreationResult::Success(skinnedVertsAsset);
|
return AssetCreationResult::Success(skinnedVertsAsset);
|
||||||
}
|
}
|
||||||
}
|
} // namespace BSP
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
namespace BSP
|
namespace BSP
|
||||||
{
|
{
|
||||||
class SkinnedVertsLinker
|
class SkinnedVertsLinker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||||
AssetCreationResult linkSkinnedVerts(BSPData* bsp);
|
AssetCreationResult linkSkinnedVerts(BSPData* bsp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MemoryManager& m_memory;
|
MemoryManager& m_memory;
|
||||||
ISearchPath& m_search_path;
|
ISearchPath& m_search_path;
|
||||||
AssetCreationContext& m_context;
|
AssetCreationContext& m_context;
|
||||||
};
|
};
|
||||||
}
|
} // namespace BSP
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "LoaderBSP_T6.h"
|
|
||||||
#include "BSPCreator.h"
|
#include "BSPCreator.h"
|
||||||
#include "BSPUtil.h"
|
#include "BSPUtil.h"
|
||||||
#include "Linker/BSPLinker.h"
|
#include "Linker/BSPLinker.h"
|
||||||
|
#include "LoaderBSP_T6.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user