#include "xmodelcollsurf.h"

XModelCollSurf::XModelCollSurf()
    : XAsset()
    , mMins()
    , mMaxs()
    , mBoneIdx(0)
    , mContents(0)
    , mSurfFlags(0)
{
    SetName("Model Coll Surface");
}

XModelCollSurf::~XModelCollSurf()
{
    
}

void XModelCollSurf::ParseData(XDataStream *aStream)
{
    quint32 rawMin;
    *aStream >> rawMin;
    memcpy(&mMins[0], &rawMin, sizeof(mMins[0]));
    *aStream >> rawMin;
    memcpy(&mMins[1], &rawMin, sizeof(mMins[1]));
    *aStream >> rawMin;
    memcpy(&mMins[2], &rawMin, sizeof(mMins[2]));

    quint32 rawMax;
    *aStream >> rawMax;
    memcpy(&mMaxs[0], &rawMax, sizeof(mMaxs[0]));
    *aStream >> rawMax;
    memcpy(&mMaxs[1], &rawMax, sizeof(mMaxs[1]));
    *aStream >> rawMax;
    memcpy(&mMaxs[2], &rawMax, sizeof(mMaxs[2]));

    *aStream
        >> mBoneIdx
        >> mContents
        >> mSurfFlags;
}

void XModelCollSurf::Clear()
{
    mMins = QVector3D();
    mMaxs = QVector3D();
    mBoneIdx = 0;
    mContents = 0;
    mSurfFlags = 0;
}
