XPlor/libs/xassets/xgfxworldstreaminfo.cpp
2025-08-17 13:14:17 -04:00

78 lines
1.7 KiB
C++

#include "xgfxworldstreaminfo.h"
XGfxWorldStreamInfo::XGfxWorldStreamInfo()
: XAsset() {
}
void XGfxWorldStreamInfo::ParseData(QDataStream *aStream) {
if (GetPtr() == -1) {
aStream->read((char*)&mAabbTreeCount, sizeof(int));
// 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->read((char*)&mLeafRefCount, sizeof(int));
if (mLeafRefCount > 0) {
mLeafRefs.resize(mLeafRefCount);
aStream->read((char*)mLeafRefs.data(), mLeafRefCount * sizeof(int));
}
}
}
int XGfxWorldStreamInfo::GetAabbTreeCount() const {
return mAabbTreeCount;
}
void XGfxWorldStreamInfo::SetAabbTreeCount(int count) {
mAabbTreeCount = count;
}
QVector<XGfxStreamingAabbTree>& XGfxWorldStreamInfo::GetAabbTrees() {
return mAabbTrees;
}
const QVector<XGfxStreamingAabbTree>& XGfxWorldStreamInfo::GetAabbTrees() const {
return mAabbTrees;
}
void XGfxWorldStreamInfo::SetAabbTrees(const QVector<XGfxStreamingAabbTree>& trees) {
mAabbTrees = trees;
}
int XGfxWorldStreamInfo::GetLeafRefCount() const {
return mLeafRefCount;
}
void XGfxWorldStreamInfo::SetLeafRefCount(int count) {
mLeafRefCount = count;
}
QVector<int>& XGfxWorldStreamInfo::GetLeafRefs() {
return mLeafRefs;
}
const QVector<int>& XGfxWorldStreamInfo::GetLeafRefs() const {
return mLeafRefs;
}
void XGfxWorldStreamInfo::SetLeafRefs(const QVector<int>& refs) {
mLeafRefs = refs;
}