public MyProceduralPlanetCellGenerator(int seed, double density,
            float planetSizeMax, float planetSizeMin,
            float moonSizeMax, float moonSizeMin, MyProceduralWorldModule parent = null)
            : base(2048 * 1000, 250, seed, ((density + 1) / 2) - 1, parent)
        {
            if (planetSizeMax < planetSizeMin)
            {
                var tmp = planetSizeMax;
                planetSizeMax = planetSizeMin;
                planetSizeMin = tmp;
            }

            PLANET_SIZE_MAX = MathHelper.Clamp(planetSizeMax, PLANET_SIZE_MIN_LIMIT, PLANET_SIZE_MAX_LIMIT);
            PLANET_SIZE_MIN = MathHelper.Clamp(planetSizeMin, PLANET_SIZE_MIN_LIMIT, planetSizeMax);

            if (moonSizeMax < moonSizeMin)
            {
                var tmp = moonSizeMax;
                moonSizeMax = moonSizeMin;
                moonSizeMin = tmp;
            }

            MOON_SIZE_MAX = MathHelper.Clamp(moonSizeMax, MOON_SIZE_MIN_LIMIT, MOON_SIZE_MAX_LIMIT);
            MOON_SIZE_MIN = MathHelper.Clamp(moonSizeMin, MOON_SIZE_MIN_LIMIT, moonSizeMax);

            OBJECT_SEED_RADIUS = PLANET_SIZE_MAX / 2.0 * GRAVITY_SIZE_MULTIPLIER + 2 * (MOON_SIZE_MAX / 2.0 * GRAVITY_SIZE_MULTIPLIER + 2 * MOON_DISTANCE_MAX);
            Debug.Assert(OBJECT_SEED_RADIUS < CELL_SIZE / 2);
            AddDensityFunctionFilled(new MyInfiniteDensityFunction(MyRandom.Instance, 1e-3));
        }
