コード例 #1
0
 /// <summary>
 /// Generate the given set of voxeldata at the given location offset
 /// </summary>
 /// <param name="location">The xyz to use as an offset for generating these voxels</param>
 /// <param name="voxelData">The voxel data to populate</param>
 public void generateAllAt(Coordinate location, IVoxelStorage voxelData)
 {
     Coordinate.Zero.until(voxelData.bounds, (coordinate) => {
         VoxelsGenerated++;
         Coordinate globalLocation = coordinate + (location * voxelData.bounds);
         float noiseValue          = getNoiseValueAt(globalLocation);
         Voxel.Type newVoxelType   = getVoxelTypeFor(noiseValue, globalLocation);
         if (newVoxelType != Voxel.Types.Empty)
         {
             voxelData.set(coordinate, newVoxelType);
         }
     });
 }
コード例 #2
0
 /// <summary>
 /// Generate the given set of voxeldata at the given location offset
 /// </summary>
 /// <param name="location">The xyz to use as an offset for generating these voxels</param>
 /// <param name="voxelData">The voxel data to populate</param>
 public void generateAllAt(Coordinate location, IVoxelStorage voxelData)
 {
     isoSurfaceLevel = getIsoSurfaceLevel();
     Coordinate.Zero.until(voxelData.bounds, (coordinate) => {
         VoxelsGenerated++;
         Coordinate globalLocation    = coordinate + (location * voxelData.bounds);
         float isoSurfaceDensityValue = getNoiseValueAt(globalLocation);
         Voxel.Type newVoxelType      = getVoxelTypeFor(isoSurfaceDensityValue);
         if (newVoxelType != Terrain.Types.Air)
         {
             voxelData.set(coordinate, newVoxelType);
         }
     });
 }