X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fsnode.h;h=00e1798de4ea616a2582df1029cfeb17f600fbe6;hp=b88c1aec7a59caa97b0704bf4bfa995f067322c6;hb=2fd19c29d765f973a757807d4e051e09495b47b4;hpb=82a1d96d9a18e94ccdc13b4bda0c470e81e70768 diff --git a/src/snode.h b/src/snode.h index b88c1ae..00e1798 100644 --- a/src/snode.h +++ b/src/snode.h @@ -24,12 +24,13 @@ private: Mat4 xform; Mat4 inv_xform; - mutable bool bvol_valid; - mutable Box bvol; + mutable bool local_bvol_valid; + mutable AABox local_bvol; public: Scene *scene; // scene to which this node belongs Mat4 dbg_xform; + bool visible; // if true, objects of this node are supposed to be visible SceneNode(); explicit SceneNode(Object *obj); @@ -46,6 +47,8 @@ public: SceneNode *get_parent() const; + SceneNode *find_object_node() const; + void add_object(Object *obj); bool remove_object(Object *obj); @@ -74,8 +77,14 @@ public: bool intersect(const Ray &ray, HitPoint *hit) const; - const Box &calc_bounds(); - const Box &get_bounds() const; + // cached local bounding box (all objects in this node in model space) + const AABox &calc_local_bounds(); + const AABox &get_local_bounds() const; + + // world bounding box of the node + AABox get_node_bounds() const; + // world bounding box of the node and it's subtree + AABox get_bounds() const; }; #endif // SNODE_H_