#include "xmaterialtexturedefinfo.h"
#include "xmaterialtexturedef.h"

XMaterialTextureDefInfo::XMaterialTextureDefInfo()
    : XAsset()
    , mImage()
    , mWater()
    , aParent(nullptr)
{
    
}

XMaterialTextureDefInfo::XMaterialTextureDefInfo(XMaterialTextureDef &aParent)
    : XAsset()
    , mImage()
    , mWater()
    , aParent(&aParent)
{

}

XMaterialTextureDefInfo::~XMaterialTextureDefInfo()
{

}

void XMaterialTextureDefInfo::ParseData(QDataStream *aStream)
{
    mImage.ParsePtr(aStream, false);

    if (aParent->GetSemantic() == 11) {
        if (mImage.GetPtr() == -1)
        {
            mWater.ParseData(aStream);
        }
    }
    else
    {
        mImage.ParseData(aStream);
    }
}

void XMaterialTextureDefInfo::Clear()
{
    mImage.Clear();
    mWater.Clear();
}
