public void OnShadersReloaded()
 {
     FreeMaterials();
     foreach (Element element in ElementLoader.elements)
     {
         if (element.IsSolid)
         {
             if ((UnityEngine.Object)element.substance.material == (UnityEngine.Object)null)
             {
                 DebugUtil.LogErrorArgs(element.name, "must have material associated with it in the substance table");
             }
             Material material = new Material(element.substance.material);
             InitOpaqueMaterial(material, element);
             Material material2 = new Material(material);
             InitAlphaMaterial(material2, element);
             Materials value = new Materials(material, material2);
             elementMaterials[element.id] = value;
         }
     }
     if (worldChunks != null)
     {
         for (int i = 0; i < dirtyChunks.GetLength(1); i++)
         {
             for (int j = 0; j < dirtyChunks.GetLength(0); j++)
             {
                 dirtyChunks[j, i] = true;
             }
         }
         WorldChunk[,] array = worldChunks;
         int length  = array.GetLength(0);
         int length2 = array.GetLength(1);
         for (int k = 0; k < length; k++)
         {
             for (int l = 0; l < length2; l++)
             {
                 WorldChunk worldChunk = array[k, l];
                 worldChunk.Clear();
                 worldChunk.Rebuild(biomeMasks, elementMaterials);
             }
         }
     }
 }