#include "xgfxworldvertex.h"

XGfxWorldVertex::XGfxWorldVertex()
    : XAsset()
    , mXYZ()
    , mBinormalSign(0.0f)
    , mColor()
    , mTexCoord()
    , mLmapCoord()
    , mNormal()
    , mTangent()
{
}

XGfxWorldVertex::~XGfxWorldVertex()
{

}

void XGfxWorldVertex::ParseData(QDataStream *aStream) {
    if (GetPtr() == -1) {
        *aStream
            >> mXYZ[0]
            >> mXYZ[1]
            >> mXYZ[2]
            >> mBinormalSign;

        // Read color components
        quint8 r, g, b, a;
        *aStream
            >> r
            >> g
            >> b
            >> a;
        mColor.SetColor(r, g, b, a);

        // Read texture coordinates
        *aStream
            >> mTexCoord[0]
            >> mTexCoord[1]
            >> mLmapCoord[0]
            >> mLmapCoord[1];

        // Read normal and tangent (assuming they're PackedUnitVec)
        mNormal.ParseData(aStream);
        mTangent.ParseData(aStream);
    }
}

void XGfxWorldVertex::Clear()
{

}
