XPlor/libs/xassets/xgfxdrawsurffields.cpp
2025-09-07 23:11:53 -04:00

48 lines
1.4 KiB
C++

#include "xgfxdrawsurffields.h"
XGfxDrawSurfFields::XGfxDrawSurfFields()
: XAsset()
, mObjectId(0)
, mReflectionProbeIndex(0)
, mCustomIndex(0)
, mMaterialSortedIndex(0)
, mPrepass(0)
, mPrimaryLightIndex(0)
, mSurfType(0)
, mPrimarySortKey(0)
, mUnused(0)
{
}
void XGfxDrawSurfFields::ParseData(QDataStream *aStream)
{
// Read the raw 64-bit value from the stream
quint64 raw = 0;
*aStream >> raw;
// Decode bitfields from the 64-bit packed value
mObjectId = raw & 0xFFFF; // bits 0-15
mReflectionProbeIndex = (raw >> 16) & 0xFF; // bits 16-23
mCustomIndex = (raw >> 24) & 0x1F; // bits 24-28
mMaterialSortedIndex = (raw >> 29) & 0x7FF; // bits 29-39
mPrepass = (raw >> 40) & 0x3; // bits 40-41
mPrimaryLightIndex = (raw >> 42) & 0xFF; // bits 42-49
mSurfType = (raw >> 50) & 0xF; // bits 50-53
mPrimarySortKey = (raw >> 54) & 0x3F; // bits 54-59
mUnused = (raw >> 60) & 0xF; // bits 60-63
}
void XGfxDrawSurfFields::Clear()
{
mObjectId = 0;
mReflectionProbeIndex = 0;
mCustomIndex = 0;
mMaterialSortedIndex = 0;
mPrepass = 0;
mPrimaryLightIndex = 0;
mSurfType = 0;
mPrimarySortKey = 0;
mUnused = 0;
}