/// <inheritdoc/> public override JobHandleWithData <IVoxelDataGenerationJob> GenerateVoxelData(int3 worldSpaceOrigin, VoxelDataVolume <byte> outputVoxelDataArray) { HeightmapTerrainVoxelDataCalculationJob job = new HeightmapTerrainVoxelDataCalculationJob { WorldPositionOffset = worldSpaceOrigin, OutputVoxelData = outputVoxelDataArray, HeightmapData = heightmapWorldGenerator.HeightmapTerrainSettings.HeightmapData, HeightmapWidth = heightmapWorldGenerator.HeightmapTerrainSettings.Width, HeightmapHeight = heightmapWorldGenerator.HeightmapTerrainSettings.Height, Amplitude = heightmapWorldGenerator.HeightmapTerrainSettings.Amplitude, HeightOffset = heightmapWorldGenerator.HeightmapTerrainSettings.HeightOffset }; JobHandle jobHandle = job.Schedule(); JobHandleWithData <IVoxelDataGenerationJob> jobHandleWithData = new JobHandleWithData <IVoxelDataGenerationJob> { JobHandle = jobHandle, JobData = job }; return(jobHandleWithData); }
/// <summary> /// Starts generating the voxel data for a specified volume /// </summary> /// <param name="bounds">The volume to generate the voxel data for</param> /// <param name="allocator">The allocator for the new <see cref="VoxelDataVolume"/></param> /// <returns>The job handle and the voxel data generation job</returns> public override JobHandleWithData <IVoxelDataGenerationJob> GenerateVoxelData(Bounds bounds, Allocator allocator) { VoxelDataVolume voxelData = new VoxelDataVolume(bounds.size.ToInt3(), allocator); HeightmapTerrainVoxelDataCalculationJob job = new HeightmapTerrainVoxelDataCalculationJob { WorldPositionOffset = bounds.min.ToInt3(), OutputVoxelData = voxelData, HeightmapData = heightmapWorldGenerator.HeightmapTerrainSettings.HeightmapData, HeightmapWidth = heightmapWorldGenerator.HeightmapTerrainSettings.Width, HeightmapHeight = heightmapWorldGenerator.HeightmapTerrainSettings.Height, Amplitude = heightmapWorldGenerator.HeightmapTerrainSettings.Amplitude, HeightOffset = heightmapWorldGenerator.HeightmapTerrainSettings.HeightOffset }; JobHandle jobHandle = job.Schedule(voxelData.Length, 256); JobHandleWithData <IVoxelDataGenerationJob> jobHandleWithData = new JobHandleWithData <IVoxelDataGenerationJob>(); jobHandleWithData.JobHandle = jobHandle; jobHandleWithData.JobData = job; return(jobHandleWithData); }