private void RenderAdditiveTextureShadowedQueueGroupObjects( RenderQueueGroup group )
{
LightList tempLightList = new LightList();
foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values )
{
// Sort the queue first
priorityGroup.Sort( this.cameraInProgress );
// Clear light list
tempLightList.Clear();
// Render all the ambient passes first, no light iteration, no lights
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;
// only perform this next part if we're in the 'normal' render stage, to avoid
// doing it during the render to texture
if ( this.illuminationStage == IlluminationRenderStage.None )
{
// Iterate over lights, render masked
int sti = 0;
foreach ( Light light in this.lightsAffectingFrustum )
{
// Set light state
if ( light.CastShadows && sti < this.shadowTextures.Count )
{
Texture shadowTex = this.shadowTextures[ sti ];
// Get camera for current shadow texture
Camera camera = shadowTex.GetBuffer().GetRenderTarget().GetViewport( 0 ).Camera;
// Hook up receiver texture
Pass targetPass = this.shadowTextureCustomReceiverPass != null
? this.shadowTextureCustomReceiverPass
: this.shadowReceiverPass;
targetPass.GetTextureUnitState( 0 ).SetTextureName( shadowTex.Name );
// Hook up projection frustum
targetPass.GetTextureUnitState( 0 ).SetProjectiveTexturing( true, camera );
this.autoParamDataSource.TextureProjector = camera;
// Remove any spot fader layer
if ( targetPass.TextureUnitStageCount > 1 &&
targetPass.GetTextureUnitState( 1 ).TextureName == "spot_shadow_fade.png" )
{
// remove spot fader layer (should only be there if
// we previously used modulative shadows)
targetPass.RemoveTextureUnitState( 1 );
}
// Set lighting / blending modes
targetPass.SetSceneBlending( SceneBlendFactor.One, SceneBlendFactor.One );
targetPass.LightingEnabled = true;
targetPass.Load();
// increment shadow texture since used
++sti;
this.illuminationStage = IlluminationRenderStage.RenderReceiverPass;
}
else
{
this.illuminationStage = IlluminationRenderStage.None;
}
// render lighting passes for this light
tempLightList.Clear();
tempLightList.Add( light );
this.RenderSolidObjects( priorityGroup.solidPassesDiffuseSpecular, false, tempLightList );
} // for each light
this.illuminationStage = IlluminationRenderStage.None;
// Now render decal passes, no need to set lights as lighting will be disabled
this.RenderSolidObjects( priorityGroup.solidPassesDecal, false );
}
} // for each priority
foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values )
{
// Do transparents
this.RenderTransparentObjects( priorityGroup.transparentPasses, true );
} // for each priority
}