Wojciech Lewandowski wrote:
> 
> osg::Vec3 projectedPoint = osg::Vec3( x,y,z ) * camera->getViewMatrix() *
> camera->getProjectionMatrix();
> bool pointInFrustum = osg::BoundingBox( -1, -1, -1, 1,1,1 ).contains(
> projectedPoint );
> 

I actually wound up using sceneview->projectObjectIntoWindow(), which
likely does the same matrix mult, but seems to return a viewport xy with
0,0 in lower left corner.  Then I could just do a 2D viewport limit
check.

The above code looks like it assumes it would get an x,y,z screen
location each clamped to -1->1 centered at 0,0,0  - which I guess is
what you would get just applying the view and proj transforms without
any viewport adjustment?  I'm not sure what happens to z here.

Thanks.

Bob.


> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Robert
> Balfour
> Sent: Saturday, December 29, 2007 11:12 PM
> To: [email protected]
> Subject: [osg-users] Is point in view?
> 
> Is there a straight forward method to determine if a ground xyz target
> point (or geode bbox centerpoint) is currently visible (i.e. within the
> current view frustrum)?
> 
> I'm drawing a HUD target line, but don't want to draw it if the target
> point is not in view.
> 
> Thanks.
> 
> Bob.
> --
> Robert E. Balfour, Ph.D.
> Exec. V.P. & CTO,  BALFOUR Technologies LLC
> 960 South Broadway, Suite 108, Hicksville NY 11801
> Phone: (516)513-0030  Fax: (516)513-0027  email: [EMAIL PROTECTED]
> _______________________________________________
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to