2016-08-10 21:54:53 +00:00
|
|
|
#ifndef _DNACOMMON_AROTBUILDER_HPP_
|
|
|
|
#define _DNACOMMON_AROTBUILDER_HPP_
|
|
|
|
|
|
|
|
#include "DNACommon.hpp"
|
2016-08-11 19:52:22 +00:00
|
|
|
#include "DeafBabe.hpp"
|
2016-08-10 21:54:53 +00:00
|
|
|
#include "zeus/CAABox.hpp"
|
|
|
|
#include "CMDL.hpp"
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
namespace DataSpec
|
|
|
|
{
|
2018-02-25 08:23:27 +00:00
|
|
|
namespace DNAMP1
|
|
|
|
{
|
|
|
|
struct PATH;
|
|
|
|
}
|
2016-08-10 21:54:53 +00:00
|
|
|
|
|
|
|
struct AROTBuilder
|
|
|
|
{
|
2017-12-29 08:08:12 +00:00
|
|
|
using ColMesh = hecl::blender::ColMesh;
|
2017-12-02 05:50:05 +00:00
|
|
|
|
2016-08-10 21:54:53 +00:00
|
|
|
struct BitmapPool
|
|
|
|
{
|
|
|
|
std::vector<std::set<int>> m_pool;
|
|
|
|
size_t addIndices(const std::set<int>& indices);
|
|
|
|
} bmpPool;
|
|
|
|
|
|
|
|
struct Node
|
|
|
|
{
|
|
|
|
std::vector<Node> childNodes;
|
|
|
|
std::set<int> childIndices;
|
|
|
|
size_t poolIdx = 0;
|
2017-12-02 05:50:05 +00:00
|
|
|
uint16_t flags = 0;
|
|
|
|
uint16_t compSubdivs = 0;
|
2016-08-10 21:54:53 +00:00
|
|
|
|
|
|
|
size_t nodeOff = 0;
|
|
|
|
size_t nodeSz = 4;
|
|
|
|
|
2017-12-02 05:50:05 +00:00
|
|
|
void addChild(int level, int minChildren, const std::vector<zeus::CAABox>& triBoxes,
|
|
|
|
const zeus::CAABox& curAABB, BspNodeType& typeOut);
|
2018-06-23 23:09:16 +00:00
|
|
|
void mergeSets(int a, int b);
|
|
|
|
bool compareSets(int a, int b) const;
|
2016-08-10 21:54:53 +00:00
|
|
|
void nodeCount(size_t& sz, size_t& idxRefs, BitmapPool& bmpPool, size_t& curOff);
|
|
|
|
void writeIndirectionTable(athena::io::MemoryWriter& w);
|
|
|
|
void writeNodes(athena::io::MemoryWriter& w, int nodeIdx);
|
|
|
|
void advanceIndex(int& nodeIdx);
|
2016-08-11 19:52:22 +00:00
|
|
|
|
|
|
|
void colSize(size_t& totalSz);
|
|
|
|
void writeColNodes(uint8_t*& ptr, const zeus::CAABox& curAABB);
|
2018-02-25 08:23:27 +00:00
|
|
|
|
|
|
|
void pathCountNodesAndLookups(size_t& nodeCount, size_t& lookupCount);
|
|
|
|
void pathWrite(DNAMP1::PATH& path, const zeus::CAABox& curAABB);
|
2016-08-10 21:54:53 +00:00
|
|
|
} rootNode;
|
|
|
|
|
|
|
|
void build(std::vector<std::vector<uint8_t>>& secs, const zeus::CAABox& fullAabb,
|
|
|
|
const std::vector<zeus::CAABox>& meshAabbs, const std::vector<DNACMDL::Mesh>& meshes);
|
2016-08-11 19:52:22 +00:00
|
|
|
std::pair<std::unique_ptr<uint8_t[]>, uint32_t> buildCol(const ColMesh& mesh, BspNodeType& rootOut);
|
2018-02-25 08:23:27 +00:00
|
|
|
void buildPath(DNAMP1::PATH& path);
|
2016-08-10 21:54:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _DNACOMMON_AROTBUILDER_HPP_
|