本文整理汇总了C++中ModelContainer::beginRayIntersection方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelContainer::beginRayIntersection方法的具体用法?C++ ModelContainer::beginRayIntersection怎么用?C++ ModelContainer::beginRayIntersection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelContainer
的用法示例。
在下文中一共展示了ModelContainer::beginRayIntersection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isOutDoors
bool MapTree::isOutDoors(const Vector3& pos)
{
Vector3 dir = Vector3(0,-1,0);
Ray ray = Ray::fromOriginAndDirection(pos, dir); // direction with length of 1
unsigned int flags;
AABSPTree<ModelContainer*>::RayIntersectionIterator MITR;
AABSPTree<ModelContainer*>::RayIntersectionIterator MITREND;
RayIntersectionIterator<TreeNode, SubModel> SMITR;
RayIntersectionIterator<TreeNode, SubModel> SMITREND;
ModelContainer * mc;
SubModel * sm;
MITR = iTree->beginRayIntersection( ray, MAX_CAN_FALL_DISTANCE );
MITREND = iTree->endRayIntersection();
for(; MITR != MITREND; ++MITR)
{
mc = ((ModelContainer*)*MITR);
Ray relativeRay = Ray::fromOriginAndDirection(ray.origin - mc->getBasePosition(), ray.direction);
SMITR = mc->beginRayIntersection( relativeRay, MAX_CAN_FALL_DISTANCE );
SMITREND = mc->endRayIntersection();
for( ; SMITR != SMITREND; ++SMITR )
{
sm = ((SubModel*)&(*SMITR));
#if 0
if( sm->getIndoorFlag() != 0 )
{
unsigned int i = sm->getIndoorFlag();
printf("=========================================================\n");
printf("Model indoor flags: %u\n", sm->getIndoorFlag());
unsigned int z, b;
for(z = 1, b = 1; b < 32;)
{
if(i & z)
printf(" Bit %u (0x%.8X or %u) is set!\n", b, z, z);
z <<= 1;
b+=1;
}
printf("=========================================================\n");
}
#else
flags = sm->getIndoorFlag();
if( flags != 0 )
{
/* From WoWdev:
Flag Meaning
0x1 Always set
0x4 Has vertex colors (MOCV chunk)
0x8 Outdoor
0x200 Has lights (MOLR chunk)
0x800 Has doodads (MODR chunk)
0x1000 Has water (MLIQ chunk)
0x2000 Indoor
0x40000 Show skybox
**********************
0x8000 seems to be set in the areas in citys (while it has the indoor flag, its not
an indoor area
*/
if( !(flags & 0x8) )
return false;
}
#endif
}
}
return true;
}