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

chore: do not use using namespace in headers

This commit is contained in:
Jan Laupetin
2025-11-06 19:08:07 +01:00
parent c3d9f91a2a
commit c4152ff039
19 changed files with 78 additions and 65 deletions

View File

@@ -7,7 +7,6 @@
#include <memory>
#include <string>
#include <vector>
using namespace T6;
namespace BSP
{
@@ -20,11 +19,11 @@ namespace BSP
struct BSPVertex
{
vec3_t pos;
vec4_t color;
vec2_t texCoord;
vec3_t normal;
vec3_t tangent;
T6::vec3_t pos;
T6::vec4_t color;
T6::vec2_t texCoord;
T6::vec3_t normal;
T6::vec3_t tangent;
};
struct BSPMaterial
@@ -153,7 +152,7 @@ namespace BSP
// Default xmodel values
// Unused as there is no support for xmodels right now
constexpr float DEFAULT_SMODEL_CULL_DIST = 10000.0f;
constexpr int DEFAULT_SMODEL_FLAGS = STATIC_MODEL_FLAG_NO_SHADOW;
constexpr int DEFAULT_SMODEL_FLAGS = T6::STATIC_MODEL_FLAG_NO_SHADOW;
constexpr int DEFAULT_SMODEL_LIGHT = 1;
constexpr int DEFAULT_SMODEL_REFLECTION_PROBE = 0;
@@ -161,7 +160,7 @@ namespace BSP
constexpr int DEFAULT_SURFACE_LIGHT = BSPGameConstants::SUN_LIGHT_INDEX;
constexpr int DEFAULT_SURFACE_LIGHTMAP = 0;
constexpr int DEFAULT_SURFACE_REFLECTION_PROBE = 0;
constexpr int DEFAULT_SURFACE_FLAGS = (GFX_SURFACE_CASTS_SUN_SHADOW | GFX_SURFACE_CASTS_SHADOW);
constexpr int DEFAULT_SURFACE_FLAGS = (T6::GFX_SURFACE_CASTS_SUN_SHADOW | T6::GFX_SURFACE_CASTS_SHADOW);
// material flags determine the features of a surface
// unsure which flag type changes what right now
@@ -180,7 +179,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};
constexpr T6::vec4_t SUNLIGHT_COLOR = {0.75f, 0.75f, 0.75f, 1.0f};
constexpr T6::vec3_t SUNLIGHT_DIRECTION = {0.0f, 0.0f, 0.0f};
}; // namespace BSPEditableConstants
} // namespace BSP

View File

@@ -21,8 +21,8 @@ namespace BSP
class BSPObject
{
public:
vec3_t min;
vec3_t max;
T6::vec3_t min;
T6::vec3_t max;
int partitionIndex; // index of the partition the object is contained in
BSPObject(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int objPartitionIndex);
@@ -61,8 +61,8 @@ namespace BSP
std::unique_ptr<BSPNode> node;
int level; // level in the BSP tree
vec3_t min;
vec3_t max;
T6::vec3_t min;
T6::vec3_t max;
BSPTree(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int treeLevel);
void splitTree();

View File

@@ -91,7 +91,7 @@ namespace
uint32_t index = tempIndices[idxOfIndex];
ufbx_vec3 transformedPos = ufbx_transform_position(&meshMatrix, ufbx_get_vertex_vec3(&mesh->vertex_position, index));
vec3_t blenderCoords;
T6::vec3_t blenderCoords;
blenderCoords.x = static_cast<float>(transformedPos.x);
blenderCoords.y = static_cast<float>(transformedPos.y);
blenderCoords.z = static_cast<float>(transformedPos.z);

View File

@@ -3,6 +3,8 @@
#include <cmath>
#include <format>
using namespace T6;
namespace BSP
{
std::string BSPUtil::getFileNameForBSPAsset(std::string& assetName)

View File

@@ -8,16 +8,16 @@ 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 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);
static T6::vec3_t convertToBO2Coords(T6::vec3_t& OGL_coordinate);
static T6::vec3_t convertFromBO2Coords(T6::vec3_t& bo2_coordinate);
static void updateAABB(T6::vec3_t& newAABBMins, T6::vec3_t& newAABBMaxs, T6::vec3_t& AABBMins, T6::vec3_t& AABBMaxs);
static void updateAABBWithPoint(T6::vec3_t& point, T6::vec3_t& AABBMins, T6::vec3_t& AABBMaxs);
static T6::vec3_t calcMiddleOfAABB(T6::vec3_t& mins, T6::vec3_t& maxs);
static T6::vec3_t calcHalfSizeOfAABB(T6::vec3_t& mins, T6::vec3_t& maxs);
static float distBetweenPoints(T6::vec3_t& p1, T6::vec3_t& p2);
static void convertAnglesToAxis(T6::vec3_t* angles, T6::vec3_t* axis);
static void matrixTranspose3x3(const T6::vec3_t* in, T6::vec3_t* out);
static T6::vec3_t convertStringToVec3(std::string& str);
static std::string convertVec3ToString(T6::vec3_t& vec);
};
} // namespace BSP

View File

@@ -7,6 +7,8 @@
#include "MapEntsLinker.h"
#include "SkinnedVertsLinker.h"
using namespace T6;
namespace BSP
{
FootstepTableDef* BSPLinker::addEmptyFootstepTableAsset(std::string assetName)

View File

@@ -14,7 +14,7 @@ namespace BSP
bool linkBSP(BSPData* bsp);
private:
FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName);
T6::FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName);
bool addDefaultRequiredAssets(BSPData* bsp);
MemoryManager& m_memory;

View File

@@ -2,6 +2,8 @@
#include "../BSPUtil.h"
using namespace T6;
namespace BSP
{
ClipMapLinker::ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)

