本文整理汇总了C++中ogre::Bone::getChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Bone::getChild方法的具体用法?C++ Bone::getChild怎么用?C++ Bone::getChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Bone
的用法示例。
在下文中一共展示了Bone::getChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSkeletonDebug
void SkeletonDebug::SetSkeletonDebug(
Ogre::Entity* entity,
Ogre::SceneManager* sceneManager,
const bool enable,
Ogre::Real boneSize,
Ogre::Real axisSize)
{
if (!HasSkeletonDebug(entity))
{
GetAxesMaterial();
GetBoneMaterial();
GetAxesMesh();
GetBoneMesh(boneSize);
const int numBones = entity->getSkeleton()->getNumBones();
for(unsigned short int iBone = 0; iBone < numBones; ++iBone)
{
Ogre::Bone* pBone = entity->getSkeleton()->getBone(iBone);
if ( !pBone )
{
assert(false);
continue;
}
Ogre::Entity *ent;
Ogre::TagPoint *tp;
// Absolutely HAVE to create bone representations first. Otherwise we
// would get the wrong child count because an attached object counts as
// a child would be nice to have a function that only gets the children
// that are bones...
unsigned short numChildren = pBone->numChildren();
if (numChildren == 0)
{
// There are no children, but we should still represent the bone
// Creates a bone of length 1 for leaf bones (bones without children)
ent = sceneManager->createEntity(boneName);
ent->setCastShadows(false);
tp = entity->attachObjectToBone(
pBone->getName(),
(Ogre::MovableObject*)ent,
Ogre::Quaternion(Ogre::Degree(270.0f), Ogre::Vector3::UNIT_Z));
const Ogre::Real modBoneSize =
boneSize + boneSize * boneSize * 15.0f;
tp->setScale(modBoneSize, boneSize, modBoneSize);
}
else
{
for(unsigned short i = 0; i < numChildren; ++i)
{
if (dynamic_cast<Ogre::Bone*>(pBone->getChild(i)))
{
Ogre::Vector3 childPosition = pBone->getChild(i)->getPosition();
// If the length is zero, no point in creating the bone representation
float length = childPosition.length();
if(length < 0.00001f)
continue;
Ogre::Quaternion rotation = Ogre::Vector3::UNIT_Y.getRotationTo(
childPosition);
ent = sceneManager->createEntity(boneName);
ent->setCastShadows(false);
tp = entity->attachObjectToBone(
pBone->getName(),
(Ogre::MovableObject*)ent,
rotation);
const Ogre::Real modBoneSize =
boneSize + boneSize * length * 15.0f;
tp->setScale(modBoneSize, length, modBoneSize);
}
}
}
ent = sceneManager->createEntity(axesName);
ent->setCastShadows(false);
tp = entity->attachObjectToBone(pBone->getName(), (Ogre::MovableObject*)ent);
// Make sure we don't wind up with tiny/giant axes and that one axis doesnt get squashed
tp->setScale(
(axisSize/entity->getParentSceneNode()->getScale().x),
(axisSize/entity->getParentSceneNode()->getScale().y),
(axisSize/entity->getParentSceneNode()->getScale().z));
}
}
if (enable)
{
ShowSkeletonDebug(entity);
}
else
{
HideSkeletonDebug(entity);
}
}