/// <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); } }); }
/// <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); } }); }
/// <summary> /// Overwrite the entire voxel at the given location /// </summary> /// <param name="location">the x,y,z of the voxel to set</param> /// <param name="newVoxelType">the new type to set for the given voxel</param> public void set(Coordinate location, Voxel.Type newVoxelType) { set(location, newVoxelType.Id); }
public void SetVoxel(Pos pos, Voxel.Type type, Color32 color) { SetVoxel(pos.x, pos.y, pos.z, type, color); }
public void SetVoxel(int x, int y, int z, Voxel.Type type, Color32 color) { voxels[x, y, z].type = type; voxels[x, y, z].color = color; }
public void SetVoxel(Pos pos, Voxel.Type type, Color32 color) { // colorTexture.AddColor(color); chunk.SetVoxel(pos, type, color); Refresh(); }