public MyCompositeNoise(int numNoises,float startFrequency)
        {
            m_numNoises = numNoises;
            m_noises = new IMyModule[m_numNoises];
            m_amplitudeScales = new float[m_numNoises];
            m_normalizationFactor = 2.0f - 1.0f / (float)Math.Pow(2, m_numNoises - 1);

            float frequency = startFrequency;
            for (int i = 0; i < m_numNoises; ++i)
            {
                m_amplitudeScales[i] = 1.0f / (float)Math.Pow(2.0f, i);
                m_noises[i] = new MyRidgedMultifractalFast(MyNoiseQuality.Low, 1, seed: MyRandom.Instance.Next(), frequency: frequency); //MySimplexFast(seed: MyRandom.Instance.Next(), frequency: frequency);
                frequency *= 2.01f;
            }

        }
Esempio n. 2
0
        public MyCompositeNoise(int numNoises, float startFrequency)
        {
            m_numNoises           = numNoises;
            m_noises              = new IMyModule[m_numNoises];
            m_amplitudeScales     = new float[m_numNoises];
            m_normalizationFactor = 2.0f - 1.0f / (float)Math.Pow(2, m_numNoises - 1);

            float frequency = startFrequency;

            for (int i = 0; i < m_numNoises; ++i)
            {
                m_amplitudeScales[i] = 1.0f / (float)Math.Pow(2.0f, i);
                m_noises[i]          = new MyRidgedMultifractalFast(MyNoiseQuality.Low, 1, seed: MyRandom.Instance.Next(), frequency: frequency); //MySimplexFast(seed: MyRandom.Instance.Next(), frequency: frequency);
                frequency           *= 2.01f;
            }
        }
        public MyPlanetDetailModulator(MyPlanetGeneratorDefinition planetDefinition, MyPlanetMaterialProvider oreDeposit, int seed, float radius)
        {
            m_planetDefinition = planetDefinition;
            m_oreDeposit = oreDeposit;
            m_radius = radius;

            foreach (var distortionDefinition in m_planetDefinition.DistortionTable)
            {
                MyModuleFast modulator = null;

                float frequency = distortionDefinition.Frequency;
                frequency *= radius / 6.0f;

                switch (distortionDefinition.Type)
                {
                    case "Billow":
                        {
                            modulator = new MyBillowFast(
                            seed: seed,
                            quality: MyNoiseQuality.High,
                            frequency: frequency,
                            layerCount: distortionDefinition.LayerCount);
                        }
                        break;
                    case "RidgedMultifractal":
                        {
                            modulator = new MyRidgedMultifractalFast(
                            seed: seed,
                            quality: MyNoiseQuality.High,
                            frequency: frequency,
                            layerCount: distortionDefinition.LayerCount);
                        }
                        break;
                    case "Perlin":
                        {
                            modulator = new MyPerlinFast(
                            seed: seed,
                            quality: MyNoiseQuality.High,
                            frequency: frequency,
                            octaveCount: distortionDefinition.LayerCount);
                        }
                        break;
                    case "Simplex":
                        {
                            modulator = new MySimplexFast()
                            {
                                Seed = seed,
                                Frequency = frequency,
                            };
                        }
                        break;

                    default:
                        System.Diagnostics.Debug.Fail("Unknown modulator type!");
                        break;
                }

                if (modulator != null)
                {
                    m_modulators.Add(distortionDefinition.Value, 
                        new MyModulatorData()
                        {
                            Height = distortionDefinition.Height,
                            Modulator = modulator
                        }                        
                        );
                }
            }
        }