13#include "../util/non_copyable.h"
14#include "component/node.h"
24 using NodeType = uint64_t;
25 const NodeType NodeTypeALL = 0;
36 inline const Node* getParentNode()
const noexcept
41 inline Node* getParentNode()
noexcept
46 inline Manager* getSceneManager()
51 void addChild(
Node& child);
53 inline const std::vector<oe::scene::Node*>& getChildren()
noexcept
58 inline const std::vector<oe::scene::Node*>& getChildren()
const noexcept
80 void foreachChildren(
void (*func)(
Node&,
void*), const
bool recursion = false,
void* user_data =
nullptr);
91 const std::
string getAbsoluteName(const std::
string& separator = "/") const noexcept;
99 template <typename T =
Node>
100 T*
search(const std::
string path, const std::
string separator = "/")
102 Node* rawresult = _internalSearch(path, separator);
104 return dynamic_cast<T*
>(rawresult);
107 inline bool isVisible()
const
112 void setVisible(
const bool& is_visible =
true)
114 _is_visible = is_visible;
117 bool canRender(
const scene::Camera& camera)
const;
178 void lookAt(
const glm::vec3& target,
const glm::vec3& up = glm::vec3(0.f, 1.f, 0.f));
190 virtual void update(
const double& delta,
const int8_t flags = 0);
210 bool _is_visible =
true;
213 Node* _parent_node =
nullptr;
215 std::vector<oe::scene::Node*> _children;
217 void _remove_child(
Node&)
noexcept;
219 mutable glm::mat4 _model_matrix;
221 mutable glm::mat4 _absolute_model_matrix;
223 Node* _internalSearch(
const std::string& path,
const std::string& separator)
noexcept;
225 Node* _internalSearch(
226 const std::vector<std::string>::iterator& begin,
227 const std::vector<std::string>::iterator& end
233 bool _has_dirty_parents()
const;
235 Node* _fetch_dirty_parent()
const;
Util class to add components handling to an entity.
Definition component.h:311
Axis-aligned bounding box.
Definition aabb.h:13
Scene manager.
Definition manager.h:21
virtual void update(const double &delta, const int8_t flags=0)
Update the node.
std::string name
Name, used as identifier for search.
Definition node.h:200
void setParent(Node &parent) noexcept
Change the parent of this node.
const AABB getEnglobingBoundingBox() const
Compute englobing bounding box including all children ones.
T * search(const std::string path, const std::string separator="/")
Search for a node among children using a name path.
Definition node.h:100
void moveToRoot() noexcept
Detach the node from parent to make a root node.
void foreachChildren(void(*func)(Node &, void *), const bool recursion=false, void *user_data=nullptr)
Do actions on children.
Transform getAbsoluteTransform() const
Get Node transform relative from world origin.
void lookAt(const glm::vec3 &target, const glm::vec3 &up=glm::vec3(0.f, 1.f, 0.f))
Orient the node to stare at a specified target.
const glm::mat4 & getAbsoluteModelMatrix() const
Get absolute model matrix (by taking the parents into account)
void generateModel(const bool recursive=true) const
Force regeneration of Models Matrices.
glm::quat getRotationNeededToLookAt(const glm::vec3 &target, const glm::vec3 &up=glm::vec3(0.f, 1.f, 0.f)) const
Get the rotation needed to orient the node at a specified target.
glm::vec3 getAbsolutePosition() const
Get Node position from world origin.
AABB raw_aabb
Raw bounding box (ie. without taking node transform)
Definition node.h:203
const AABB & getBoundingBox() const
Recompute and return bounding box from raw AABB.
const glm::mat4 getAbsoluteInverseModelMatrix() const
Get absolute inverse model matrix (by taking the parents into account)
const std::string getAbsoluteName(const std::string &separator="/") const noexcept
Get absolute name (from the hierarchy)
std::vector< Node * > getAllParents() const
Get all node parents hierarchy of the node.
Prevent class to be copied.
Definition non_copyable.h:12
Scene related management (Render-agnostic Geometry, Manger, etc...)
Definition debug.h:19