exhibit ui improvements, and exhibit repositioning fix
[laserbrain_demo] / src / snode.h
index 5af02f4..00e1798 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <vector>
 #include "object.h"
+#include "geom.h"
 #include "gmath/gmath.h"
 
 class Scene;
@@ -23,9 +24,13 @@ private:
        Mat4 xform;
        Mat4 inv_xform;
 
+       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);
@@ -42,6 +47,8 @@ public:
 
        SceneNode *get_parent() const;
 
+       SceneNode *find_object_node() const;
+
        void add_object(Object *obj);
        bool remove_object(Object *obj);
 
@@ -69,6 +76,15 @@ public:
        void apply_xform();
 
        bool intersect(const Ray &ray, HitPoint *hit) 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_