#ifndef EFFECTDEF_H
#define EFFECTDEF_H

#include "xmaterial.h"
#include "xmodel.h"

class XFxSpawnDefLooping : public XAsset
{
public:
    explicit XFxSpawnDefLooping();
    ~XFxSpawnDefLooping();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    int mIntervalMsec;
    int mCount;
};

class XFxIntRange : public XAsset
{
public:
    explicit XFxIntRange();
    ~XFxIntRange();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    int mBase;
    int mAmplitude;
};

class XFxSpawnDefOneShot : public XAsset
{
public:
    explicit XFxSpawnDefOneShot();
    ~XFxSpawnDefOneShot();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    XFxIntRange mCount;
};

class XFxSpawnDef : public XAsset
{
public:
    explicit XFxSpawnDef();
    ~XFxSpawnDef();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    XFxSpawnDefLooping mLooping;
    XFxSpawnDefOneShot omOneShot;
};

class XFxFloatRange : public XAsset
{
public:
    explicit XFxFloatRange();
    ~XFxFloatRange();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    float base;
    float amplitude;
};

class XFxElemAtlas : public XAsset
{
public:
    explicit XFxElemAtlas();
    ~XFxElemAtlas();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    quint8 mBehavior;
    quint8 mIndex;
    quint8 mFps;
    quint8 mLoopCount;
    quint8 mColIndexBits;
    quint8 mRowIndexBits;
    qint16 mEntryCount;
};

class XFxElemVec3Range : public XAsset
{
public:
    explicit XFxElemVec3Range();
    ~XFxElemVec3Range();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    QVector3D mBase;
    QVector3D mAmplitude;
};

class XFxElemVelStateInFrame : public XAsset
{
public:
    explicit XFxElemVelStateInFrame();
    ~XFxElemVelStateInFrame();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    XFxElemVec3Range mVelocity;
    XFxElemVec3Range mTotalDelta;
};

class XFxElemVelStateSample : public XAsset
{
public:
    explicit XFxElemVelStateSample();
    ~XFxElemVelStateSample();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    XFxElemVelStateInFrame mLocal;
    XFxElemVelStateInFrame mWorld;
};

class XFxElemVisualState : public XAsset
{
public:
    explicit XFxElemVisualState();
    ~XFxElemVisualState();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    quint8 mColor[4];
    float mRotationDelta;
    float mRotationTotal;
    float mSize[2];
    float mScale;
};

class XFxElemVisStateSample : public XAsset
{
public:
    explicit XFxElemVisStateSample();
    ~XFxElemVisStateSample();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    XFxElemVisualState mBase;
    XFxElemVisualState mAmplitude;
};

class XFxElemMarkVisuals : public XAsset
{
public:
    explicit XFxElemMarkVisuals();
    ~XFxElemMarkVisuals();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    qint32 mMaterialPtrs[2];
    QVector<XMaterial> mMaterials;
};

class XEffectDefRef : public XAsset
{
public:
    explicit XEffectDefRef();
    ~XEffectDefRef();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    qint32 mHandlePtr;
    const XEffectDef *mHandle;

    qint32 mNamePtr;
    QString mName;
};







class XEffectDef : public XAsset
{
public:
    explicit XEffectDef();
    ~XEffectDef();

    void Clear() override;
    void ParseData(QDataStream *aStream) override;

private:
    qint32 mNamePtr;
    QString mName;

    int mFlags;
    int mTotalSize;
    int mMsecLoopingLife;
    int mElemDefCountLooping;
    int mElemDefCountOneShot;
    int mElemDefCountEmission;

    qint32 mElemDefsPtr;
    QVector<XFxElemDef> mElemDefs;
};

#endif // EFFECTDEF_H
