Ejemplo n.º 1
0
void Actor::AddBoneVisualizer()
{
	SkeletonInstance* pSkeletonInstance = _pBodyEntity->getSkeleton();

	if (!pSkeletonInstance)
	{
		return;
	}

	Skeleton::BoneIterator it = pSkeletonInstance->getBoneIterator();
	while (it.hasMoreElements())
	{
		Bone* pBone = it.getNext();

		Bone::ChildNodeIterator cit = pBone->getChildIterator();
		int iCount = 0;
		while (cit.hasMoreElements())
		{
			Node* pChild = cit.getNext();
			iCount++;

			String strName = pBone->getName() + "_" + pChild->getName();
			Ogre::Entity* ent = OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity(strName, "bone.mesh");
			TagPoint* pTag	= _pBodyEntity->attachObjectToBone(pBone->getName(), ent);

			ent->setVisible(_bShowBone);

			_Entitys.push_back(ent);

			_BoneVisuals[pTag] = pChild;
		}

		if (iCount == 0)
		{
			Ogre::Entity* ent = OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity(pBone->getName(), "bone.mesh");
			TagPoint* pTag	= _pBodyEntity->attachObjectToBone(pBone->getName(), ent);

			ent->setVisible(_bShowBone);

			_Entitys.push_back(ent);

			_BoneVisuals[pTag] = 0;
		}
	}

	_UpdateBoneVisualizer();
}