Hi Toni,
On Thu, 2006-03-09 at 17:53 +0100, Antonio Bleile wrote:
> Hi,
>
> is it easy (if so, how?) to query for object
> frustum culling in OpenSG? I would like to
> know if a node is within my view frustum or
> not. Are there already some convenience functions
> in OpenSG?
There are no convenience functions, but the regular way is pretty
convenient already. ;)
// Get the viewing frustum from the camera
FrustumVolume frust;
mgr->getCamera()->getFrustum(frust, *mgr->getWindow()->getPort(0));
// Get the world-space volume from the node
DynamicVolume vol;
testobject->getWorldVolume( vol );
// Test
if ( frust.intersect( vol ) )
{
std::cout << "testobject is visible" << std::endl;
}
else
{
std::cout << "testobject is not visible" << std::endl;
}
Note that the test is conservative: if it tells you invisible it
definitely is, if it tells you visible it might not be.
Hope it helps
Dirk
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users