本文整理汇总了C++中ogre::SkeletonPtr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ SkeletonPtr::getName方法的具体用法?C++ SkeletonPtr::getName怎么用?C++ SkeletonPtr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SkeletonPtr
的用法示例。
在下文中一共展示了SkeletonPtr::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSkeletonAssetLoaded
void EC_Mesh::OnSkeletonAssetLoaded(AssetPtr asset)
{
OgreSkeletonAsset *skeletonAsset = dynamic_cast<OgreSkeletonAsset*>(asset.get());
if (!skeletonAsset)
{
LogError("OnSkeletonAssetLoaded: Skeleton asset load finished for asset \"" +
asset->Name().toStdString() + "\", but downloaded asset was not of type OgreSkeletonAsset!");
return;
}
Ogre::SkeletonPtr skeleton = skeletonAsset->ogreSkeleton;
if (skeleton.isNull())
{
LogError("OnSkeletonAssetLoaded: Skeleton asset load finished for asset \"" +
asset->Name().toStdString() + "\", but Ogre::Skeleton pointer was null!");
return;
}
if(!entity_)
{
LogDebug("Could not set skeleton yet because entity is not yet created");
return;
}
try
{
// If old skeleton is same as a new one no need to replace it.
if (entity_->getSkeleton() && entity_->getSkeleton()->getName() == skeleton->getName())
return;
entity_->getMesh()->_notifySkeleton(skeleton);
// LogDebug("Set skeleton " + skeleton->getName() + " to mesh " + entity_->getName());
emit SkeletonChanged(QString::fromStdString(skeleton->getName()));
}
catch (...)
{
LogError("Exception while setting skeleton to mesh" + entity_->getName());
}
// Now we have to recreate the entity to get proper animations etc.
SetMesh(entity_->getMesh()->getName().c_str(), false);
}
示例2: 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;
}
示例3:
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();
}
}
示例4: length
//-------------------------------------------------------------------------
void
AFile::addTo( Ogre::SkeletonPtr skeleton, const String& name ) const
{
if( skeleton->hasAnimation( name) ) return;
Ogre::Real length( ( m_frames.size() - 1 ) * FRAME_DURATION );
Ogre::Animation *anim( skeleton->createAnimation(name, length ));
uint16 track_handle( 0 );
Ogre::Bone* bone( skeleton->getBone( "root" ) );
Ogre::NodeAnimationTrack* track;
track = anim->createNodeTrack( track_handle++, bone );
Ogre::Real time;
size_t index( 0 );
for( FrameList::const_iterator frame( m_frames.begin())
;frame != m_frames.end(); ++frame )
{
time = (index++) * FRAME_DURATION;
Ogre::TransformKeyFrame* key_frame( track->createNodeKeyFrame( time ) );
key_frame->setTranslate( frame->root_translation );
setFrameRotation( key_frame, frame->root_rotation );
}
for( uint32 i(0); i < m_bone_count; ++i )
{
if (i + 1 >= skeleton->getNumBones())
{
// TODO: Figure out why this happens/fix it
LOG_ERROR("Bone " + std::to_string(i + 1) + " is out of bounds " + std::to_string(skeleton->getNumBones()) + " for: " + name + " in: " + skeleton->getName());
}
else
{
bone = skeleton->getBone(i + 1);
track = anim->createNodeTrack(track_handle++, bone);
time = 0;
for (FrameList::const_iterator frame(m_frames.begin())
; frame != m_frames.end(); ++frame)
{
const Ogre::Vector3& rot(frame->bone_rotations[i]);
Ogre::TransformKeyFrame* key_frame(track->createNodeKeyFrame(time));
setFrameRotation(key_frame, rot);
time += FRAME_DURATION;
}
}
}
}