本文整理汇总了C++中Fplane::intersectRayDist方法的典型用法代码示例。如果您正苦于以下问题:C++ Fplane::intersectRayDist方法的具体用法?C++ Fplane::intersectRayDist怎么用?C++ Fplane::intersectRayDist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fplane
的用法示例。
在下文中一共展示了Fplane::intersectRayDist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RayPick
bool CLevelTool::RayPick(const Fvector& start, const Fvector& dir, float& dist, Fvector* pt, Fvector* n)
{
if (Scene->ObjCount()&&(UI->GetEState()==esEditScene)){
SRayPickInfo pinf;
pinf.inf.range = dist;
if (Scene->RayPickObject(dist, start,dir,OBJCLASS_SCENEOBJECT,&pinf,0)){
dist = pinf.inf.range;
if (pt) pt->set(pinf.pt);
if (n){
const Fvector* PT[3];
pinf.e_mesh->GetFacePT(pinf.inf.id, PT);
n->mknormal(*PT[0],*PT[1],*PT[2]);
}
return true;
}
}
Fvector N={0.f,-1.f,0.f};
Fvector P={0.f,0.f,0.f};
Fplane PL; PL.build(P,N);
float d;
if (PL.intersectRayDist(start,dir,d)&&(d<=dist)){
dist = d;
if (pt) pt->mad(start,dir,dist);
if (n) n->set(N);
return true;
}else return false;
}
示例2: RayPick
BOOL CEffect_Thunderbolt::RayPick(const Fvector& s, const Fvector& d, float& dist)
{
BOOL bRes = TRUE;
#ifdef _EDITOR
bRes = Tools->RayPick (s,d,dist,0,0);
#else
collide::rq_result RQ;
CObject* E = g_pGameLevel->CurrentViewEntity();
bRes = g_pGameLevel->ObjectSpace.RayPick(s,d,dist,collide::rqtBoth,RQ,E);
if (bRes) dist = RQ.range;
else{
Fvector N ={0.f,-1.f,0.f};
Fvector P ={0.f,0.f,0.f};
Fplane PL; PL.build(P,N);
float dst =dist;
if (PL.intersectRayDist(s,d,dst)&&(dst<=dist)){dist=dst; return true;}else return false;
}
#endif
return bRes;
}