本文整理汇总了C++中CFrustum::CreateFromPlanes方法的典型用法代码示例。如果您正苦于以下问题:C++ CFrustum::CreateFromPlanes方法的具体用法?C++ CFrustum::CreateFromPlanes怎么用?C++ CFrustum::CreateFromPlanes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFrustum
的用法示例。
在下文中一共展示了CFrustum::CreateFromPlanes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateSlotBBox
void EDetailManager::UpdateSlotBBox(int sx, int sz, DetailSlot& slot)
{
Fbox bbox;
Frect rect;
GetSlotRect (rect,sx,sz);
bbox.min.set (rect.x1, m_BBox.min.y, rect.y1);
bbox.max.set (rect.x2, m_BBox.max.y, rect.y2);
SBoxPickInfoVec pinf;
ETOOLS::box_options(0);
if (Scene->BoxPickObjects(bbox,pinf,&m_SnapObjects)){
bbox.grow (EPS_L_VAR);
Fplane frustum_planes[4];
frustum_planes[0].build(bbox.min,left_vec);
frustum_planes[1].build(bbox.min,back_vec);
frustum_planes[2].build(bbox.max,right_vec);
frustum_planes[3].build(bbox.max,fwd_vec);
CFrustum frustum;
frustum.CreateFromPlanes(frustum_planes,4);
float y_min = flt_max;
float y_max = flt_min;
for (SBoxPickInfoIt it=pinf.begin(); it!=pinf.end(); it++){
for (int k=0; k<(int)it->inf.size(); k++){
float range;
Fvector verts[3];
it->e_obj->GetFaceWorld(it->s_obj->_Transform(),it->e_mesh,it->inf[k].id,verts);
sPoly sSrc (verts,3);
sPoly sDest;
sPoly* sRes = frustum.ClipPoly(sSrc, sDest);
if (sRes){
for (u32 k=0; k<sRes->size(); k++){
float H = (*sRes)[k].y;
if (H>y_max) y_max = H+0.03f;
if (H<y_min) y_min = H-0.03f;
}
slot.w_y (y_min,y_max-y_min);
slot.w_id(0,DetailSlot::ID_Empty);
slot.w_id(1,DetailSlot::ID_Empty);
slot.w_id(2,DetailSlot::ID_Empty);
slot.w_id(3,DetailSlot::ID_Empty);
}
}
}
}else{
ZeroMemory(&slot,sizeof(DetailSlot));
slot.w_id(0,DetailSlot::ID_Empty);
slot.w_id(1,DetailSlot::ID_Empty);
slot.w_id(2,DetailSlot::ID_Empty);
slot.w_id(3,DetailSlot::ID_Empty);
}
}