21 #include "hx3d/ecs/node.hpp" 27 Entity(0), _name(name), _parent(nullptr)
40 Log.
Error(
"Node: child `%s` does not exists.", name.c_str());
44 const Ptr<Node>& obj = getChild<Node>(name);
49 std::string path =
_name;
52 while (cursor !=
nullptr) {
55 if (cursor->_parent ==
nullptr) {
59 path = cursor->_name +
"/" + path;
62 cursor = cursor->_parent;
82 unsigned int totalChildren = 0;
84 totalChildren += child->getChildCount();
87 return totalChildren + _children.size();
94 if (o->_name == name) {
std::string getPath()
Get the game object full path from the root.
std::string getName()
Get the node name.
void removeChild(SceneGraph &sg, const std::string name)
Remove a child, using the SceneGraph.
Ptr< Node > _parent
Parent node.
Node(const std::string name)
Create a named Node. Should not be used directly.
std::string _name
Current name.
unsigned int getChildCount()
Get the recursive child count.
virtual void update(const float delta)
Update the node.
virtual void draw(graphics::BaseBatch &batch)
Draw the node.
void remove(const std::string path)
Remove a game object from a path.
void destroy(SceneGraph &sg)
Destroy the node.
graphics::Transform transform
Current transform.
std::vector< Ptr< Node > > _children
Children nodes.
Node management in hierarchy.
bool childNameExists(const std::string name)
Test if the object have a child.
void Error(const std::string fmt,...)
Write an error message.
static hx3d::LogImpl Log
Current log implementation.
Base element, attachable with components.
graphics::Transform getFullTransform()
Get the game object full transform.
Draw meshes and texts on screen.
std::shared_ptr< T > Ptr
Quick-typing shared ptr.