sm.voxelTerrainCell

Voxel grid

Constants:

Functions:

  • copyTileCellVoxels
  • copyTileCellVoxelsOnlyAir
  • copyTileCellVoxelsOnlyAirAndMasked
  • copyTileCellVoxelsOnlyFilled
  • fillEmptyConvexHull
  • setDensityConvexHull
  • setMaterialAndDensityConvexHull
  • setMaterialConvexHull
  • writeTileCellVoxels

  • sm.voxelTerrainCell.voxelFilter table

    Filters are used to specify what materials an action should modify.

    none 0
    material0 1
    material1 2
    material2 4
    material3 8
    material4 16
    material5 32
    material6 64
    material7 128
    all 255

    sm.voxelTerrainCell.copyTileCellVoxels(tileUid, cellOffsetX, cellOffsetY, rotationStep, srcPos?, dstPos?, srcSize?)

    Copies a custom amount of voxel data from a tile to the voxel grid.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe tile cell X offset.
    integercellOffsetYThe tile cell Y offset.
    integerrotationStepThe tile rotation (0-3).
    Vec3srcPos?The source chunk coord in the tile cell to copy.
    Vec3dstPos?The destination coord in the cell voxel grid.
    Vec3srcSize?The source size in chunks to copy.

    sm.voxelTerrainCell.copyTileCellVoxelsOnlyAir(tileUid, cellOffsetX, cellOffsetY, rotationStep, srcPos, dstPos, srcSize)

    Copies a custom amount of voxel data from a tile to the voxel grid.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe tile cell X offset.
    integercellOffsetYThe tile cell Y offset.
    integerrotationStepThe tile rotation (0-3).
    Vec3srcPosThe source chunk coord in the tile to copy.
    Vec3dstPosThe destination coord in the cell voxel grid.
    Vec3srcSizeThe source size in chunks to copy.

    sm.voxelTerrainCell.copyTileCellVoxelsOnlyAirAndMasked(tileUid, cellOffsetX, cellOffsetY, rotationStep, srcPos, dstPos, srcSize, voxelFilter)

    Copies a custom amount of voxel data from a tile to the voxel grid.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe tile cell X offset.
    integercellOffsetYThe tile cell Y offset.
    integerrotationStepThe tile rotation (0-3).
    Vec3srcPosThe source chunk coord in the tile to copy.
    Vec3dstPosThe destination coord in the cell voxel grid.
    Vec3srcSizeThe source size in chunks to copy.
    integervoxelFilterThe voxel material filter to be copied. (See sm.voxelTerrainCell.voxelFilter)

    sm.voxelTerrainCell.copyTileCellVoxelsOnlyFilled(tileUid, cellOffsetX, cellOffsetY, rotationStep, srcPos, dstPos, srcSize)

    Copies a custom amount of voxel data from a tile to the voxel grid.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe tile cell X offset.
    integercellOffsetYThe tile cell Y offset.
    integerrotationStepThe tile rotation (0-3).
    Vec3srcPosThe source chunk coord in the tile to copy.
    Vec3dstPosThe destination coord in the cell voxel grid.
    Vec3srcSizeThe source size in chunks to copy.

    sm.voxelTerrainCell.fillEmptyConvexHull(vertices, margin, densityThreshold, material, density, noiseFrequency?, noiseIntensity?)

    Sets empty voxel (below threshold) material and density in convex hull shape in the cell's voxel grid.

    Parameters:

    TypeNameDescription
    tableverticesTable of vertices {Vec3, ...} that make up the convex hull.
    numbermarginHull margin added outside the hull.
    numberdensityThresholdExisting normalized density must be below threshold for fill to happen.
    integermaterialNew material to set in convex hull.
    numberdensityNew normalized density to set in convex hull.
    numbernoiseFrequency?Noise frequency of applied simplex noise. (Defaults to 1)
    numbernoiseIntensity?Noise intensity of applied simplex noise. (Defaults to 0)

    sm.voxelTerrainCell.setDensityConvexHull(vertices, margin, density, voxelFilter?, noiseFrequency?, noiseIntensity?)

    Sets density in convex hull shape to the cell's voxel grid.

    Parameters:

    TypeNameDescription
    tableverticesTable of vertices {Vec3, ...} that make up the convex hull.
    numbermarginHull margin added outside the hull.
    numberdensityNew normalized density.
    integervoxelFilter?The voxel material filter to overwrite. (Defaults to sm.voxelTerrainCell.voxelFilter.all)
    numbernoiseFrequency?Noise frequency of applied simplex noise. (Defaults to 1)
    numbernoiseIntensity?Noise intensity of applied simplex noise. (Defaults to 0)

    sm.voxelTerrainCell.setMaterialAndDensityConvexHull(vertices, margin, material, density, voxelFilter?, noiseFrequency?, noiseIntensity?)

    Sets material in convex hull shape in the cell's voxel grid.

    Parameters:

    TypeNameDescription
    tableverticesTable of vertices {Vec3, ...} that make up the convex hull.
    numbermarginHull margin added outside the hull.
    integermaterialNew material in convex hull.
    numberdensityNew normalized density.
    integervoxelFilter?The voxel material filter to overwrite. (Defaults to sm.voxelTerrainCell.voxelFilter.all)
    numbernoiseFrequency?Noise frequency of applied simplex noise. (Defaults to 1)
    numbernoiseIntensity?Noise intensity of applied simplex noise. (Defaults to 0)

    sm.voxelTerrainCell.setMaterialConvexHull(vertices, margin, material, voxelFilter?, noiseFrequency?, noiseIntensity?)

    Sets material in convex hull shape in the cell's voxel grid.

    Parameters:

    TypeNameDescription
    tableverticesTable of vertices {Vec3, ...} that make up the convex hull.
    numbermarginHull margin added outside the hull.
    integermaterialNew material in convex hull.
    integervoxelFilter?The voxel material filter to overwrite. (Defaults to sm.voxelTerrainCell.voxelFilter.all)
    numbernoiseFrequency?Noise frequency of applied simplex noise. (Defaults to 1)
    numbernoiseIntensity?Noise intensity of applied simplex noise. (Defaults to 0)

    sm.voxelTerrainCell.writeTileCellVoxels(tileUid, cellOffsetX, cellOffsetY, rotationStep)

    Writes the voxel data from a tile to the cell's voxel grid.

    Parameters:

    TypeNameDescription
    UuidtileUidThe tile uuid.
    integercellOffsetXThe tile cell X offset.
    integercellOffsetYThe tile cell Y offset.
    integerrotationStepThe tile rotation (0-3).