#include "xcollisionaabbtree.h"

XCollisionAabbTree::XCollisionAabbTree()
    : XAsset()
    , mOrigin()
    , mHalfSize()
    , mMaterialIndex(0)
    , mChildCount(0)
    , mTreeIndex()
{
}

XCollisionAabbTree::~XCollisionAabbTree()
{

}

void XCollisionAabbTree::ParseData(QDataStream *aStream) {
    if (GetPtr() == -1) {
        *aStream
            >> mOrigin[0]
            >> mOrigin[1]
            >> mOrigin[2]
            >> mHalfSize[0]
            >> mHalfSize[1]
            >> mHalfSize[2]
            >> mMaterialIndex
            >> mChildCount;

        // Parse union
        mTreeIndex.ParseData(aStream);
    }
}

QVector3D XCollisionAabbTree::GetOrigin() const {
    return mOrigin;
}

void XCollisionAabbTree::SetOrigin(QVector3D aOrigin) {
    mOrigin = aOrigin;
}

QVector3D XCollisionAabbTree::GetHalfSize() const {
    return mHalfSize;
}

void XCollisionAabbTree::SetHalfSize(QVector3D aHalfSize) {
    mHalfSize = aHalfSize;
}

quint32 XCollisionAabbTree::GetMaterialIndex() const {
    return mMaterialIndex;
}

void XCollisionAabbTree::SetMaterialIndex(quint32 aIndex) {
    mMaterialIndex = aIndex;
}

quint32 XCollisionAabbTree::GetChildCount() const {
    return mChildCount;
}

void XCollisionAabbTree::SetChildCount(quint32 count) {
    mChildCount = count;
}

XCollisionAabbTreeIndex& XCollisionAabbTree::GetTreeIndex() {
    return mTreeIndex;
}

void XCollisionAabbTree::SetTreeIndex(const XCollisionAabbTreeIndex& aTreeIndex) {
    mTreeIndex = aTreeIndex;
}



