本文整理汇总了C++中ogre::MeshPtr::getSkeleton方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::getSkeleton方法的具体用法?C++ MeshPtr::getSkeleton怎么用?C++ MeshPtr::getSkeleton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::getSkeleton方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addMesh
void MeshMergeTool::addMesh(Ogre::MeshPtr mesh)
{
SkeletonPtr meshSkel = mesh->getSkeleton();
if (meshSkel.isNull() && mesh->hasSkeleton())
{
meshSkel = SkeletonManager::getSingleton().getByName(mesh->getSkeletonName());
}
if (meshSkel.isNull() && !mBaseSkeleton.isNull())
{
throw std::logic_error(
"Some meshes have a skeleton, but others have none, cannot merge.");
}
if (!meshSkel.isNull() && mBaseSkeleton.isNull() && !mMeshes.empty())
{
throw std::logic_error(
"Some meshes have a skeleton, but others have none, cannot merge.");
}
if (!meshSkel.isNull() && mBaseSkeleton.isNull() && mMeshes.empty())
{
mBaseSkeleton = meshSkel;
print("Set: base skeleton (" + mBaseSkeleton->getName()+")", V_HIGH);
}
if (meshSkel != mBaseSkeleton)
{
throw std::logic_error(
"Some meshes have a skeleton, but others have none, cannot merge.");
}
mMeshes.push_back(mesh);
}
示例2: main
int main(int argc, char **argv)
{
if(argc <= 1 || argc > 2)
{
std::cout << "Invalid argument, it sould be : ./ogre_show_animationstate /path/name.mesh !\n";
return -1;
}
std::string nameMesh(argv[1]);
std::string pathMesh;
int index = nameMesh.size();
while(nameMesh[index] != '/')
{
index--;
if(index == 0)
{
pathMesh = "./";
break;
}
}
if(index != 0)
{
pathMesh = nameMesh.substr(0, index);
}
// Init
Ogre::Root* mRoot = new Ogre::Root();
new Ogre::DefaultHardwareBufferManager();
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(pathMesh, "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// load mesh
Ogre::MeshPtr mesh =
Ogre::MeshManager::getSingleton().load(nameMesh, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
// create & load a SkeletonInstance
Ogre::SkeletonInstance* skelInst = new Ogre::SkeletonInstance(mesh->getSkeleton());
skelInst->load();
// create & load an AnimationStateSet
Ogre::AnimationStateSet* animStateSet = new Ogre::AnimationStateSet();
mesh->_initAnimationState(animStateSet);
// show animation state
std::cout << "Animation states : \n";
Ogre::AnimationStateIterator iter = animStateSet->getAnimationStateIterator();
while(iter.hasMoreElements())
{
Ogre::AnimationState* animationState = iter.getNext();
std::cout << "\t- " << animationState->getAnimationName() << "\n";
}
return 0;
}
示例3: addMesh
void MergeMesh::addMesh( Ogre::MeshPtr mesh )
{
if( mesh->getSkeleton().isNull() )
{
log( "Skipped: " + mesh->getName() + " has no skeleton" );
return;
}
if( m_BaseSkeleton.isNull() )
{
m_BaseSkeleton = mesh->getSkeleton();
log( "Set: base skeleton (" + m_BaseSkeleton->getName()+")" );
}
if( mesh->getSkeleton() != m_BaseSkeleton )
{
log( "Skipped: " + mesh->getName() + " has other skeleton ("+ mesh->getSkeleton()->getName() +")" );
return;
}
m_Meshes.push_back( mesh );
}
示例4: loadCorrelativeResource
Ogre::MeshPtr
loadMesh(const Ogre::String& meshName, const Ogre::String& groupName,
const Ogre::String& baseResourceName, const Ogre::String& baseGroupName)
{
// Load the mesh
Ogre::MeshPtr mesh = loadCorrelativeResource(
meshName, groupName,
baseResourceName, baseGroupName,
Ogre::MeshManager::getSingleton());
if (mesh.isNull())
{
OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND,
"Unable to load mesh " + meshName,
"loadMesh");
}
// Try to resolve skeleton resource
if (mesh->hasSkeleton() && mesh->getSkeleton().isNull())
{
// resolve correlative with mesh
Ogre::SkeletonPtr skeleton = loadCorrelativeResource(
mesh->getSkeletonName(), groupName,
mesh->getName(), mesh->getGroup(),
Ogre::SkeletonManager::getSingleton());
if (skeleton.isNull())
{
// resolve correlative with base resource
skeleton = loadCorrelativeResource(
mesh->getSkeletonName(), groupName,
baseResourceName, baseGroupName,
Ogre::SkeletonManager::getSingleton());
}
if (skeleton.isNull())
{
OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND,
"Unable to load skeleton " + mesh->getSkeletonName() +
" for mesh " + mesh->getName(),
"loadMesh");
}
// Set to the actual name
mesh->setSkeletonName(skeleton->getName());
}
return mesh;
}
示例5: move
std::vector<std::wstring> ManipulatorEffect::GetMeshAnimNames( const std::string& meshname ) const
{
Ogre::MeshManager::getSingleton().load(meshname, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
Ogre::MeshPtr pMesh = Ogre::MeshManager::getSingleton().getByName(meshname);
std::vector<std::wstring> vecRet;
const Ogre::SkeletonPtr& pSkeleton = pMesh->getSkeleton();
//没有可用动画
if(!pSkeleton.get() || pSkeleton->getNumAnimations()==0)
return std::move(vecRet);
for(size_t i=0; i<pSkeleton->getNumAnimations(); ++i)
vecRet.push_back(Utility::EngineToUnicode(pSkeleton->getAnimation(i)->getName()));
return std::move(vecRet);
}
示例6:
const std::string& EC_Mesh::GetSkeletonName() const
{
static std::string empty_name;
if (!entity_)
return empty_name;
else
{
Ogre::MeshPtr mesh = entity_->getMesh();
if (!mesh->hasSkeleton())
return empty_name;
Ogre::SkeletonPtr skel = mesh->getSkeleton();
if (skel.isNull())
return empty_name;
return skel->getName();
}
}