本文整理汇总了C++中ogre::SkeletonInstance::getBoneIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ SkeletonInstance::getBoneIterator方法的具体用法?C++ SkeletonInstance::getBoneIterator怎么用?C++ SkeletonInstance::getBoneIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SkeletonInstance
的用法示例。
在下文中一共展示了SkeletonInstance::getBoneIterator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertBoundedPart
NifOgre::EntityList NpcAnimation::insertBoundedPart(const std::string &mesh, int group, const std::string &bonename)
{
NifOgre::EntityList entities = NifOgre::Loader::createEntities(mEntityList.mSkelBase, bonename,
mInsert, mesh);
std::vector<Ogre::Entity*> &parts = entities.mEntities;
for(size_t i = 0;i < parts.size();i++)
{
parts[i]->getUserObjectBindings().setUserAny(Ogre::Any(group));
if (mVisibilityFlags != 0)
parts[i]->setVisibilityFlags(mVisibilityFlags);
for(unsigned int j=0; j < parts[i]->getNumSubEntities(); ++j)
{
Ogre::SubEntity* subEnt = parts[i]->getSubEntity(j);
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
}
}
if(entities.mSkelBase)
{
Ogre::AnimationStateSet *aset = entities.mSkelBase->getAllAnimationStates();
Ogre::AnimationStateIterator asiter = aset->getAnimationStateIterator();
while(asiter.hasMoreElements())
{
Ogre::AnimationState *state = asiter.getNext();
state->setEnabled(false);
state->setLoop(false);
}
Ogre::SkeletonInstance *skelinst = entities.mSkelBase->getSkeleton();
Ogre::Skeleton::BoneIterator boneiter = skelinst->getBoneIterator();
while(boneiter.hasMoreElements())
boneiter.getNext()->setManuallyControlled(true);
}
return entities;
}
示例2: checkMesh
void BoneCollisionManager::checkMesh(Ogre::String outFileName, Ogre::SceneNode* node)
{
std::ofstream file(outFileName.c_str());
if (file)
{
Ogre::Entity* ent = (Ogre::Entity*)node->getAttachedObject(0);
Ogre::SkeletonInstance* skeletonInst = ent->getSkeleton();
Ogre::Skeleton::BoneIterator boneI=skeletonInst->getBoneIterator();
//file<<"Creating bone length information from:\n";
file<<"Mesh name: "<<ent->getMesh()->getName()<<"\n";
file<<"Skeleton name: "<<skeletonInst->getName()<<"\n\n";
while(boneI.hasMoreElements())
{
Ogre::Bone* bone=boneI.getNext();
Ogre::String bName=bone->getName();
if (bone->getChild(0))
{
Ogre::Vector3 curr = bone->_getDerivedPosition();
Ogre::Vector3 next = bone->getChild(0)->_getDerivedPosition();
Ogre::Vector3 difference = next-curr;
//length of bone
Ogre::Real lenght = difference.length();
file<<bName<<":\nLength\t\t\t=\t"<<Ogre::StringConverter::toString(lenght,3)<<"\n"<<
"Position"<<"\t\t=\t"<<Ogre::StringConverter::toString(curr.x,1)<<", "<<
Ogre::StringConverter::toString(curr.y,1)<<", "<<
Ogre::StringConverter::toString(curr.z,1)<<"\n";
if (!bone->getParent())
file<<bName<<" is a Root Bone!\n\n";
else
file<<"\n\n";
}
}
}
}
示例3: setObjectRoot
void Animation::setObjectRoot(const std::string &model, bool baseonly)
{
OgreAssert(mAnimSources.empty(), "Setting object root while animation sources are set!");
mSkelBase = NULL;
mObjectRoot.setNull();
if(model.empty())
return;
std::string mdlname = Misc::StringUtils::lowerCase(model);
std::string::size_type p = mdlname.rfind('\\');
if(p == std::string::npos)
p = mdlname.rfind('/');
if(p != std::string::npos)
mdlname.insert(mdlname.begin()+p+1, 'x');
else
mdlname.insert(mdlname.begin(), 'x');
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(mdlname))
{
mdlname = model;
Misc::StringUtils::toLower(mdlname);
}
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, mdlname) :
NifOgre::Loader::createObjectBase(mInsert, mdlname));
if(mObjectRoot->mSkelBase)
{
mSkelBase = mObjectRoot->mSkelBase;
Ogre::AnimationStateSet *aset = mObjectRoot->mSkelBase->getAllAnimationStates();
Ogre::AnimationStateIterator asiter = aset->getAnimationStateIterator();
while(asiter.hasMoreElements())
{
Ogre::AnimationState *state = asiter.getNext();
state->setEnabled(false);
state->setLoop(false);
}
// Set the bones as manually controlled since we're applying the
// transformations manually
Ogre::SkeletonInstance *skelinst = mObjectRoot->mSkelBase->getSkeleton();
Ogre::Skeleton::BoneIterator boneiter = skelinst->getBoneIterator();
while(boneiter.hasMoreElements())
boneiter.getNext()->setManuallyControlled(true);
// Reattach any objects that have been attached to this one
ObjectAttachMap::iterator iter = mAttachedObjects.begin();
while(iter != mAttachedObjects.end())
{
if(!skelinst->hasBone(iter->second))
mAttachedObjects.erase(iter++);
else
{
mSkelBase->attachObjectToBone(iter->second, iter->first);
++iter;
}
}
}
else
mAttachedObjects.clear();
for(size_t i = 0;i < mObjectRoot->mControllers.size();i++)
{
if(mObjectRoot->mControllers[i].getSource().isNull())
mObjectRoot->mControllers[i].setSource(mAnimationTimePtr[0]);
}
}