I tried your suggestion, but the camera stack is always size=1, with only the current camera on top (be it the main cam or the RTT cam). I am still trying to track down why that is. (OSG 3.3.2)
Glenn Waldron / @glennwaldron On Fri, Jul 18, 2014 at 7:31 AM, Robert Osfield <[email protected]> wrote: > Hi Glenn, > > The RenderInfo object maintains a stack of Camera which you should be able > to use to get access to parent Camera's to the current Camera. > > With the computation I would suggest you convert the centroid into eye > coords of the RTT Camera like you are doing then convert back into world > coords by multiplying by the RTT Camera's inverse View Matrix. Then once > you have the coord in world coords multiple by the reference Camerea's View > matrix to get it in the reference eye coords. > > Robert. > > > On 17 July 2014 21:38, Glenn Waldron <[email protected]> wrote: > >> Hi friends, >> >> I have an osg::Drawable::DrawCallback, and therein I am calculating the >> distance from the camera to the Drawable's centroid. Like so: >> >> osg::BoundingBox bbox = drawable->getBoundingBox(); >> osg::Vec3f centerInView = bbox.center() * >> ri.getState()->getModelViewMatrix(); >> float distanceToCenter = -centerInView.z(); >> >> This works great! >> >> ...until I try to use it with an RTT camera that uses >> ABSOLUTE_RF_INHERIT_VIEWPOINT. Then, the State's modelview matrix is that >> of the RTT camera, not the reference camera. >> >> Is there any way to get to the reference camera's MV matrix in this >> scenario? >> >> >> Glenn Waldron / Pelican Mapping / @glennwaldron >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

