XPlor/libs/xassets/xgfxcell.cpp

97 lines
2.0 KiB
C++
Raw Normal View History

2025-09-05 21:32:39 +00:00
#include "xgfxcell.h"
XGfxCell::XGfxCell()
: XAsset()
, mMins()
, mMaxs()
, mAabbTreeCount(0)
, mAabbTree()
, mPortalCount(0)
, mPortals()
, mCullGroupCount(0)
, mCullGroups()
, mReflectionProbeCount(0)
, mReflectionProbes()
{
}
XGfxCell::~XGfxCell()
{
}
void XGfxCell::ParseData(QDataStream *aStream)
{
2025-09-07 23:15:57 -04:00
qint32 aabbTreePtr, portalsPtr, cullGroupsPtr, reflectionProbesPtr;
*aStream
>> mMins[0]
>> mMins[1]
>> mMins[2]
>> mMaxs[0]
>> mMaxs[1]
>> mMaxs[2]
>> mAabbTreeCount
>> aabbTreePtr
>> mPortalCount
>> portalsPtr
>> mCullGroupCount
>> cullGroupsPtr
>> mReflectionProbeCount
>> reflectionProbesPtr;
2025-09-05 21:32:39 +00:00
2025-09-07 23:15:57 -04:00
if (aabbTreePtr)
{
for (int i = 0; i < mAabbTreeCount; i++)
{
XGfxAabbTree newTree;
newTree.ParseData(aStream);
mAabbTree.append(newTree);
}
}
if (portalsPtr)
{
for (int i = 0; i < mPortalCount; i++)
{
XGfxPortal newPortal;
newPortal.ParseData(aStream);
mPortals.append(newPortal);
}
}
if (cullGroupsPtr)
{
for (int i = 0; i < mCullGroupCount; i++)
{
qint32 newCullGroup;
*aStream >> newCullGroup;
mCullGroups.append(newCullGroup);
}
}
if (reflectionProbesPtr)
{
for (int i = 0; i < mReflectionProbeCount; i++)
{
quint8 newReflectionProbe;
*aStream >> newReflectionProbe;
mReflectionProbes.append(newReflectionProbe);
}
}
2025-09-05 21:32:39 +00:00
}
void XGfxCell::Clear()
{
mMins = QVector3D();
mMaxs = QVector3D();
mAabbTreeCount = 0;
mAabbTree.clear();
mPortalCount = 0;
mPortals.clear();
mCullGroupCount = 0;
mCullGroups.clear();
mReflectionProbeCount = 0;
mReflectionProbes.clear();
}