本文整理汇总了C++中ogre::Bone::getChildIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ Bone::getChildIterator方法的具体用法?C++ Bone::getChildIterator怎么用?C++ Bone::getChildIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Bone
的用法示例。
在下文中一共展示了Bone::getChildIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
void IKChain::Initialize()
{
// Get skeleton root Ogre::Bone
Ogre::Bone* oBoneRoot = mOgreSkeleton->getRootBone();
Ogre::Vector3 vecBonePos = oBoneRoot->getPosition();
oBoneRoot->setManuallyControlled(true);
// Create IK root
mIKRoot = new IKJoint(oBoneRoot, NULL, oBoneRoot->getPosition().x + mMeshNode->getPosition().x, oBoneRoot->getPosition().y + mMeshNode->getPosition().y, oBoneRoot->getPosition().z + mMeshNode->getPosition().z);
// Keep track of previously processed Ogre::Bone
IKJoint* oLastIKJoint = mIKRoot;
// Current Ogre::Bone
Ogre::Bone* oCurrentBone = oBoneRoot;
cout << "Current Ogre::Bone: " << oCurrentBone->getName() << endl;
mJointCount = 1;
// Ogre::Bone iterator
Ogre::Node::ChildNodeIterator oIterator = oCurrentBone->getChildIterator();
Ogre::Vector3 vecParent = oBoneRoot->_getDerivedPosition();
while ( oIterator.hasMoreElements() )
{
oCurrentBone = (Ogre::Bone*)oIterator.getNext();
oCurrentBone->setManuallyControlled(true);
cout << "Current Ogre::Bone: " << oCurrentBone->getName() << endl;
Ogre::Vector3 vecDerived = oCurrentBone->_getDerivedPosition();
Ogre::Vector3 vecJointPos = oCurrentBone->_getDerivedPosition() + mMeshNode->getPosition();
vecBonePos = oCurrentBone->getPosition();
IKJoint* oNewJoint = new IKJoint(oCurrentBone, oLastIKJoint, vecJointPos.x, vecJointPos.y, vecJointPos.z);
oLastIKJoint->SetChild(oNewJoint);
oLastIKJoint = oNewJoint;
oIterator = oCurrentBone->getChildIterator();
mJointCount++;
mChainLength += vecParent.distance(oCurrentBone->_getDerivedPosition());
vecParent = oCurrentBone->_getDerivedPosition();
}
mChainLength = mChainLength;
mIKEffector = oLastIKJoint;
cout << "Ogre::Bone count is " << mJointCount << endl;
}