Hi,
I see. Of course thats very simple. I had something much more complicated in my
mind. (Checking if the frustum planes intersect with some bounding box lines or
so..)
Anyway..
Here is my solution:
Code:
osg::Vec3f eye, center, up;
float n;
viewA1->getCamera()->getViewMatrixAsLookAt(eye, center, up, n);
//printf("r: %f\n",boundingSphere._radius);
double d = (boxCenter - eye).length();
double fovy = osg::RadiansToDegrees(atan(boundingSphere._radius/d))*2;
double aspectratio = 1.0;
double znear = 1.;
double zfar = 1000.;
viewA1->getCamera()->setProjectionMatrixAsPerspective(fovy,
aspectratio, znear, zfar);
(Of course you can compute the znear and zfar as well by using d and d+radius.)
Cheers,
Johannes
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17397#17397
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org