本文整理汇总了C++中ModelContainer::getIntersectionTime方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelContainer::getIntersectionTime方法的具体用法?C++ ModelContainer::getIntersectionTime怎么用?C++ ModelContainer::getIntersectionTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelContainer
的用法示例。
在下文中一共展示了ModelContainer::getIntersectionTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getIntersectionTime
float MapTree::getIntersectionTime(const Ray& pRay, float pMaxDist, bool pStopAtFirstHit)
{
double firstDistance = inf();
const IT end = iTree->endRayIntersection();
IT obj = iTree->beginRayIntersection(pRay, pMaxDist);
for ( ;obj != end; ++obj) // (preincrement is *much* faster than postincrement!)
{
/*
Call your accurate intersection test here. It is guaranteed
that the ray hits the bounding box of obj. (*obj) has type T,
so you can call methods directly using the "->" operator.
*/
ModelContainer *model = (ModelContainer *) (*obj);
float t = model->getIntersectionTime(pRay, pStopAtFirstHit, pMaxDist);
// just for visual debugging with an external debug class
#ifdef _DEBUG_VMAPS
if(gCount3 == gCount1)
{
AABox testBox;
testBox = model->getAABoxBounds();
gBoxArray.append(testBox);
}
++gCount3;
#endif
if(t > 0 && t < inf())
{
obj.markBreakNode();
if(firstDistance > t && pMaxDist >= t)
{
firstDistance = t;
if(pStopAtFirstHit) break;
}
}
}
return firstDistance;
}