diff --git a/src/ObjLoading/Game/T6/BSP/BSPCalculation.h b/src/ObjLoading/Game/T6/BSP/BSPCalculation.h index 0c44029b..08a5e39e 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCalculation.h +++ b/src/ObjLoading/Game/T6/BSP/BSPCalculation.h @@ -23,21 +23,21 @@ namespace BSP class BSPObject { public: + BSPObject(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int objPartitionIndex); + 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); }; class BSPLeaf { public: - std::vector> objectList; - void addObject(std::shared_ptr object); [[nodiscard]] BSPObject* getObject(size_t index) const; [[nodiscard]] size_t getObjectCount() const; + + std::vector> objectList; }; class BSPTree; @@ -45,19 +45,23 @@ namespace BSP class BSPNode { public: + BSPNode(std::unique_ptr frontTree, std::unique_ptr backTree, PlaneAxis nodeAxis, float nodeDistance); + [[nodiscard]] PlaneSide objectIsInFront(const BSPObject& object) const; + std::unique_ptr front; std::unique_ptr back; 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); - [[nodiscard]] PlaneSide objectIsInFront(const BSPObject& object) const; }; class BSPTree { public: + BSPTree(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int treeLevel); + void splitTree(); + void addObjectToTree(std::shared_ptr object) const; + bool isLeaf; std::unique_ptr leaf; std::unique_ptr node; @@ -65,9 +69,5 @@ namespace BSP int level; // level in the BSP tree 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(); - void addObjectToTree(std::shared_ptr object) const; }; } // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h index c74ad9c9..9d30166b 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h @@ -16,10 +16,6 @@ namespace BSP [[nodiscard]] T6::clipMap_t* linkClipMap(const BSPData& bsp); private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; - void loadBoxData(T6::clipMap_t& clipMap) const; void loadVisibility(T6::clipMap_t& clipMap) const; void loadDynEnts(T6::clipMap_t& clipMap) const; @@ -27,16 +23,20 @@ namespace BSP void loadSubModelCollision(T6::clipMap_t& clipMap, const BSPData& bsp) const; void loadXModelCollision(T6::clipMap_t& clipMap) const; - std::vector planeVec; - std::vector nodeVec; - std::vector leafVec; - std::vector AABBTreeVec; - size_t highestLeafObjectCount = 0; - void addAABBTreeFromLeaf(T6::clipMap_t& clipMap, const BSPTree& tree, size_t& out_parentCount, size_t& out_parentStartIndex); int16_t loadBSPNode(T6::clipMap_t& clipMap, const BSPTree& tree); void loadBSPTree(T6::clipMap_t& clipMap, const BSPData& bsp); bool loadPartitions(T6::clipMap_t& clipMap, const BSPData& bsp) const; bool loadWorldCollision(T6::clipMap_t& clipMap, const BSPData& bsp); + + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; + + std::vector planeVec; + std::vector nodeVec; + std::vector leafVec; + std::vector AABBTreeVec; + size_t highestLeafObjectCount = 0; }; } // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h index d5972301..796f6be9 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h @@ -14,10 +14,6 @@ namespace BSP [[nodiscard]] T6::GfxWorld* linkGfxWorld(const BSPData& bsp) const; private: - MemoryManager& m_memory; - ISearchPath& m_search_path; - AssetCreationContext& m_context; - void loadDrawData(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const; bool loadMapSurfaces(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const; void loadXModels(const BSPData& projInfo, T6::GfxWorld& gfxWorld) const; @@ -33,5 +29,9 @@ namespace BSP bool loadOutdoors(T6::GfxWorld& gfxWorld) const; void loadSunData(T6::GfxWorld& gfxWorld) const; void loadWorldBounds(T6::GfxWorld& gfxWorld) const; + + MemoryManager& m_memory; + ISearchPath& m_search_path; + AssetCreationContext& m_context; }; } // namespace BSP