本文整理汇总了C++中mwworld::Ptr::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::getType方法的具体用法?C++ Ptr::getType怎么用?C++ Ptr::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mwworld::Ptr
的用法示例。
在下文中一共展示了Ptr::getType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
std::pair<std::string, float> MWScene::getFacedHandle (MWWorld::World& world)
{
std::string handle = "";
float distance = -1;
//get a ray pointing to the center of the viewport
Ray centerRay = getCamera()->getCameraToViewportRay(
getViewport()->getWidth()/2,
getViewport()->getHeight()/2);
// get all objects touched by the ray
getRaySceneQuery()->setRay (centerRay );
RaySceneQueryResult &result = getRaySceneQuery()->execute();
RaySceneQueryResult::iterator nearest = result.end();
for (RaySceneQueryResult::iterator itr = result.begin();
itr != result.end(); itr++ )
{
// there seem to be omnipresent objects like the caelum sky dom,
// the distance of these objects is always 0 so this if excludes these
if ( itr->movable && itr->distance >= 0.1)
{
// horrible hack to exclude statics. this must be removed as soon as a replacement for the
// AABB raycasting is implemented (we should not ignore statics)
MWWorld::Ptr ptr = world.getPtrViaHandle (itr->movable->getParentSceneNode()->getName());
if (ptr.getType()==typeid (ESM::Static))
break;
if ( nearest == result.end() ) //if no object is set
{
nearest = itr;
}
else if ( itr->distance < nearest->distance )
{
nearest = itr;
}
}
}
if ( nearest != result.end() )
{
handle = nearest->movable->getParentSceneNode()->getName();
distance = nearest->distance;
}
return std::pair<std::string, float>(handle, distance);
}