X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fsnode.h;h=6fa52ba892ee763a4db752c5e5b7825732abe326;hp=5af02f41fc0d99ed03f42902d40e3a169f48f44a;hb=794a378d5c8e07c815814324da8142be137406d0;hpb=dbcb9345c23c5c027d808915962843e7db2d14aa diff --git a/src/snode.h b/src/snode.h index 5af02f4..6fa52ba 100644 --- a/src/snode.h +++ b/src/snode.h @@ -3,6 +3,7 @@ #include #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); @@ -69,6 +74,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_