Commit 1a23ec78 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'aabb_floating_subtree' into 'master'

compute transformed aabb in FloatingSubtreeNode

apply transformation to bounding box in FloatingSubtreeNode to fix clipping issue ( #74 )

See merge request !183
parents 94cbffc9 14b5c398
Pipeline #3360 passed with stage
in 40 minutes and 7 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