Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
Put back the old patented "Carmack's Reverse" depth fail stencil shadow
Browse files Browse the repository at this point in the history
technique.
  • Loading branch information
ljbade committed Nov 25, 2011
1 parent b27d997 commit d4de024
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions neo/renderer/draw_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

/*
Expand Down

0 comments on commit d4de024

Please sign in to comment.