scene = 0;
parent = 0;
name = 0;
+ bvol_valid = false;
}
SceneNode::SceneNode(Object *obj)
scene = 0;
parent = 0;
name = 0;
+ bvol_valid = false;
add_object(obj);
}
children.push_back(node);
node->parent = this;
node->scene = scene;
+
+ bvol_valid = false;
}
bool SceneNode::remove_child(SceneNode *node)
node->parent = 0;
node->scene = 0;
children.erase(it);
+
+ bvol_valid = false;
return true;
}
return false;
this->obj.push_back(obj);
obj->node = this;
+
+ bvol_valid = false;
}
bool SceneNode::remove_object(Object *o)
return false;
}
obj.erase(it);
+
+ bvol_valid = false;
return true;
}
}
return false;
}
+
+const Box &SceneNode::calc_bounds()
+{
+ // TODO
+}
+
+const Box &SceneNode::get_bounds() const
+{
+ if(!bvol_valid) {
+ return ((SceneNode*)this)->calc_bounds();
+ }
+ return bvol;
+}
#include <vector>
#include "object.h"
+#include "geom.h"
#include "gmath/gmath.h"
class Scene;
Mat4 xform;
Mat4 inv_xform;
+ mutable bool bvol_valid;
+ mutable Box bvol;
+
public:
Scene *scene; // scene to which this node belongs
Mat4 dbg_xform;
void apply_xform();
bool intersect(const Ray &ray, HitPoint *hit) const;
+
+ const Box &calc_bounds();
+ const Box &get_bounds() const;
};
#endif // SNODE_H_