Beispiel #1
0
        private JobReferenceCounter <Vector2Int, NativeChunkColumnNoiseMaps> .JobResultPair MakeNoiseJob(Vector2Int columnId)
        {
            float3 worldPos = chunkManager.ChunkToWorldPosition(new Vector3Int(columnId.x, 0, columnId.y));

            var noiseGenJob = new NoiseMapGenerationJob();

            noiseGenJob.worldSettings    = worldSettings;
            noiseGenJob.treeSettings     = treeSettings;
            noiseGenJob.biomeDatabase    = biomeDatabaseComponent.BiomeDatabase;
            noiseGenJob.chunkPositionXZ  = worldPos.xz;
            noiseGenJob.heightmapNoise   = heightmapNoise;
            noiseGenJob.moisturemapNoise = moisturemapNoise;
            noiseGenJob.treemapNoise     = treemapNoise;
            var nativeNoiseMaps = new NativeChunkColumnNoiseMaps(chunkDimensions.x * chunkDimensions.z, Allocator.Persistent);

            noiseGenJob.noiseMaps = nativeNoiseMaps;

            JobHandle handle = default;

            if (Parrallel)
            {
                handle = noiseGenJob.Schedule();
            }
            else
            {
                noiseGenJob.Run();
            }

            return(new JobReferenceCounter <Vector2Int, NativeChunkColumnNoiseMaps> .JobResultPair()
            {
                handle = handle, result = nativeNoiseMaps
            });
        }
Beispiel #2
0
        public NativeChunkColumnNoiseMaps ToNative(Allocator allocator = Allocator.Persistent)
        {
            NativeChunkColumnNoiseMaps native = new NativeChunkColumnNoiseMaps();

            native.heightMap = heightMap.ToNative(allocator);
            native.biomeMap  = biomeMap.ToNative(allocator);
            native.treeMap   = treeMap.ToNative(allocator);
            return(native);
        }
Beispiel #3
0
 public ChunkColumnNoiseMaps(NativeChunkColumnNoiseMaps maps)
 {
     heightMap = maps.heightMap.ToArray();
     biomeMap  = maps.biomeMap.ToArray();
     treeMap   = maps.treeMap.ToArray();
 }