From: Michael Rouille (michael.rouille++at++irisa.fr)
Date: 01/08/2003 01:05:17
> How do I acquire the accumulated scene transformation at a specific node
> so I can transform points in the geometry space to world space for that
> node.
> I see the transform can be retrieved when testing for intersection by
> using pfHit(hit,PFHIT_XFORM,xform), where xform will then contain the
> matrix. But I want the
> matrix without performing any intersection test.
Below is the code I use to obtain the accumulated scene transformation
at a specific node during the APP process, namely a traversal callback
method attached to a node:
//-----------------------------------------------------------------------------
/// declaration of the traversal method: get a node world space coordinates
//-----------------------------------------------------------------------------
static int getNodeWorldCoordinatesCB( pfTraverser* traverser, void*
yourClassSharedArenaInstance ) ;
//-----------------------------------------------------------------------------
// definition of the traversal method: return the world space
coordinates of a node
//-----------------------------------------------------------------------------
int
YourClass::getNodeWorldCoordinatesCB( pfTraverser* traverser, void*
yourClassSharedArenaInstance )
{
traverser->getMat( ( static_cast<YourClassSharedArena*>(
yourClassSharedArenaInstance ) )->_yourMatrix ) ;
return PFTRAV_CONT ;
}
//-----------------------------------------------------------------------------
// set the traversal method on the appropriate node
//-----------------------------------------------------------------------------
_yourClassSharedArenaInstance->_node->setTravFuncs( PFTRAV_APP,
getNodeWorldCoordinatesCB, NULL ) ;
_yourClassSharedArenaInstance->_node->setTravData( PFTRAV_APP,
static_cast<void*>( _viewportSharedData ) ) ;
--Michaël Rouillé - OpenMASK <http://www.openmask.org> engineer - Siames Project, IRISA
This archive was generated by hypermail 2b29 : Wed Jan 08 2003 - 01:06:07 PST