本文整理汇总了C++中IRenderable::renderable_ROS方法的典型用法代码示例。如果您正苦于以下问题:C++ IRenderable::renderable_ROS方法的具体用法?C++ IRenderable::renderable_ROS怎么用?C++ IRenderable::renderable_ROS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderable
的用法示例。
在下文中一共展示了IRenderable::renderable_ROS方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
//.........这里部分代码省略.........
示例2: translateSector
//.........这里部分代码省略.........
g_hud->Render_First ( ); // R1 shadows
g_hud->Render_Last ( );
u32 uID_LTRACK = 0xffffffff;
if (phase==PHASE_NORMAL) {
uLastLTRACK ++;
if (lstRenderables.size()) uID_LTRACK = uLastLTRACK%lstRenderables.size();
// update light-vis for current entity / actor
CObject* O = g_pGameLevel->CurrentViewEntity();
if (O) {
CROS_impl* R = (CROS_impl*) O->ROS();
if (R) R->update (O);
}
}
for (u32 o_it=0; o_it<lstRenderables.size(); o_it++)
{
ISpatial* spatial = lstRenderables[o_it]; spatial->spatial_updatesector ();
CSector* sector = (CSector*)spatial->spatial.sector ;
if (0==sector)
continue; // disassociated from S/P structure
// Filter only not light spatial
if (PortalTraverser.i_marker != sector->r_marker && (spatial->spatial.type & STYPE_RENDERABLE) ) continue; // inactive (untouched) sector
if (spatial->spatial.type & STYPE_RENDERABLE)
{
for (u32 v_it=0; v_it<sector->r_frustums.size(); v_it++)
{
set_Frustum (&(sector->r_frustums[v_it]));
if (!View->testSphere_dirty(spatial->spatial.sphere.P,spatial->spatial.sphere.R) /*&& (spatial->spatial.type & STYPE_RENDERABLE)*/) continue;
// renderable
IRenderable* renderable = spatial->dcast_Renderable ();
if (0==renderable) {
// It may be an glow
CGlow* glow = dynamic_cast<CGlow*>(spatial);
VERIFY (glow);
L_Glows->add (glow);
} else {
// Occlusiond
vis_data& v_orig = renderable->renderable.visual->getVisData();
vis_data v_copy = v_orig;
v_copy.box.xform (renderable->renderable.xform);
BOOL bVisible = HOM.visible(v_copy);
v_orig.accept_frame = v_copy.accept_frame;
v_orig.marker = v_copy.marker;
v_orig.hom_frame = v_copy.hom_frame;
v_orig.hom_tested = v_copy.hom_tested;
if (!bVisible) break; // exit loop on frustums
// rendering
if (o_it==uID_LTRACK && renderable->renderable_ROS()) {
// track lighting environment
CROS_impl* T = (CROS_impl*)renderable->renderable_ROS();
T->update (renderable);
}
set_Object (renderable);
renderable->renderable_Render ();
set_Object (0); //? is it needed at all
}
break; // exit loop on frustums
}
}
else
{
if ( ViewBase.testSphere_dirty(spatial->spatial.sphere.P,spatial->spatial.sphere.R) )
{
VERIFY (spatial->spatial.type & STYPE_LIGHTSOURCE);
// lightsource
light* L = (light*) spatial->dcast_Light ();
VERIFY (L);
if (L->spatial.sector) {
vis_data& vis = L->get_homdata ( );
if (HOM.visible(vis)) L_DB->add_light (L);
}
}
}
}
}
// Calculate miscelaneous stuff
L_Shadows->calculate ();
L_Projector->calculate ();
}
else
{
set_Object (0);
/*
g_pGameLevel->pHUD->Render_First ();
g_pGameLevel->pHUD->Render_Last ();
// Calculate miscelaneous stuff
L_Shadows->calculate ();
L_Projector->calculate ();
*/
}
// End calc
Device.Statistic->RenderCALC.End ();
}