#include "xmaterialinfo.h"

XMaterialInfo::XMaterialInfo()
    : XAsset()
    , mName()
    , mGameFlags(0)
    , mSortKey(0)
    , mTextureAtlasRowCount(0)
    , mTextureAtlasColumnCount(0)
    , mDrawSurf()
    , mSurfaceTypeBits(0)
{
    SetName("Material Info");
}

XMaterialInfo::~XMaterialInfo()
{

}

void XMaterialInfo::ParseData(XDataStream *aStream)
{
    mName.ParsePtr(aStream, false);


    *aStream >> mGameFlags;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mGameFlags = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mGameFlags);
    }

    *aStream >> mSortKey;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mSortKey = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mSortKey);
    }

    *aStream >> mTextureAtlasRowCount;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mTextureAtlasRowCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mTextureAtlasRowCount);
    }

    *aStream >> mTextureAtlasColumnCount;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mTextureAtlasColumnCount = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mTextureAtlasColumnCount);
    }

    mDrawSurf.ParseData(aStream);

    *aStream >> mSurfaceTypeBits;
    if (IsDebug())
    {
        qDebug() << QString("[%1] mSurfaceTypeBits = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mSurfaceTypeBits);
    }

    aStream->skipRawData(4);

    mName.ParseData(aStream);
}

void XMaterialInfo::Clear()
{

}