Exemplo n.º 2
0
        public MyProceduralPlanetCellGenerator(int seed, double density,
                                               float planetSizeMax, float planetSizeMin,
                                               float moonSizeMax, float moonSizeMin, MyProceduralWorldModule parent = null)
            : base(2048 * 1000, 250, seed, ((density + 1) / 2) - 1, parent)
        {
            if (planetSizeMax < planetSizeMin)
            {
                var tmp = planetSizeMax;
                planetSizeMax = planetSizeMin;
                planetSizeMin = tmp;
            }

            PLANET_SIZE_MAX = MathHelper.Clamp(planetSizeMax, PLANET_SIZE_MIN_LIMIT, PLANET_SIZE_MAX_LIMIT);
            PLANET_SIZE_MIN = MathHelper.Clamp(planetSizeMin, PLANET_SIZE_MIN_LIMIT, planetSizeMax);

            if (moonSizeMax < moonSizeMin)
            {
                var tmp = moonSizeMax;
                moonSizeMax = moonSizeMin;
                moonSizeMin = tmp;
            }

            MOON_SIZE_MAX = MathHelper.Clamp(moonSizeMax, MOON_SIZE_MIN_LIMIT, MOON_SIZE_MAX_LIMIT);
            MOON_SIZE_MIN = MathHelper.Clamp(moonSizeMin, MOON_SIZE_MIN_LIMIT, moonSizeMax);

            OBJECT_SEED_RADIUS = PLANET_SIZE_MAX / 2.0 * GRAVITY_SIZE_MULTIPLIER + 2 * (MOON_SIZE_MAX / 2.0 * GRAVITY_SIZE_MULTIPLIER + 2 * MOON_DISTANCE_MAX);
            Debug.Assert(OBJECT_SEED_RADIUS < CELL_SIZE / 2);
            AddDensityFunctionFilled(new MyInfiniteDensityFunction(MyRandom.Instance, 1e-3));
        }
 protected MyProceduralWorldModule(double cellSize, int radiusMultiplier, int seed, double density, MyProceduralWorldModule parent = null)
 {
     Debug.Assert(cellSize >= 4 * 1024);
     Debug.Assert(parent == null || cellSize < parent.CELL_SIZE);
     CELL_SIZE = cellSize;
     Debug.Assert(radiusMultiplier > 0);
     Debug.Assert(parent == null || radiusMultiplier < parent.RADIUS_MULTIPLIER);
     RADIUS_MULTIPLIER = radiusMultiplier;
     m_seed = seed;
     m_objectDensity = density;
     m_parent = parent;
     if (parent != null)
     {
         parent.m_children.Add(this);
     }
 }
 protected MyProceduralWorldModule(double cellSize, int radiusMultiplier, int seed, double density, MyProceduralWorldModule parent = null)
 {
     Debug.Assert(cellSize >= 4 * 1024);
     Debug.Assert(parent == null || cellSize < parent.CELL_SIZE);
     CELL_SIZE = cellSize;
     Debug.Assert(radiusMultiplier > 0);
     Debug.Assert(parent == null || radiusMultiplier < parent.SCALE);
     SCALE           = radiusMultiplier;
     m_seed          = seed;
     m_objectDensity = density;
     m_parent        = parent;
     if (parent != null)
     {
         parent.m_children.Add(this);
     }
 }
        public MyProceduralAsteroidCellGenerator(int seed, double density, MyProceduralWorldModule parent = null)
            : base(SUBCELLS * SUBCELL_SIZE, 1, seed, density, parent)
        {
            AddDensityFunctionFilled(new MyInfiniteDensityFunction(MyRandom.Instance, 0.003));

            m_seedTypeProbabilitySum = 0;
            foreach (var probability in m_seedTypeProbability.Values)
            {
                m_seedTypeProbabilitySum += probability;
            }
            Debug.Assert(m_seedTypeProbabilitySum != 0);

            m_seedClusterTypeProbabilitySum = 0;
            foreach (var probability in m_seedClusterTypeProbability.Values)
            {
                m_seedClusterTypeProbabilitySum += probability;
            }
            Debug.Assert(m_seedClusterTypeProbabilitySum != 0);
        }
        public MyProceduralAsteroidCellGenerator(int seed, double density, MyProceduralWorldModule parent = null)
            : base(SUBCELLS * SUBCELL_SIZE, 1, seed, density, parent)
        {
            AddDensityFunctionFilled(new MyInfiniteDensityFunction(MyRandom.Instance, 0.003));

            m_seedTypeProbabilitySum = 0;
            foreach (var probability in m_seedTypeProbability.Values)
            {
                m_seedTypeProbabilitySum += probability;
            }
            Debug.Assert(m_seedTypeProbabilitySum != 0);

            m_seedClusterTypeProbabilitySum = 0;
            foreach (var probability in m_seedClusterTypeProbability.Values)
            {
                m_seedClusterTypeProbabilitySum += probability;
            }
            Debug.Assert(m_seedClusterTypeProbabilitySum != 0);
        }
 public MyProceduralPlanetCellGenerator(int seed, double density, MyProceduralWorldModule parent = null)
     : base(512 * 1000, 100, seed, ((density + 1) / 5) - 1, parent)
 {
     Debug.Assert(OBJECT_SEED_RADIUS < CELL_SIZE / 2);
     AddDensityFunctionFilled(new MyInfiniteDensityFunction(MyRandom.Instance, 1e-3));
 }
 public MyProceduralCell(Vector3I cellId, MyProceduralWorldModule module)
 {
     CellId = cellId;
     BoundingVolume = new BoundingBoxD(CellId * module.CELL_SIZE, (CellId + 1) * module.CELL_SIZE);
 }
 public MyProceduralCell(Vector3I cellId, MyProceduralWorldModule module)
 {
     CellId         = cellId;
     BoundingVolume = new BoundingBoxD(CellId * module.CELL_SIZE, (CellId + 1) * module.CELL_SIZE);
 }
 public MyProceduralPlanetCellGenerator(int seed, double density, MyProceduralWorldModule parent = null)
     : base(512 * 1000, 100, seed, ((density + 1) / 5) - 1, parent)
 {
     Debug.Assert(OBJECT_SEED_RADIUS < CELL_SIZE / 2);
     AddDensityFunctionFilled(new MyInfiniteDensityFunction(MyRandom.Instance, 1e-3));
 }