#include "xsurface.h"

XSurface::XSurface()
    : XAsset()
    , mTileMode(0)
    , mDeformed(false)
    , mVertCount(0)
    , mTriCount(0)
    , mTriIndices(0)
    , mVertInfo()
    , mVert()
    , mVertBuffer()
    , mVertListCount(0)
    , mVertList()
    , mIndexBuffer()
    , mPartBits()
{
    
}

XSurface::~XSurface()
{

}

void XSurface::ParseData(QDataStream *aStream)
{
    *aStream
        >> mTileMode
        >> mDeformed
        >> mVertCount
        >> mTriCount;

    aStream->skipRawData(2);

    qint32 triIndicesPtr;
    *aStream
        >> triIndicesPtr;

    mVertInfo.ParsePtr(aStream, false);
    mVert.ParsePtr(aStream, false);

    qint32 vertBuffersPtr, vertListPtr;
    *aStream
        >> vertBuffersPtr
        >> mVertListCount
        >> vertListPtr;

    mIndexBuffer.ParseData(aStream);

    *aStream
        >> mPartBits[0]
        >> mPartBits[1]
        >> mPartBits[2]
        >> mPartBits[3];

    mVertInfo.ParseData(aStream);
    mVert.ParseData(aStream);

    // TODO: Fill out the rest of this
}

void XSurface::Clear()
{
    
}
