XPlor/libs/xassets/xgfxworldstreaminfo.cpp
2025-09-10 21:58:26 -04:00

49 lines
1.0 KiB
C++

#include "xgfxworldstreaminfo.h"
XGfxWorldStreamInfo::XGfxWorldStreamInfo()
: XAsset()
, mAabbTreeCount(0)
, mAabbTrees()
, mLeafRefCount(0)
, mLeafRefs()
{
SetName("GFX World Stream Info");
}
XGfxWorldStreamInfo::~XGfxWorldStreamInfo()
{
}
void XGfxWorldStreamInfo::ParseData(XDataStream *aStream) {
if (GetPtr() == -1) {
*aStream >> mAabbTreeCount;
// Clear existing data before parsing new data
mAabbTrees.clear();
// Parse AABB trees
for (int i = 0; i < mAabbTreeCount; ++i) {
XGfxStreamingAabbTree tree;
tree.ParseData(aStream);
mAabbTrees.append(tree);
}
// Parse leaf ref count and array
*aStream >> mLeafRefCount;
if (mLeafRefCount > 0) {
int leafRef;
*aStream >> leafRef;
mLeafRefs.append(leafRef);
}
}
}
void XGfxWorldStreamInfo::Clear()
{
mAabbTreeCount = 0;
mAabbTrees = QVector<XGfxStreamingAabbTree>();
mLeafRefCount = 0;
mLeafRefs = QVector<int>();
}