View File

@@ -12,29 +12,29 @@ namespace BSP
{
public:
ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
clipMap_t* linkClipMap(BSPData* bsp);
T6::clipMap_t* linkClipMap(BSPData* bsp);
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(T6::clipMap_t* clipMap);
void loadVisibility(T6::clipMap_t* clipMap);
void loadDynEnts(T6::clipMap_t* clipMap);
void loadRopesAndConstraints(T6::clipMap_t* clipMap);
void loadSubModelCollision(T6::clipMap_t* clipMap, BSPData* bsp);
void loadXModelCollision(T6::clipMap_t* clipMap);
std::vector<cplane_s> planeVec;
std::vector<cNode_t> nodeVec;
std::vector<cLeaf_s> leafVec;
std::vector<CollisionAabbTree> AABBTreeVec;
std::vector<T6::cplane_s> planeVec;
std::vector<T6::cNode_t> nodeVec;
std::vector<T6::cLeaf_s> leafVec;
std::vector<T6::CollisionAabbTree> AABBTreeVec;
size_t highestLeafObjectCount = 0;
void addAABBTreeFromLeaf(clipMap_t* clipMap, BSPTree* tree, size_t* out_parentCount, size_t* out_parentStartIndex);
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);
void addAABBTreeFromLeaf(T6::clipMap_t* clipMap, BSPTree* tree, size_t* out_parentCount, size_t* out_parentStartIndex);
int16_t loadBSPNode(T6::clipMap_t* clipMap, BSPTree* tree);
void loadBSPTree(T6::clipMap_t* clipMap, BSPData* bsp);
bool loadPartitions(T6::clipMap_t* clipMap, BSPData* bsp);
bool loadWorldCollision(T6::clipMap_t* clipMap, BSPData* bsp);
};
} // namespace BSP

View File

@@ -1,5 +1,7 @@
#include "ComWorldLinker.h"
using namespace T6;
namespace BSP
{
ComWorldLinker::ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)

View File

@@ -11,7 +11,7 @@ namespace BSP
{
public:
ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
ComWorld* linkComWorld(BSPData* bsp);
T6::ComWorld* linkComWorld(BSPData* bsp);
private:
MemoryManager& m_memory;

View File

@@ -1,5 +1,7 @@
#include "GameWorldMpLinker.h"
using namespace T6;
namespace BSP
{
GameWorldMpLinker::GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)

View File

@@ -11,7 +11,7 @@ namespace BSP
{
public:
GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
GameWorldMp* linkGameWorldMp(BSPData* bsp);
T6::GameWorldMp* linkGameWorldMp(BSPData* bsp);
private:
MemoryManager& m_memory;

View File

@@ -4,6 +4,8 @@
#include "Utils/Alignment.h"
#include "Utils/Pack.h"
using namespace T6;
namespace BSP
{
GfxWorldLinker::GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)

View File

@@ -11,27 +11,27 @@ namespace BSP
{
public:
GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
GfxWorld* linkGfxWorld(BSPData* bsp);
T6::GfxWorld* linkGfxWorld(BSPData* bsp);
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);
void loadDrawData(BSPData* projInfo, T6::GfxWorld* gfxWorld);
bool loadMapSurfaces(BSPData* projInfo, T6::GfxWorld* gfxWorld);
void loadXModels(BSPData* projInfo, T6::GfxWorld* gfxWorld);
void cleanGfxWorld(T6::GfxWorld* gfxWorld);
void loadGfxLights(T6::GfxWorld* gfxWorld);
void loadLightGrid(T6::GfxWorld* gfxWorld);
void loadGfxCells(T6::GfxWorld* gfxWorld);
void loadModels(T6::GfxWorld* gfxWorld);
bool loadReflectionProbeData(T6::GfxWorld* gfxWorld);
bool loadLightmapData(T6::GfxWorld* gfxWorld);
void loadSkyBox(BSPData* projInfo, T6::GfxWorld* gfxWorld);
void loadDynEntData(T6::GfxWorld* gfxWorld);
bool loadOutdoors(T6::GfxWorld* gfxWorld);
void loadSunData(T6::GfxWorld* gfxWorld);
void loadWorldBounds(T6::GfxWorld* gfxWorld);
};
} // namespace BSP

View File

@@ -3,7 +3,9 @@
#include "../BSPUtil.h"
#include <nlohmann/json.hpp>
using namespace nlohmann;
using namespace T6;
namespace
{

View File

@@ -11,7 +11,7 @@ namespace BSP
{
public:
MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
MapEnts* linkMapEnts(BSPData* bsp);
T6::MapEnts* linkMapEnts(BSPData* bsp);
private:
MemoryManager& m_memory;

View File

@@ -9,11 +9,11 @@ namespace BSP
{
}
SkinnedVertsDef* SkinnedVertsLinker::linkSkinnedVerts(BSPData* bsp)
T6::SkinnedVertsDef* SkinnedVertsLinker::linkSkinnedVerts(BSPData* bsp)
{
// 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
SkinnedVertsDef* skinnedVerts = m_memory.Alloc<SkinnedVertsDef>();
T6::SkinnedVertsDef* skinnedVerts = m_memory.Alloc<T6::SkinnedVertsDef>();
skinnedVerts->name = m_memory.Dup("skinnedverts");
skinnedVerts->maxSkinnedVerts = static_cast<unsigned int>(bsp->gfxWorld.vertices.size());

View File

@@ -11,7 +11,7 @@ namespace BSP
{
public:
SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
SkinnedVertsDef* linkSkinnedVerts(BSPData* bsp);
T6::SkinnedVertsDef* linkSkinnedVerts(BSPData* bsp);
private:
MemoryManager& m_memory;