本文整理汇总了C++中ogre::MeshPtr::_notifySkeleton方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::_notifySkeleton方法的具体用法?C++ MeshPtr::_notifySkeleton怎么用?C++ MeshPtr::_notifySkeleton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::_notifySkeleton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMeshWork
void ResourceLoader::loadMeshWork(const String& name, Mesh::MeshdataPtr mesh, const String& skeletonName, LoadedCallback cb) {
Ogre::MeshManager& mm = Ogre::MeshManager::getSingleton();
Ogre::MeshPtr mo = mm.getByName(name);
if (mo.isNull()) {
/// FIXME: set bounds, bounding radius here
Ogre::ManualResourceLoader *reload;
mo = mm.createManual(name,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,(reload=
#ifdef _WIN32
#ifdef NDEBUG
OGRE_NEW
#else
new
#endif
#else
OGRE_NEW
#endif
ManualMeshLoader(mesh, name)));
reload->prepareResource(&*mo);
reload->loadResource(&*mo);
if (!skeletonName.empty()) {
Ogre::SkeletonManager& skel_mgr = Ogre::SkeletonManager::getSingleton();
Ogre::SkeletonPtr skel = skel_mgr.getByName(skeletonName);
if (!skel.isNull())
mo->_notifySkeleton(skel);
}
}
cb();
}
示例2: locateSkeleton
bool MilkshapePlugin::locateSkeleton(Ogre::MeshPtr& mesh)
{
//
// choose filename
//
OPENFILENAME ofn;
memset (&ofn, 0, sizeof (OPENFILENAME));
char szFile[MS_MAX_PATH];
char szFileTitle[MS_MAX_PATH];
char szDefExt[32] = "skeleton";
char szFilter[128] = "OGRE .skeleton Files (*.skeleton)\0*.skeleton\0All Files (*.*)\0*.*\0\0";
szFile[0] = '\0';
szFileTitle[0] = '\0';
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.lpstrDefExt = szDefExt;
ofn.lpstrFilter = szFilter;
ofn.lpstrFile = szFile;
ofn.nMaxFile = MS_MAX_PATH;
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = MS_MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.lpstrTitle = "Locate OGRE Skeleton (since you're not exporting it)";
if (!::GetOpenFileName (&ofn))
return false;
// Strip off the path
Ogre::String skelName = szFile;
size_t lastSlash = skelName.find_last_of("\\");
skelName = skelName.substr(lastSlash+1);
Ogre::String msg = "Linking mesh to skeleton file '" + skelName + "'";
Ogre::LogManager::getSingleton().logMessage(msg);
// Create a dummy skeleton for Mesh to link to (saves it trying to load it)
Ogre::SkeletonPtr pSkel = Ogre::SkeletonManager::getSingleton().create(skelName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::LogManager::getSingleton().logMessage("Dummy Skeleton object created for link.");
mesh->_notifySkeleton(pSkel);
return true;
}
示例3: doExportSkeleton
//.........这里部分代码省略.........
int numBones = msModel_GetBoneCount(pModel);
msg = "Number of bones: " + Ogre::StringConverter::toString(numBones);
logMgr.logMessage(msg);
int i;
// Create all the bones in turn
for (i = 0; i < numBones; ++i)
{
msBone* bone = msModel_GetBoneAt(pModel, i);
Ogre::Bone* ogrebone = ogreskel->createBone(bone->szName);
msVec3 msBonePos, msBoneRot;
msBone_GetPosition(bone, msBonePos);
msBone_GetRotation(bone, msBoneRot);
Ogre::Vector3 bonePos(msBonePos[0], msBonePos[1], msBonePos[2]);
ogrebone->setPosition(bonePos);
// Hmm, Milkshape has chosen a Euler angle representation of orientation which is not smart
// Rotation Matrix or Quaternion would have been the smarter choice
// Might we have Gimbal lock here? What order are these 3 angles supposed to be applied?
// Grr, we'll try our best anyway...
Ogre::Quaternion qx, qy, qz, qfinal;
qx.FromAngleAxis(Ogre::Radian(msBoneRot[0]), Ogre::Vector3::UNIT_X);
qy.FromAngleAxis(Ogre::Radian(msBoneRot[1]), Ogre::Vector3::UNIT_Y);
qz.FromAngleAxis(Ogre::Radian(msBoneRot[2]), Ogre::Vector3::UNIT_Z);
// Assume rotate by x then y then z
qfinal = qz * qy * qx;
ogrebone->setOrientation(qfinal);
Ogre::LogManager::getSingleton().stream()
<< "Bone #" << i << ": " <<
"Name='" << bone->szName << "' " <<
"Position: " << bonePos << " " <<
"Ms3d Rotation: {" << msBoneRot[0] << ", " << msBoneRot[1] << ", " << msBoneRot[2] << "} " <<
"Orientation: " << qfinal;
}
// Now we've created all the bones, link them up
logMgr.logMessage("Establishing bone hierarchy..");
for (i = 0; i < numBones; ++i)
{
msBone* bone = msModel_GetBoneAt(pModel, i);
if (strlen(bone->szParentName) == 0)
{
// Root bone
msg = "Root bone detected: Name='" + Ogre::String(bone->szName) + "' Index="
+ Ogre::StringConverter::toString(i);
logMgr.logMessage(msg);
}
else
{
Ogre::Bone* ogrechild = ogreskel->getBone(bone->szName);
Ogre::Bone* ogreparent = ogreskel->getBone(bone->szParentName);
if (ogrechild == 0)
{
msg = "Error: could not locate child bone '" +
Ogre::String(bone->szName) + "'";
logMgr.logMessage(msg);
continue;
}
if (ogreparent == 0)
{
msg = "Error: could not locate parent bone '"
+ Ogre::String(bone->szParentName) + "'";
logMgr.logMessage(msg);
continue;
}
// Make child
ogreparent->addChild(ogrechild);
}
}
logMgr.logMessage("Bone hierarchy established.");
// Create the Animation(s)
doExportAnimations(pModel, ogreskel);
// Create skeleton serializer & export
Ogre::SkeletonSerializer serializer;
msg = "Exporting skeleton to " + Ogre::String(szFile);
logMgr.logMessage(msg);
serializer.exportSkeleton(ogreskel.getPointer(), szFile);
logMgr.logMessage("Skeleton exported");
msg = "Linking mesh to skeleton file '" + skelName + "'";
Ogre::LogManager::getSingleton().logMessage(msg);
mesh->_notifySkeleton(ogreskel);
return ogreskel;
}