void VDebugShadingModes::Init()
{
  Vision::Callbacks.OnAfterSceneLoaded += this;
  Vision::Callbacks.OnBeforeSceneUnloaded += this;

  m_debugShadingEffects.Clear();
  m_spDebugShadingShaderLib = NULL;

  m_spDebugShadingShaderLib = Vision::Shaders.LoadShaderLibrary("Shaders\\DebugShadingEffects.ShaderLib");
  if ((m_spDebugShadingShaderLib == NULL) || (m_spDebugShadingShaderLib && !m_spDebugShadingShaderLib->IsLoaded()))
    return;

  VAppMenu* pMainMenu = GetParent()->GetAppModule<VAppMenu>();
  if (pMainMenu == NULL)
    return;
  
  VAppMenuItems items;

  VisShaderFXLibManager_cl &manager(Vision::Shaders.GetShaderFXLibManager());
  // Enumerate all available effects and add them to a collection for later usage
  for (int i=0;i<m_spDebugShadingShaderLib->m_Effects.Count();i++)
  {
    VCompiledEffect *pFX = m_spDebugShadingShaderLib->m_Effects.GetAt(i)->CompileEffect(NULL, manager.m_ShaderInstances);

    // Skip the "NotAvailable" shader, because it is only used for fallback reasons in vForge
    if ((pFX==NULL) || (pFX && VStringHelper::SafeCompare(pFX->GetSourceEffect()->GetName(), "NotAvailable") == 0))
      continue;

    // Use the effect's same as a description
    pFX->SetUserData((void *)pFX->GetSourceEffect()->GetName());

    int iIndex = m_debugShadingEffects.Add(pFX);
    items.Add(VAppMenuItem(pFX->GetSourceEffect()->GetName(), iIndex, 0, true));
  }
  
  m_callbacks = pMainMenu->RegisterGroup("Debug Shading", items, NULL, VAPP_DEFAULT_SORTING_2, false);
  RegisterCallbacks();
}