protected virtual void RenderAdditiveStencilShadowedQueueGroupObjects( RenderQueueGroup group )
{
LightList tempLightList = new LightList();
foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values )
{
// sort the group first
priorityGroup.Sort( this.cameraInProgress );
// Clear light list
tempLightList.Clear();
// Render all the ambient passes first, no light iteration, no lights
this.illuminationStage = IlluminationRenderStage.Ambient;
this.RenderSolidObjects( priorityGroup.solidPasses, false, tempLightList );
// Also render any objects which have receive shadows disabled
this.renderingNoShadowQueue = true;
this.RenderSolidObjects( priorityGroup.solidPassesNoShadow, true );
this.renderingNoShadowQueue = false;
// Now iterate per light
this.illuminationStage = IlluminationRenderStage.PerLight;
foreach ( Light light in lightsAffectingFrustum )
{
// Set light state
if ( light.CastShadows )
{
// Clear stencil
this.targetRenderSystem.ClearFrameBuffer( FrameBufferType.Stencil );
this.RenderShadowVolumesToStencil( light, this.cameraInProgress );
// turn stencil check on
this.targetRenderSystem.StencilCheckEnabled = true;
// NB we render where the stencil is equal to zero to render lit areas
this.targetRenderSystem.SetStencilBufferParams( CompareFunction.Equal, 0 );
}
// render lighting passes for this light
tempLightList.Clear();
tempLightList.Add( light );
this.RenderSolidObjects( priorityGroup.solidPassesDiffuseSpecular, false, tempLightList );
// Reset stencil params
this.targetRenderSystem.SetStencilBufferParams();
this.targetRenderSystem.StencilCheckEnabled = false;
this.targetRenderSystem.SetDepthBufferParams();
} // for each light
// Now render decal passes, no need to set lights as lighting will be disabled
this.illuminationStage = IlluminationRenderStage.Decal;
this.RenderSolidObjects( priorityGroup.solidPassesDecal, false );
} // for each priority
// reset lighting stage
this.illuminationStage = IlluminationRenderStage.None;
// Iterate again
foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values )
{
// Do transparents
this.RenderTransparentObjects( priorityGroup.transparentPasses, true );
} // for each priority
}