строительные советы https://tvorim-sami.ru/.

void StencilSubScene :: render ( Views view, const Cameras
camera, const Frustrums viewFrustrum, Arrays post ) const
{
Polygon3D tempPoly ( "tempPoly", MAX_VERTICES );
view.lock ();
view.apply ( camera ) ;
int sTest = gllsEnabled ( GL_STENCIL_TEST );
setDefaultStencilOpAndFunc ();
// render opaque polygons, clipping them // via stencil buffer for ( Array :: Iterator it = opaqueFaces.getlterator (); lit.end (); ++it )
{
Polygon3D * poly = (Polygon3D *) it.value ();
if ( !poly -> isFrontFacing ( camera.getPos () ) ) continue;

Добавляем эффекты

if ( poly -> testFlag ( PF_PORTAL ) ) continue;
// if not outside of viewing frustrum then // draw it if ( viewFrustrum.contains ( poly ->
getBoundingBox () ) ) renderPoly ( view, camera, poly, tempPoly, viewFrustrum, post );
}
i f ( sky != NULL )
sky -> draw ( camera );
// now render portals and mirrors for ( it = opaqueFaces.getlterator (); lit.end (); ++it ) {
Polygon3D * poly = (Polygon3D *) it.value ();
if ( Ipoly -> isFrontFacing ( camera.getPos () ) ) continue;
if ( Ipoly -> testFlag ( PF_PORTAL ) ) continue;
tempPoly = *poly; // copy current poly to temp poly
// clip against view frustrum if ( !tempPoly.clipByFrustrum ( viewFrustrum ) ) continue;
// now draw portal to stencil using inc op drawToStencil ( tempPoly );
curStencilVal++;
setDefaultStencilOpAndFunc ();
// for floater clear depth if ( poly -> testFlag ( PF_FLOATING ) ) clearDepth ( camera, tempPoly );
// now render adjacent subscene renderPoly ( view, camera, poly, tempPoly, viewFrustrum, post, ob );
// for floaters and mirrors set depth // to that of portal if ( poly -> testFlag (PF_FLOATING) || poly -"> testFlag (PF_MIRROR) ) setDepth ( tempPoly );
// restore stencil using dec op restoreStencil ( tempPoly );
curStencilVal--;
setDefaultStencilOpAndFunc ();
}
// now render opaque objects for ( it = objects.getlterator (); lit.end (); ++it ) {

⇐ Предыдущая| |Следующая ⇒