#ifndef BLUECORE_SCENE_NODE_H
#define BLUECORE_SCENE_NODE_H

#include "Camera.h"
#include "RenderDevice.h"

#include "Utilities/Referenced.h"
#include "Utilities/Named.h"
#include "Utilities/Log.h"
#include "Utilities/Activated.h"
#include "Math/Transformation.h"

#include <iostream>
#include <list>

namespace BlueCore
{

class SceneNode : public Referenced, public Named, public Activated
{

  public:

    typedef std::list< ref_ptr<SceneNode> > SceneNodeList;

  protected:

    SceneNode *_Parent;
    SceneNodeList _Children;
    Transformation _RelativeTransformation;
    Transformation _AbsoluteTransformation;

  public:

    SceneNode();
    SceneNode(const std::string &name);
    virtual ~SceneNode();

    SceneNode *getParent() const;
    const SceneNodeList &getChildren() const;

    void attach(SceneNode *node);
    void detach(SceneNode *node);
    void detachAll();
    void detachFromParent();

    virtual void update(Scalar time);
    virtual void render (RenderDevice *device, Camera *camera);

    const Transformation& getRelativeTransformation();
    const Transformation& getAbsoluteTransformation();

    void setRelativeTranslation (const Vector3 &translation);
    void setRelativeRotation (const Quaternion &rotation);

    virtual void updateAbsoluteTransformation();
};

} // namespace BlueCore

#endif
