本文整理汇总了C++中Fmatrix::build_projection_HAT方法的典型用法代码示例。如果您正苦于以下问题:C++ Fmatrix::build_projection_HAT方法的具体用法?C++ Fmatrix::build_projection_HAT怎么用?C++ Fmatrix::build_projection_HAT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fmatrix
的用法示例。
在下文中一共展示了Fmatrix::build_projection_HAT方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void CLightProjector::calculate ()
{
#ifdef _GPA_ENABLED
TAL_SCOPED_TASK_NAMED( "CLightProjector::calculate()" );
#endif // _GPA_ENABLED
if (receivers.empty()) return;
// perform validate / markup
for (u32 r_it=0; r_it<receivers.size(); r_it++)
{
// validate
BOOL bValid = TRUE;
IRenderable* O = receivers[r_it];
CROS_impl* LT = (CROS_impl*)O->renderable_ROS();
int slot = LT->shadow_recv_slot;
if (slot<0 || slot>=P_o_count) bValid = FALSE; // invalid slot
else if (cache[slot].O!=O) bValid = FALSE; // not the same object
else {
// seems to be valid
Fbox bb; bb.xform (O->renderable.visual->getVisData().box,O->renderable.xform);
if (cache[slot].BB.contains(bb)) {
// inside, but maybe timelimit exceeded?
if (Device.dwTimeGlobal > cache[slot].dwTimeValid) bValid = FALSE; // timeout
} else bValid = FALSE; // out of bounds
}
//
if (bValid) {
// Ok, use cached version
cache[slot].dwFrame = Device.dwFrame;
} else {
taskid.push_back (r_it);
}
}
if (taskid.empty()) return;
// Begin
Device.Statistic->RenderDUMP_Pcalc.Begin ();
RCache.set_RT (RT->pRT);
RCache.set_ZB (RImplementation.Target->pTempZB);
CHK_DX(HW.pDevice->Clear (0,0, D3DCLEAR_ZBUFFER | (HW.Caps.bStencil?D3DCLEAR_STENCIL:0), 0,1,0 ));
RCache.set_xform_world (Fidentity);
// reallocate/reassociate structures + perform all the work
for (u32 c_it=0; c_it<cache.size(); c_it++)
{
if (taskid.empty()) break;
if (Device.dwFrame==cache[c_it].dwFrame) continue;
// found not used slot
int tid = taskid.back(); taskid.pop_back();
recv& R = cache [c_it];
IRenderable* O = receivers [tid];
const vis_data& vis = O->renderable.visual->getVisData();
CROS_impl* LT = (CROS_impl*)O->renderable_ROS();
VERIFY2 (_valid(O->renderable.xform),"Invalid object transformation");
VERIFY2 (_valid(vis.sphere.P),"Invalid object's visual sphere");
Fvector C; O->renderable.xform.transform_tiny (C,vis.sphere.P);
R.O = O;
R.C = C;
R.C.y += vis.sphere.R*0.1f; //. YURA: 0.1 can be more
R.BB.xform (vis.box,O->renderable.xform).scale(0.1f);
R.dwTimeValid = Device.dwTimeGlobal + ::Random.randI(time_min,time_max);
LT->shadow_recv_slot = c_it;
// Msg ("[%f,%f,%f]-%f",C.C.x,C.C.y,C.C.z,C.O->renderable.visual->vis.sphere.R);
// calculate projection-matrix
Fmatrix mProject;
float p_R = R.O->renderable.visual->getVisData().sphere.R * 1.1f;
//VERIFY2 (p_R>EPS_L,"Object has no physical size");
VERIFY3 (p_R>EPS_L,"Object has no physical size", R.O->renderable.visual->getDebugName().c_str());
float p_hat = p_R/P_cam_dist;
float p_asp = 1.f;
float p_near = P_cam_dist-EPS_L;
float p_far = P_cam_dist+p_R+P_cam_range;
mProject.build_projection_HAT (p_hat,p_asp,p_near,p_far);
RCache.set_xform_project (mProject);
// calculate view-matrix
Fmatrix mView;
Fvector v_C, v_Cs, v_N;
v_C.set (R.C);
v_Cs = v_C;
v_C.y += P_cam_dist;
v_N.set (0,0,1);
VERIFY (_valid(v_C) && _valid(v_Cs) && _valid(v_N));
// validate
Fvector v;
v.sub (v_Cs,v_C);;
#ifdef DEBUG
if ((v.x*v.x+v.y*v.y+v.z*v.z)<=flt_zero) {
CObject* OO = dynamic_cast<CObject*>(R.O);
Msg("Object[%s] Visual[%s] has invalid position. ",*OO->cName(),*OO->cNameVisual());
Fvector cc;
OO->Center(cc);
Log("center=",cc);
//.........这里部分代码省略.........