mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-22 21:02:07 +00:00
chore: misc code improvements
This commit is contained in:
@@ -88,6 +88,7 @@ namespace BSP
|
||||
max.y = yMax;
|
||||
max.z = zMax;
|
||||
level = treeLevel;
|
||||
|
||||
splitTree();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace BSP
|
||||
{
|
||||
public:
|
||||
BSPTree(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int treeLevel);
|
||||
|
||||
void splitTree();
|
||||
void addObjectToTree(std::shared_ptr<BSPObject> object) const;
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ namespace BSP
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -71,6 +72,7 @@ namespace BSP
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -91,12 +93,12 @@ namespace BSP
|
||||
const auto yRadians = angles->y * conversionValue;
|
||||
const auto zRadians = angles->z * conversionValue;
|
||||
|
||||
const auto cosX = cos(xRadians);
|
||||
const auto sinX = sin(xRadians);
|
||||
const auto cosY = cos(yRadians);
|
||||
const auto sinY = sin(yRadians);
|
||||
const auto cosZ = cos(zRadians);
|
||||
const auto sinZ = sin(zRadians);
|
||||
const auto cosX = std::cos(xRadians);
|
||||
const auto sinX = std::sin(xRadians);
|
||||
const auto cosY = std::cos(yRadians);
|
||||
const auto sinY = std::sin(yRadians);
|
||||
const auto cosZ = std::cos(zRadians);
|
||||
const auto sinZ = std::sin(zRadians);
|
||||
|
||||
axis[0].x = cosX * cosY;
|
||||
axis[0].y = cosX * sinY;
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace BSP
|
||||
BSPUtil::updateAABBWithPoint(vert, childMins, childMaxs);
|
||||
}
|
||||
|
||||
CollisionAabbTree childAABBTree;
|
||||
CollisionAabbTree childAABBTree{};
|
||||
childAABBTree.materialIndex = 0; // always use the first material
|
||||
childAABBTree.childCount = 0;
|
||||
childAABBTree.u.partitionIndex = partitionIndex;
|
||||
@@ -311,9 +311,15 @@ namespace BSP
|
||||
outParentStartIndex = parentAABBArrayIndex;
|
||||
}
|
||||
|
||||
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 = {
|
||||
{.x = 1.0f, .y = 0.0f, .z = 0.0f}
|
||||
};
|
||||
constexpr vec3_t normalY = {
|
||||
{.x = 0.0f, .y = 1.0f, .z = 0.0f}
|
||||
};
|
||||
constexpr vec3_t normalZ = {
|
||||
{.x = 0.0f, .y = 0.0f, .z = 1.0f}
|
||||
};
|
||||
|
||||
// returns the index of the node/leaf parsed by the function
|
||||
// Nodes are indexed by their index in the node array
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace BSP
|
||||
{
|
||||
// all lights that aren't the sunlight or default light need their own GfxLightDef asset
|
||||
ComWorld* comWorld = m_memory.Alloc<ComWorld>();
|
||||
|
||||
comWorld->name = m_memory.Dup(bsp.bspName.c_str());
|
||||
comWorld->isInUse = 1;
|
||||
comWorld->primaryLightCount = BSPGameConstants::BSP_DEFAULT_LIGHT_COUNT;
|
||||
@@ -25,6 +26,7 @@ namespace BSP
|
||||
ComPrimaryLight* sunLight = &comWorld->primaryLights[1];
|
||||
const vec4_t sunLightColor = BSPEditableConstants::SUNLIGHT_COLOR;
|
||||
const vec3_t sunLightDirection = BSPEditableConstants::SUNLIGHT_DIRECTION;
|
||||
|
||||
sunLight->type = GFX_LIGHT_TYPE_DIR;
|
||||
sunLight->diffuseColor.r = sunLightColor.r;
|
||||
sunLight->diffuseColor.g = sunLightColor.g;
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace BSP
|
||||
{
|
||||
public:
|
||||
ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||
|
||||
[[nodiscard]] T6::ComWorld* linkComWorld(const BSPData& bsp) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace BSP
|
||||
{
|
||||
public:
|
||||
GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||
|
||||
[[nodiscard]] T6::GameWorldMp* linkGameWorldMp(const BSPData& bsp) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace BSP
|
||||
{
|
||||
public:
|
||||
GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||
|
||||
[[nodiscard]] T6::GfxWorld* linkGfxWorld(const BSPData& bsp) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace BSP
|
||||
{
|
||||
public:
|
||||
MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||
|
||||
[[nodiscard]] T6::MapEnts* linkMapEnts(const BSPData& bsp) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace BSP
|
||||
{
|
||||
public:
|
||||
SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context);
|
||||
|
||||
[[nodiscard]] T6::SkinnedVertsDef* linkSkinnedVerts(const BSPData& bsp) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace
|
||||
consts[1] = currArgJs["u"]["const1"];
|
||||
consts[2] = currArgJs["u"]["const2"];
|
||||
consts[3] = currArgJs["u"]["const3"];
|
||||
currArg->u.literalConst = (float(*)[4])consts;
|
||||
currArg->u.literalConst = (float (*)[4])consts;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user