diff --git a/wrap/gl/shot.h b/wrap/gl/shot.h index d1e50b21..2aca638b 100644 --- a/wrap/gl/shot.h +++ b/wrap/gl/shot.h @@ -168,6 +168,29 @@ static ScalarType GetFarPlane(vcg::Shot & shot, vcg::Box3 & shot, vcg::Box3 bbox, ScalarType &nr, ScalarType &fr) +{ + vcg::Point3 zaxis = shot.Axis(2); + ScalarType offset = zaxis * shot.GetViewPoint(); + bool first = true; + for(int i = 0; i < 8; i++) { + vcg::Point3 c = bbox.P(i); + ScalarType d = -(zaxis * c - offset); + if(first || d < nr) { + nr = d; + first = false; + } + if(first || d > fr) { + fr = d; + first = false; + } + } +} + + + static void SetSubView(vcg::Shot & shot, vcg::Point2 p1, vcg::Point2 p2)