#include "xdobjanimmat.h"

XDObjAnimMat::XDObjAnimMat()
    : XAsset()
    , mQuat(4)
    , mTrans(3)
    , mTransWeight(0)
{
    SetName("Object Animation Map");
}

XDObjAnimMat::~XDObjAnimMat()
{
    
}

void XDObjAnimMat::ParseData(XDataStream *aStream)
{
    if (GetPtr() == -1)
    {
        for (int i = 0; i < 4; i++)
        {
            quint32 rawQuat;
            *aStream >> rawQuat;
            memcpy(&mQuat[i], &rawQuat, sizeof(mQuat[i]));
        }

        for (int i = 0; i < 3; i++)
        {
            quint32 rawTrans;
            *aStream >> rawTrans;
            memcpy(&mTrans[i], &rawTrans, sizeof(mTrans[i]));
        }

        quint32 rawTransWeight;
        *aStream >> rawTransWeight;
        memcpy(&mTransWeight, &rawTransWeight, sizeof(mTransWeight));
    }
}

void XDObjAnimMat::Clear()
{
    mQuat.clear();
    mTrans.clear();
    mTransWeight = 0;
}
