public void LoadXMLInResources(string xmlPath, string regionMapFolder, SimplexNoise noise, System.Random rand)
    {
        TextAsset xmlResource = Resources.Load(xmlPath) as TextAsset;

        XmlSerializer serializer = new XmlSerializer(typeof(VoxelPaintXML.rootCLS));
        StringReader  reader     = new StringReader(xmlResource.text);

        if (null == reader)
        {
            return;
        }

        prms = (VoxelPaintXML.rootCLS)serializer.Deserialize(reader);
        reader.Close();
        Grad1000ToTanAndSetHeight();

        //SetPlantHeight();
        //SetTerrainTextureHeight();

        Texture2D terrainSectionsMap = Resources.Load(regionMapFolder + prms.regionsMap) as Texture2D;

        if (terrainSectionsMap != null)
        {
            terrainSectionsMapW = terrainSectionsMap.width;
            //terrainSectionsMapH = terrainSectionsMap.height;
            terrainSectionsCols32 = terrainSectionsMap.GetPixels32();
        }
        else
        {
            terrainSectionsCols32 = null;
            Debug.LogWarning("VoxelPaintXMLParser: No sectionmap found.");
        }
        curRegion   = prms.RegionDescArrayValues[0];
        curHeight   = curRegion.HeightDescArrayValues[0];
        curGradient = curHeight.GradientDescArrayValues[0];
        defType     = 3;
        myNoise     = noise;
        myRand      = rand;
    }
    // Load XML
#if UNITY_EDITOR
    public void LoadXMLAtPath(string xmlPath = "Assets/Editor/EditorAssets/paintVxMat.xml", string regionMapFolder = "Assets/Editor/EditorAssets/")
    {
        TextAsset    xmlResource = UnityEditor.AssetDatabase.LoadAssetAtPath(xmlPath, typeof(TextAsset)) as TextAsset;
        StringReader reader      = new StringReader(xmlResource.text);

        if (null == reader)
        {
            return;
        }

        XmlSerializer serializer = new XmlSerializer(typeof(VoxelPaintXML.rootCLS));

        prms = (VoxelPaintXML.rootCLS)serializer.Deserialize(reader);
        reader.Close();
        Grad1000ToTan();

        Texture2D terrainSectionsMap = UnityEditor.AssetDatabase.LoadAssetAtPath(regionMapFolder + prms.regionsMap, typeof(Texture2D)) as Texture2D;

        if (terrainSectionsMap != null)
        {
            terrainSectionsMapW = terrainSectionsMap.width;
            //terrainSectionsMapH = terrainSectionsMap.height;
            terrainSectionsCols32 = terrainSectionsMap.GetPixels32();
        }
        else
        {
            terrainSectionsCols32 = null;
            Debug.LogWarning("VoxelPaintXMLParser: No sectionmap found.");
        }
        curRegion   = prms.RegionDescArrayValues[0];
        curHeight   = curRegion.HeightDescArrayValues[0];
        curGradient = curHeight.GradientDescArrayValues[0];
        defType     = 3;
        myNoise     = new SimplexNoise();
        myRand      = new System.Random(0);
    }