本文整理汇总了C++中ISpatial::dcast_Renderable方法的典型用法代码示例。如果您正苦于以下问题:C++ ISpatial::dcast_Renderable方法的具体用法?C++ ISpatial::dcast_Renderable怎么用?C++ ISpatial::dcast_Renderable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISpatial
的用法示例。
在下文中一共展示了ISpatial::dcast_Renderable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translateSector
//.........这里部分代码省略.........
set_Object (0);
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
{
示例2: inactive
// sub-space rendering - main procedure
void R_dsgraph_structure::r_dsgraph_render_subspace (IRender_Sector* _sector, CFrustum* _frustum, Fmatrix& mCombined, Fvector& _cop, BOOL _dynamic, BOOL _precise_portals)
{
VERIFY (_sector);
RImplementation.marker ++; // !!! critical here
// Save and build new frustum, disable HOM
CFrustum ViewSave = ViewBase;
ViewBase = *_frustum;
View = &ViewBase;
if (_precise_portals && RImplementation.rmPortals) {
// Check if camera is too near to some portal - if so force DualRender
Fvector box_radius; box_radius.set (EPS_L*20,EPS_L*20,EPS_L*20);
RImplementation.Sectors_xrc.box_options (CDB::OPT_FULL_TEST);
RImplementation.Sectors_xrc.box_query (RImplementation.rmPortals,_cop,box_radius);
for (int K=0; K<RImplementation.Sectors_xrc.r_count(); K++)
{
CPortal* pPortal = (CPortal*) RImplementation.Portals[RImplementation.rmPortals->get_tris()[RImplementation.Sectors_xrc.r_begin()[K].id].dummy];
pPortal->bDualRender = TRUE;
}
}
// Traverse sector/portal structure
PortalTraverser.traverse ( _sector, ViewBase, _cop, mCombined, 0 );
// Determine visibility for static geometry hierrarhy
for (u32 s_it=0; s_it<PortalTraverser.r_sectors.size(); s_it++)
{
CSector* sector = (CSector*)PortalTraverser.r_sectors[s_it];
IRender_Visual* root = sector->root();
for (u32 v_it=0; v_it<sector->r_frustums.size(); v_it++) {
set_Frustum (&(sector->r_frustums[v_it]));
add_Geometry (root);
}
}
if (_dynamic)
{
set_Object (0);
// Traverse object database
g_SpatialSpace->q_frustum
(
lstRenderables,
ISpatial_DB::O_ORDERED,
STYPE_RENDERABLE,
ViewBase
);
// Determine visibility for dynamic part of scene
for (u32 o_it=0; o_it<lstRenderables.size(); o_it++)
{
ISpatial* spatial = lstRenderables[o_it];
CSector* sector = (CSector*)spatial->spatial.sector;
if (0==sector) continue; // disassociated from S/P structure
if (PortalTraverser.i_marker != sector->r_marker) continue; // inactive (untouched) sector
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)) continue;
// renderable
IRenderable* renderable = spatial->dcast_Renderable ();
if (0==renderable) continue; // unknown, but renderable object (r1_glow???)
renderable->renderable_Render ();
}
}
}
// Restore
ViewBase = ViewSave;
View = 0;
}