private void InitShadowDebugPass()
{
Material matDebug = (Material)MaterialManager.Instance[ SHADOW_VOLUMES_MATERIAL ];
if ( matDebug == null )
{
// Create
matDebug =
(Material)
MaterialManager.Instance.Create( SHADOW_VOLUMES_MATERIAL,
ResourceGroupManager.InternalResourceGroupName );
this.shadowDebugPass = matDebug.GetTechnique( 0 ).GetPass( 0 );
this.shadowDebugPass.SetSceneBlending( SceneBlendType.Add );
this.shadowDebugPass.LightingEnabled = false;
this.shadowDebugPass.DepthWrite = false;
TextureUnitState t = this.shadowDebugPass.CreateTextureUnitState();
t.SetColorOperationEx(
LayerBlendOperationEx.Modulate,
LayerBlendSource.Manual,
LayerBlendSource.Current,
new ColorEx( 0.7f, 0.0f, 0.2f ) );
this.shadowDebugPass.CullingMode = CullingMode.None;
if ( this.targetRenderSystem.Capabilities.HasCapability( Capabilities.VertexPrograms ) )
{
ShadowVolumeExtrudeProgram.Initialize();
// Enable the (infinite) point light extruder for now, just to get some params
this.shadowDebugPass.SetVertexProgram(
ShadowVolumeExtrudeProgram.GetProgramName( ShadowVolumeExtrudeProgram.Programs.PointLight ) );
this.infiniteExtrusionParams = this.shadowDebugPass.VertexProgramParameters;
this.infiniteExtrusionParams.SetAutoConstant( 0, GpuProgramParameters.AutoConstantType.WorldViewProjMatrix );
this.infiniteExtrusionParams.SetAutoConstant( 4, GpuProgramParameters.AutoConstantType.LightPositionObjectSpace );
// Note ignored extra parameter - for compatibility with finite extrusion vertex program
this.infiniteExtrusionParams.SetAutoConstant( 5, GpuProgramParameters.AutoConstantType.ShadowExtrusionDistance );
}
matDebug.Compile();
}
else
{
this.shadowDebugPass = matDebug.GetTechnique( 0 ).GetPass( 0 );
if ( this.targetRenderSystem.Capabilities.HasCapability( Capabilities.VertexPrograms ) )
{
this.infiniteExtrusionParams = this.shadowDebugPass.VertexProgramParameters;
}
}
}