#include "xmaterialconstantdef.h"

XMaterialConstantDef::XMaterialConstantDef()
    : XAsset()
    , mNameHash(0)
    , mName()
    , mLiteral()
{
    
}

XMaterialConstantDef::~XMaterialConstantDef()
{
    
}

void XMaterialConstantDef::ParseData(QDataStream *aStream)
{
    if (GetPtr() == -1)
    {
        *aStream >> mNameHash;

        QByteArray rawName(12, Qt::Uninitialized);
        aStream->readRawData(rawName.data(), 12);

        mName.SetString(QString::fromUtf8(rawName));

        *aStream
            >> mLiteral[0]
            >> mLiteral[1]
            >> mLiteral[2]
            >> mLiteral[3];
    }
}

void XMaterialConstantDef::Clear()
{
    mNameHash = 0;
    mName.Clear();
    mLiteral.clear();
}
