#include "AbstractVisualNode.h"

AbstractVisualNode::AbstractVisualNode(const Transform& transform, const std::string& name)
    : mTransform(transform),
      mName(name)
{

}

AbstractVisualNode::~AbstractVisualNode()
{

}

SceneItem* AbstractVisualNode::getSceneItem(std::size_t idx) const
{
    if (idx < mSceneItems.size())
    {
        return mSceneItems[idx].get();
    }
    else
    {
        return nullptr;
    }
}

std::size_t AbstractVisualNode::getNumSceneItems() const
{
    return mSceneItems.size();
}

void AbstractVisualNode::update(SceneInfo*)
{

}

void AbstractVisualNode::syncChildren(const std::vector<AbstractVisualNode*>& children)
{
    mChildren = children;
}

void AbstractVisualNode::addChild(AbstractVisualNode* child)
{
    mChildren.push_back(child);
}

const std::vector<AbstractVisualNode*>& AbstractVisualNode::getChildren() const
{
    return mChildren;
}

void AbstractVisualNode::setIsVisible(bool isVisible)
{
    mIsVisible = isVisible;
}

void AbstractVisualNode::setName(const std::string& name)
{
    mName = name;
}

const std::string& AbstractVisualNode::getName() const
{
    return mName;
}

bool AbstractVisualNode::getIsVisible() const
{
    return mIsVisible;
}

const Transform& AbstractVisualNode::getTransform() const
{
    return mTransform;
}

void AbstractVisualNode::setTransform(const Transform& transform)
{
    if (mTransform != transform)
    {
        mTransformIsDirty = true;
        mTransform = transform;
    }
}
