<div> win10&osg3.6.4</div><div> // </div><div> osg::Matrixd proj = osg::Matrixd::identity();</div><div><span style="white-space:pre"> </span>proj.makePerspective(60, frustumAspectWidth/frustumAspectHeight, frustumNear, frustumFar);</div><div><span style="white-space:pre"> </span>//</div><div><span style="white-space:pre"> </span>const double mynear = proj(3, 2) / (proj(2, 2) - 1.0);</div><div><span style="white-space:pre"> </span>const double myfar = proj(3, 2) / (1.0 + proj(2, 2));</div><div><span style="white-space:pre"> </span>//</div><div><span style="white-space:pre"> </span>const double nLeft = mynear * (proj(2, 0) - 1.0) / proj(0, 0);</div><div><span style="white-space:pre"> </span>const double nRight = mynear * (1.0 + proj(2, 0)) / proj(0, 0);</div><div><span style="white-space:pre"> </span>const double nTop = mynear * (1.0 + proj(2, 1)) / proj(1, 1);</div><div><span style="white-space:pre"> </span>const double nBottom = mynear * (proj(2, 1) - 1.0) / proj(1, 1);</div><div><span style="white-space:pre"> </span>const double fLeft = myfar * (proj(2, 0) - 1.0) / proj(0, 0);</div><div><span style="white-space:pre"> </span>const double fRight = myfar * (1.0 + proj(2, 0)) / proj(0, 0);</div><div><span style="white-space:pre"> </span>const double fTop = myfar * (1.0 + proj(2, 1)) / proj(1, 1);</div><div><span style="white-space:pre"> </span>const double fBottom = myfar * (proj(2, 1) - 1.0) / proj(1, 1);</div><div><span style="white-space:pre"> </span>//</div><div> osg::Matrixd ViewM = _view->getCamera()->getInverseViewMatrix();</div><div> {</div><div> osg::Polytope viewFrstumPoly;</div><div><span style="white-space:pre"> </span>osg::Vec3d pt[9];</div><div><span style="white-space:pre"> </span>pt[1] = osg::Vec3d(nLeft, nBottom, -mynear)*ViewM ;</div><div><span style="white-space:pre"> </span>pt[2] = osg::Vec3d(nRight, nBottom, -mynear)*ViewM ;</div><div><span style="white-space:pre"> </span>pt[3] = osg::Vec3d(nRight, nTop, -mynear)*ViewM ;</div><div> viewFrstumPoly.add(osg::Plane(pt[1],pt[2],pt[3]));<br></div><div> }</div><div><br></div><div> {</div><div> osg::Polytope viewFrstumPoly2;<br></div><div> osg::Vec3d pt[9];</div><div> pt[1] = osg::Vec3d(nLeft, nBottom, -mynear);</div><div> pt[2] = osg::Vec3d(nRight, nBottom, -mynear) ;</div><div> pt[3] = osg::Vec3d(nRight, nTop, -mynear);</div><div> viewFrstumPoly2.add(osg::Plane(pt[1],pt[2],pt[3]));</div><div>
viewFrstumPoly2 .transform(ViewM);</div><div> }</div><div> </div><div><br></div><div> </div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/605b9691-4e64-4083-8229-fe6a94203bben%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/605b9691-4e64-4083-8229-fe6a94203bben%40googlegroups.com</a>.<br />