Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Put back the old patented "Carmack's Reverse" depth fail stencil shadow
technique.
  • Loading branch information
ljbade committed Nov 25, 2011
1 parent b27d997 commit d4de024341e79e0ac1dfb54fb528859f8ccea605
Showing 1 changed file with 26 additions and 0 deletions.
@@ -1143,6 +1143,8 @@ static void RB_T_Shadow( const drawSurf_t *surf ) {
return;
}

#if 0 // LEITH: the original patent free "preload" code

// patent-free work around
if ( !external ) {
// "preload" the stencil buffer with the number of volumes
@@ -1163,6 +1165,30 @@ static void RB_T_Shadow( const drawSurf_t *surf ) {
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilDecr );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );

#else // LEITH: the patented "Carmack's Reverse" code

// patented depth-fail stencil shadows
if ( !external ) {
qglStencilOp( GL_KEEP, tr.stencilDecr, GL_KEEP );
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
qglStencilOp( GL_KEEP, tr.stencilIncr, GL_KEEP );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
// traditional depth-pass stencil shadows
else {
qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilIncr );
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );

qglStencilOp( GL_KEEP, GL_KEEP, tr.stencilDecr );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}

#endif
}

/*

0 comments on commit d4de024

Please sign in to comment.