#include "xmaterialvertexdeclaration.h"

XMaterialVertexDeclaration::XMaterialVertexDeclaration()
    : XAsset()
    , mStreamCount(0)
    , mHasOptionalSource(false)
    , mRouting()
{
    SetName("Material Vertex Declaration");
}

void XMaterialVertexDeclaration::Clear()
{

}

void XMaterialVertexDeclaration::ParseData(QDataStream *aStream)
{
    if (IsDebug())
    {
        qDebug() << QString("[%1]").arg(aStream->device()->pos(), 10, 10, QChar('0')) << "Parsing data for " << XAssetTypeToString(GetType());
    }
    if (GetPtr() == -1)
    {
        *aStream
            >> mStreamCount
            >> mHasOptionalSource;
        if (IsDebug())
        {
            qDebug() << QString("[%1]").arg(aStream->device()->pos(), 10, 10, QChar('0')) << " mStreamCount = " << mStreamCount;
            qDebug() << QString("[%1]").arg(aStream->device()->pos(), 10, 10, QChar('0')) << " mHasOptionalSource = " << mHasOptionalSource;
        }

        mRouting.ParseData(aStream);
    }
}
