public TerrainChunk(Vector3 center, TerrainMaster terrainMaster)
        {
            this.center        = center;
            this.terrainMaster = terrainMaster;

            ThreadWorkManager.RequestWork(Generate);
        }
Beispiel #2
0
    void Start()
    {
        voxelMap = new VoxelMap(width, height);

        ThreadWorkManager.RequestWork(() =>
        {
            GenerateMap();

            SpawnMap();
            SpawnMarchingMap();
        });
    }
    void Start()
    {
        Vector3 playerPosition = playerTransform.position;

        ThreadWorkManager.RequestWork(() => UpdateChunks(playerPosition, visibleChunks));

        chunkMaterial.SetFloat("_SimplexNoiseFrequency", TessellationSimplexNoiseFrequency);
        chunkMaterial.SetFloat("_SimplexNoiseAmplitude", TessellationSimplexNoiseAmplitude);
        foreach (var item in FindObjectsOfType <ColliderGenerator>())
        {
            item.TessellationSimplexNoiseFrequency = TessellationSimplexNoiseFrequency;
            item.TessellationSimplexNoiseAmplitude = TessellationSimplexNoiseAmplitude;
        }
    }
Beispiel #4
0
    void SpawnMarchingMap()
    {
        Vector3Int size = new Vector3Int(Mathf.Min(32, voxelMap.Width),
                                         Mathf.Min(32, voxelMap.Height),
                                         Mathf.Min(32, voxelMap.Depth));

        for (int x = size.x / 2; x <= voxelMap.Width - size.x / 2; x += size.x)
        {
            for (int y = size.y / 2; y <= voxelMap.Height - size.y / 2; y += size.y)
            {
                for (int z = size.z / 2; z <= voxelMap.Depth - size.z / 2; z += size.z)
                {
                    Vector3Int center = new Vector3Int(x, y, z);
                    ThreadWorkManager.RequestWork(() => SpawnMarchingMapChunk(center, size));
                }
            }
        }
    }