#ifndef XCLIPMAP_H
#define XCLIPMAP_H

#include "xasset.h"
#include "xcleaf.h"
#include "xcleafbrushnode.h"
#include "xcnode.h"
#include "xcbrush.h"
#include "xcmodel.h"
#include "xcollisionaabbtree.h"
#include "xcollisionborder.h"
#include "xcollisionpartition.h"
#include "xcplane.h"
#include "xcstaticmodel.h"
#include "xdmaterial.h"
#include "xdynentityclient.h"
#include "xdynentitydef.h"
#include "xdynentitypose.h"
#include "xdynentitycoll.h"
#include "xmapents.h"

class XClipMap : public XAsset
{
public:
    explicit XClipMap();
    ~XClipMap() = default;

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

private:
    XString mName;

    quint32 mIsInUse;

    qint32 mPlaneCount;
    QVector<XCPlane> mPlanes;

    quint32 mNumStaticModels;
    QVector<XCStaticModel> mStaticModelList;

    quint32 mNumMaterials;
    QVector<XDMaterial> mMaterials;

    quint32 mNumBrushSides;
    QVector<XCBrushSide> mBrushsides;

    quint32 mNumBrushEdges;
    QVector<quint8> mBrushEdges;

    quint32 mNumNodes;
    QVector<XCNode> mNodes;

    quint32 mNumLeafs;
    QVector<XCLeaf> mLeafs;

    quint32 mLeafBrushNodesCount;
    QVector<XCLeafBrushNode> mLeafBrushNodes;

    quint32 mNumLeafBrushes;
    QVector<quint32> mLeafBrushes;

    quint32 mNumLeafSurfaces;
    QVector<quint32> mLeafSurfaces;

    quint32 mVertCount;
    QVector<QVector3D> mVerts;

    qint32 mTriCount;
    QVector<quint32> mTriIndices;
    QByteArray mTriEdgeIsWalkable;

    qint32 mBorderCount;
    QVector<XCollisionBorder> mBorders;

    qint32 mPartitionCount;
    QVector<XCollisionPartition> mPartitions;

    qint32 mAabbTreeCount;
    QVector<XCollisionAabbTree> mAabbTrees;

    quint32 mNumSubModels;
    QVector<XCModel> mCModels;

    quint32 mNumBrushes;
    QVector<XCBrush> mBrushes;

    int mNumClusters;
    int mClusterBytes;

    qint32 mVisibilityPtr;
    QByteArray mVisibility;
    int mVised;
    XMapEnts mMapEnts;
    XCBrush mBoxBrush;
    XCModel mBoxModel;
    QVector<quint32> mDynEntCounts;
    QVector<XDynEntityDef> mDynEntDefList;
    QVector<XDynEntityPose> mDynEntPoseList;
    QVector<XDynEntityClient> mDynEntClientList;
    QVector<XDynEntityColl> mDynEntCollList;
    quint32 mChecksum;
};

#endif // XCLIPMAP_H






