Beispiel #1
0
    public void GenerateObjects(float[,] heightMap, MapGenerator mapGenerator)
    {
        prng = new System.Random(mapGenerator.seed);
        this.mapGenerator = mapGenerator;
        int chunkCount = mapGenerator.mapSizeX * mapGenerator.mapSizeY;

        LOD = MapGenerator.LOD;

        int width  = heightMap.GetLength(0);
        int height = heightMap.GetLength(1);
        Dictionary <int, List <Vector2> > objectsMap = new Dictionary <int, List <Vector2> >();

        for (int i = 0; i < objects.Count; i++)
        {
            objectsMap.Add(i, PoissonDiskSampling.GeneratePoints(mapGenerator.seed, width, height, LOD, chunkCount, objects[i].spawnRadius, objects[i].spawnIterationCount));
            SpawnObjects(objectsMap[i], objects[i], heightMap);
        }
    }
Beispiel #2
0
 void OnValidate()
 {
     points = PoissonDiskSampling.GeneratePoints(radius, regionSize, rejectionSamples);
 }