protected virtual void RenderModulativeStencilShadowedQueueGroupObjects( RenderQueueGroup group )
{
/* For each light, we need to render all the solids from each group,
then do the modulative shadows, then render the transparents from
each group.
Now, this means we are going to reorder things more, but that it required
if the shadows are to look correct. The overall order is preserved anyway,
it's just that all the transparents are at the end instead of them being
interleaved as in the normal rendering loop.
*/
foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values )
{
// sort the group first
priorityGroup.Sort( this.cameraInProgress );
// do solids
this.RenderSolidObjects( priorityGroup.solidPasses, true );
}
// iterate over lights, rendering all volumes to the stencil buffer
foreach ( Light light in this.lightsAffectingFrustum )
{
if ( light.CastShadows )
{
// clear the stencil buffer
this.targetRenderSystem.ClearFrameBuffer( FrameBufferType.Stencil );
this.RenderShadowVolumesToStencil( light, this.cameraInProgress );
// render full-screen shadow modulator for all lights
this.SetPass( this.shadowModulativePass );
// turn the stencil check on
this.targetRenderSystem.StencilCheckEnabled = true;
// we render where the stencil is not equal to zero to render shadows, not lit areas
this.targetRenderSystem.SetStencilBufferParams( CompareFunction.NotEqual, 0 );
this.RenderSingleObject( this.fullScreenQuad, this.shadowModulativePass, false );
// reset stencil buffer params
this.targetRenderSystem.SetStencilBufferParams();
this.targetRenderSystem.StencilCheckEnabled = false;
this.targetRenderSystem.SetDepthBufferParams();
}
} // for each light
foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values )
{
// Do non-shadowable solids
this.renderingNoShadowQueue = true;
this.RenderSolidObjects( priorityGroup.solidPassesNoShadow, true );
this.renderingNoShadowQueue = false;
} // for each priority
foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values )
{
// Do transparents
this.RenderTransparentObjects( priorityGroup.transparentPasses, true );
} // for each priority
}