Example #1
0
/*
* R_DrawPortals
*/
void R_DrawPortals( void )
{
	unsigned int i;

	if( rf.viewcluster == -1 ) {
		return;
	}

	if( !( rn.renderFlags & ( RF_MIRRORVIEW|RF_PORTALVIEW|RF_SHADOWMAPVIEW ) ) ) {
		R_DrawPortalsDepthMask();

		// render skyportal
		if( rn.skyportalSurface ) {
			portalSurface_t *ps = rn.skyportalSurface;
			R_DrawSkyportal( ps->entity, ps->skyPortal );
		}
		
		// render regular portals
		for( i = 0; i < rn.numPortalSurfaces; i++ ) {
			portalSurface_t ps = rn.portalSurfaces[i];
			if( !ps.skyPortal ) {
				R_DrawPortalSurface( &ps );
				rn.portalSurfaces[i] = ps;
			}
		}
	}
}
Example #2
0
/*
* R_DrawPortals
*/
void R_DrawPortals( void ) {
	unsigned int i;

	if( rn.renderFlags & RF_SKYSHADOWVIEW ) {
		// render depth mask for skylights
		// TODO: rewrite this!
		float depthmin, depthmax;

		RB_GetDepthRange( &depthmin, &depthmax );

		RB_ClearDepth( depthmin );

		RB_Clear( GL_DEPTH_BUFFER_BIT, 0, 0, 0, 0 );

		if( rn.portalmasklist && rn.portalmasklist->numDrawSurfs ) {
			RB_SetShaderStateMask( ~0, GLSTATE_DEPTHWRITE | GLSTATE_NO_COLORWRITE | GLSTATE_OFFSET_FILL | GLSTATE_DEPTHFUNC_GT );
			RB_FlipFrontFace();
			RB_DepthRange( depthmax, depthmax );
			R_DrawPortalSurfaces( rn.portalmasklist );
			RB_SetShaderStateMask( ~0, GLSTATE_DEPTHWRITE | GLSTATE_NO_COLORWRITE | GLSTATE_OFFSET_FILL );
			RB_FlipFrontFace();
			RB_DepthRange( depthmin, depthmax );
		}

		RB_ClearDepth( depthmax );

		return;
	}

	if( rn.renderFlags & ( RF_MIRRORVIEW | RF_LIGHTVIEW | RF_PORTALVIEW ) ) {
		return;
	}
	if( rn.viewcluster == -1 ) {
		return;
	}

	R_DrawPortalsDepthMask();

	if( rn.skyportalSurface ) {
		// render skyportal
		portalSurface_t *ps = rn.skyportalSurface;
		R_DrawSkyportal( ps->entity, ps->skyPortal );
	} else {
		// FIXME: move this?
		// render sky dome that writes to depth
		R_DrawDepthSkySurf();
	}

	// render regular portals
	for( i = 0; i < rn.numPortalSurfaces; i++ ) {
		portalSurface_t ps = rn.portalSurfaces[i];
		if( !ps.skyPortal ) {
			R_DrawPortalSurface( &ps );
			rn.portalSurfaces[i] = ps;
		}
	}
}