7 #include "gmath/gmath.h"
19 std::vector<Object*> obj;
22 std::vector<SceneNode*> children;
27 mutable bool local_bvol_valid;
28 mutable AABox local_bvol;
31 Scene *scene; // scene to which this node belongs
33 bool visible; // if true, objects of this node are supposed to be visible
36 explicit SceneNode(Object *obj);
39 void set_name(const char *s);
40 const char *get_name() const;
42 void add_child(SceneNode *node);
43 bool remove_child(SceneNode *node);
45 int get_num_children() const;
46 SceneNode *get_child(int idx) const;
48 SceneNode *get_parent() const;
50 SceneNode *find_object_node() const;
52 void add_object(Object *obj);
53 bool remove_object(Object *obj);
55 int get_num_objects() const;
56 Object *get_object(int idx) const;
58 void set_position(const Vec3 &pos);
59 void set_rotation(const Quat &rot);
60 void set_scaling(const Vec3 &scale);
62 const Vec3 &get_node_position() const;
63 const Quat &get_node_rotation() const;
64 const Vec3 &get_node_scaling() const;
66 Vec3 get_position() const;
67 Quat get_rotation() const;
68 Vec3 get_scaling() const;
70 const Mat4 &get_matrix() const;
71 const Mat4 &get_inv_matrix() const;
73 void update_node(float dt = 0.0f);
74 void update(float dt = 0.0f);
78 bool intersect(const Ray &ray, HitPoint *hit) const;
80 // cached local bounding box (all objects in this node in model space)
81 const AABox &calc_local_bounds();
82 const AABox &get_local_bounds() const;
84 // world bounding box of the node
85 AABox get_node_bounds() const;
86 // world bounding box of the node and it's subtree
87 AABox get_bounds() const;