#include "xcbrushside.h"

XCBrushSide::XCBrushSide()
    : XAsset()
    , mPlane()
    , mMaterialNum(0)
    , mFirstAdjacentSideOffset(0)
    , mEdgeCount(0)
{
    SetName("C Brush Side");
}

XCBrushSide::~XCBrushSide()
{
    
}

void XCBrushSide::ParseData(XDataStream *aStream)
{
    mPlane.ParsePtr(aStream, false);

    mMaterialNum = aStream->ParseUInt32(QString("%1 material number").arg(GetName()));
    mFirstAdjacentSideOffset = aStream->ParseInt16(QString("%1 first adjacent side offset").arg(GetName()));
    mEdgeCount = aStream->ParseUInt8(QString("%1 edge count").arg(GetName()));

    aStream->skipRawData(1);

    if (mPlane.GetPtr() == -1)
    {
        mPlane.ParseData(aStream);
    }
}

void XCBrushSide::Clear()
{
    mPlane.Clear();
    mMaterialNum = 0;
    mFirstAdjacentSideOffset = 0;
    mEdgeCount = 0;
}
