Inherits: Resource

Implements loading and saving voxel blocks, mainly using files.


Type Name Default
bool save_generator_output false


Return Signature
int emerge_block ( VoxelBuffer out_buffer, Vector3 origin_in_voxels, int lod )
Vector3 get_block_size ( ) const
int get_used_channels_mask ( ) const
void immerge_block ( VoxelBuffer buffer, Vector3 origin_in_voxels, int lod )
int load_voxel_block ( VoxelBuffer out_buffer, Vector3i origin_in_voxels, int lod )
void save_voxel_block ( VoxelBuffer buffer, Vector3i origin_in_voxels, int lod )


enum ResultCode:

  • RESULT_ERROR = 0 --- An error occurred when loading the block. The request will be aborted.
  • RESULT_BLOCK_FOUND = 2 --- The block was found.
  • RESULT_BLOCK_NOT_FOUND = 1 --- The block was not found. The requester may fallback on using the generator, if any.

Property Descriptions

  • bool save_generator_output = false

When this is enabled, if a block cannot be found in the stream and it gets generated, then the generated block will immediately be saved into the stream. This can be used if the generator is too expensive to run on the fly (like Minecraft does), but it will require more disk usage (amount of I/Os and space) and eventual network traffic. If this setting is off, only modified blocks will be saved.

Method Descriptions

buffer: Block of voxels to save. It is strongly recommended to not keep a reference to that data afterward, because streams are allowed to cache it, and saved data must represent either snapshots (copies) or last references to the data after the volume they belonged to is destroyed.

Generated on Sep 12, 2023