public LayerNoise(TomlTable table)
            {
                if (table.TryGetValue("innercolor", out var tomlObject))
                {
                    InnerColor = Color.FromHex(tomlObject.Get <string>());
                }

                if (table.TryGetValue("outercolor", out tomlObject))
                {
                    OuterColor = Color.FromHex(tomlObject.Get <string>());
                }

                if (table.TryGetValue("seed", out tomlObject))
                {
                    Seed = (uint)tomlObject.Get <int>();
                }

                if (table.TryGetValue("persistence", out tomlObject))
                {
                    Persistence = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("lacunarity", out tomlObject))
                {
                    Lacunarity = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("frequency", out tomlObject))
                {
                    Frequency = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("octaves", out tomlObject))
                {
                    Octaves = (uint)tomlObject.Get <int>();
                }

                if (table.TryGetValue("threshold", out tomlObject))
                {
                    Threshold = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("sourcefactor", out tomlObject))
                {
                    SrcFactor = (Color.BlendFactor)Enum.Parse(typeof(Color.BlendFactor), tomlObject.Get <string>());
                }

                if (table.TryGetValue("destfactor", out tomlObject))
                {
                    DstFactor = (Color.BlendFactor)Enum.Parse(typeof(Color.BlendFactor), tomlObject.Get <string>());
                }

                if (table.TryGetValue("power", out tomlObject))
                {
                    Power = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("noise_type", out tomlObject))
                {
                    switch (tomlObject.Get <string>())
                    {
                    case "fbm":
                        NoiseType = NoiseGenerator.NoiseType.Fbm;
                        break;

                    case "ridged":
                        NoiseType = NoiseGenerator.NoiseType.Ridged;
                        break;

                    default:
                        throw new InvalidOperationException();
                    }
                }
            }
            public LayerPoints(TomlTable table)
            {
                if (table.TryGetValue("seed", out var tomlObject))
                {
                    Seed = tomlObject.Get <int>();
                }

                if (table.TryGetValue("count", out tomlObject))
                {
                    PointCount = tomlObject.Get <int>();
                }

                if (table.TryGetValue("sourcefactor", out tomlObject))
                {
                    SrcFactor = (Color.BlendFactor)Enum.Parse(typeof(Color.BlendFactor), tomlObject.Get <string>());
                }

                if (table.TryGetValue("destfactor", out tomlObject))
                {
                    DstFactor = (Color.BlendFactor)Enum.Parse(typeof(Color.BlendFactor), tomlObject.Get <string>());
                }

                if (table.TryGetValue("farcolor", out tomlObject))
                {
                    FarColor = Color.FromHex(tomlObject.Get <string>());
                }

                if (table.TryGetValue("closecolor", out tomlObject))
                {
                    CloseColor = Color.FromHex(tomlObject.Get <string>());
                }

                if (table.TryGetValue("pointsize", out tomlObject))
                {
                    PointSize = tomlObject.Get <int>();
                }

                // Noise mask stuff.
                if (table.TryGetValue("mask", out tomlObject))
                {
                    Masked = tomlObject.Get <bool>();
                }

                if (table.TryGetValue("maskseed", out tomlObject))
                {
                    MaskSeed = (uint)tomlObject.Get <int>();
                }

                if (table.TryGetValue("maskpersistence", out tomlObject))
                {
                    MaskPersistence = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("masklacunarity", out tomlObject))
                {
                    MaskLacunarity = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("maskfrequency", out tomlObject))
                {
                    MaskFrequency = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("maskoctaves", out tomlObject))
                {
                    MaskOctaves = (uint)tomlObject.Get <int>();
                }

                if (table.TryGetValue("maskthreshold", out tomlObject))
                {
                    MaskThreshold = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }

                if (table.TryGetValue("masknoise_type", out tomlObject))
                {
                    switch (tomlObject.Get <string>())
                    {
                    case "fbm":
                        MaskNoiseType = NoiseGenerator.NoiseType.Fbm;
                        break;

                    case "ridged":
                        MaskNoiseType = NoiseGenerator.NoiseType.Ridged;
                        break;

                    default:
                        throw new InvalidOperationException();
                    }
                }

                if (table.TryGetValue("maskpower", out tomlObject))
                {
                    MaskPower = float.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture);
                }
            }