private void InitShadowStencilPass()
{
Material matStencil = MaterialManager.Instance.GetByName(STENCIL_SHADOW_VOLUMES_MATERIAL);
if(matStencil == null) {
// Create
matStencil = (Material)MaterialManager.Instance.Create(STENCIL_SHADOW_VOLUMES_MATERIAL);
shadowStencilPass = matStencil.GetTechnique(0).GetPass(0);
if(targetRenderSystem.Caps.CheckCap(Capabilities.VertexPrograms)) {
// Enable the finite point light extruder for now, just to get some params
shadowStencilPass.SetVertexProgram(
ShadowVolumeExtrudeProgram.GetProgramName(ShadowVolumeExtrudeProgram.Programs.PointLightFinite));
finiteExtrusionParams = shadowStencilPass.VertexProgramParameters;
finiteExtrusionParams.SetAutoConstant(0, AutoConstants.WorldViewProjMatrix);
finiteExtrusionParams.SetAutoConstant(4, AutoConstants.LightPositionObjectSpace);
finiteExtrusionParams.SetAutoConstant(5, AutoConstants.ShadowExtrusionDistance);
}
matStencil.Compile();
// Nothing else, we don't use this like a 'real' pass anyway,
// it's more of a placeholder
}
else {
shadowStencilPass = matStencil.GetTechnique(0).GetPass(0);
}
}