Commit 14b5c398 authored by Christopher Tenter's avatar Christopher Tenter

compute transformed aabb in FloatingSubtreeNode

parent d03842e6
Pipeline #3357 passed with stage
in 47 minutes and 55 seconds
......@@ -115,6 +115,32 @@ void FloatingSubtreeNode::setModelViewOverride(GLMatrixd modelview_override) {
modelview_override_inv_.invert();
}
void FloatingSubtreeNode::boundingBox(Vec3d &_bbMin, Vec3d &_bbMax) {
if (enable_modelview_override_) {
if (status() != BaseNode::HideChildren) {
BoundingBoxAction action;
BaseNode::ChildIter cIt, cEnd(childrenEnd());
// Process all children which are not second pass
for (cIt = childrenBegin(); cIt != cEnd; ++cIt)
if (~(*cIt)->traverseMode() & BaseNode::SecondPass)
traverse(*cIt, action);
// Process all children which are second pass
for (cIt = childrenBegin(); cIt != cEnd; ++cIt)
if ((*cIt)->traverseMode() & BaseNode::SecondPass)
traverse(*cIt, action);
// Transform bounding box to view space
Vec3d minVS = modelview_override_.transform_point(action.bbMin());
Vec3d maxVS = modelview_override_.transform_point(action.bbMax());
_bbMin.minimize(minVS);
_bbMax.maximize(maxVS);
}
}
}
} /* namespace Scenegraph */
} /* namespace ACG */
......
......@@ -115,6 +115,7 @@ class ACGDLLEXPORT FloatingSubtreeNode : public BaseNode {
void leavePick(GLState &_state, PickTarget _target,
const DrawModes::DrawMode &_drawMode) override;
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax) override;
private:
GLMatrixd modelview_override_, modelview_override_inv_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment