Re: [info-performer] getting accumulated scene transformation

New Message Reply Date view Thread view Subject view Author view

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


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Jan 08 2003 - 01:06:07 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.