本文整理汇总了C++中osg::Transform::getUpdateCallback方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform::getUpdateCallback方法的具体用法?C++ Transform::getUpdateCallback怎么用?C++ Transform::getUpdateCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Transform
的用法示例。
在下文中一共展示了Transform::getUpdateCallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
//.........这里部分代码省略.........
domAny *currentHPR = (domAny*)teq->add("CurrentHPR" );
currentHPR->setValue(toString(dof->getCurrentHPR()).c_str());
domAny *minTranslate = (domAny*)teq->add("MinTranslate" );
minTranslate->setValue(toString(dof->getMinTranslate()).c_str());
domAny *maxTranslate = (domAny*)teq->add("MaxTranslate" );
maxTranslate->setValue(toString(dof->getMaxTranslate()).c_str());
domAny *incrementTranslate = (domAny*)teq->add("IncrementTranslate" );
incrementTranslate->setValue(toString(dof->getIncrementTranslate()).c_str());
domAny *currentTranslate = (domAny*)teq->add("CurrentTranslate" );
currentTranslate->setValue(toString(dof->getCurrentTranslate()).c_str());
domAny *minScale = (domAny*)teq->add("MinScale" );
minScale->setValue(toString(dof->getMinScale()).c_str());
domAny *maxScale = (domAny*)teq->add("MaxScale" );
maxScale->setValue(toString(dof->getMaxScale()).c_str());
domAny *incrementScale = (domAny*)teq->add("IncrementScale" );
incrementScale->setValue(toString(dof->getIncrementScale()).c_str());
domAny *currentScale = (domAny*)teq->add("CurrentScale" );
currentScale->setValue(toString(dof->getCurrentScale()).c_str());
domAny *multOrder = (domAny*)teq->add("MultOrder" );
multOrder->setValue(toString<int>(dof->getHPRMultOrder()).c_str());
domAny *limitationFlags = (domAny*)teq->add("LimitationFlags" );
limitationFlags->setValue(toString<unsigned long>(dof->getLimitationFlags()).c_str());
domAny *animationOn = (domAny*)teq->add("AnimationOn" );
animationOn->setValue(toString<bool>(dof->getAnimationOn()).c_str());
domAny *putMatrix = (domAny*)teq->add("PutMatrix" );
putMatrix->setValue(toString(dof->getPutMatrix()).c_str());
currentNode->setId(getNodeName(node, "doftransform").c_str());
}
else
{
osgAnimation::Bone* bone = dynamic_cast<osgAnimation::Bone*>(&node);
if (bone)
{
domNode *pDomNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ));
pDomNode->setType(NODETYPE_JOINT);
pDomNode->setId(getNodeName(node, "bone").c_str());
}
else
{
std::string nodeName = getNodeName(node, "transform");
currentNode->setId(nodeName.c_str());
// Unknown transform type, just use local to world matrix
osg::Matrix matrix;
node.computeLocalToWorldMatrix(matrix, NULL);
osg::Callback* ncb = node.getUpdateCallback();
bool handled = false;
if (ncb)
{
osgAnimation::UpdateMatrixTransform* ut = dynamic_cast<osgAnimation::UpdateMatrixTransform*>(ncb);
// If targeted by an animation we split up the matrix into multiple place element so they can be targeted individually
if (ut)
{
handled = true;
// Note: though this is a generic matrix, based on the fact that it will be animated by and UpdateMatrixTransform,
// we assume the initial matrix can be decomposed into translation, rotation and scale elements
writeUpdateTransformElements(matrix.getTrans(), matrix.getRotate(), matrix.getScale());
}
}
// If not targeted by an animation simply write a single matrix place element
if (!handled)
{
domMatrix *mat = daeSafeCast< domMatrix >(currentNode->add( COLLADA_ELEMENT_MATRIX ) );
nodeName += "_matrix";
mat->setSid(nodeName.c_str());
const osg::Matrix::value_type *mat_vals = matrix.ptr();
for ( int i = 0; i < 4; i++ )
{
for ( int j = 0; j < 4; j++ )
{
mat->getValue().append( mat_vals[i + j*4] );
}
}
}
}
}
writeNodeExtra(node);
lastDepth = _nodePath.size();
traverse( node );
}