static void SetTransforms(
domNode *node,
VECTOR3 &translation,
VECTOR3 &orientation,
VECTOR3 &scaling)
{
VECTOR3 ancestorTranslation(0,0,0); //identity
VECTOR3 ancestorOrientation(0,0,0); //identity
VECTOR3 ancestorScaling(1,1,1); //identity
if (node->getAncestor("node") != 0)
{
//the transformations of an ancestor are required - recurse
//////////////////////////////////////////////////////////////////////////
SetTransforms(
static_cast<domNode*>(node->getAncestor("node")),
ancestorTranslation,
ancestorOrientation,
ancestorScaling);
}//end if
/************************************************************************/
/* ancestor transformations are complete */
/************************************************************************/
if (node->getChildrenByType<domMatrix>().getCount())
{
// all transformations are in a matrix
//////////////////////////////////////////////////////////////////////////
ParseMatrix(
node,
orientation,
translation);
}
else
{
// parse rotations
//////////////////////////////////////////////////////////////////////////
ParseOrientation(
node,
orientation);
// parse translation
//////////////////////////////////////////////////////////////////////////
parseTranslation(
node,
translation);
// parse scaling
//////////////////////////////////////////////////////////////////////////
parseScaling(
node,
scaling);
}//end if
/************************************************************************/
/* current node transformations complete */
/************************************************************************/
// combine ancestor and current node transformations
//////////////////////////////////////////////////////////////////////////
translation += ancestorTranslation;
CombineRotations(ancestorOrientation,orientation);
scaling[0] *= ancestorScaling[0];
scaling[1] *= ancestorScaling[1];
scaling[2] *= ancestorScaling[2];
}