godot_voxel/generators/voxel_generator.cpp
Marc Gilleron 4ec60074bb Refactor generators and streams
- VoxelGenerator no longer inherit VoxelStream
- VoxelStream is now more focused on files
- Nodes have separate stream and generator properties
- Generators use 2 dedicated threads instead of sharing a single one with streams
- TODO Image.lock() is problematic for multithreading
- TODO Voxel graph can cause RWLock contention if edited while it runs
- TODO Saving generator output no longer works, need to put it back
2021-01-17 17:18:05 +00:00

25 lines
680 B
C++

#include "voxel_generator.h"
#include "../voxel_string_names.h"
VoxelGenerator::VoxelGenerator() {
}
void VoxelGenerator::generate_block(VoxelBlockRequest &input) {
ERR_FAIL_COND(input.voxel_buffer.is_null());
}
int VoxelGenerator::get_used_channels_mask() const {
return 0;
}
void VoxelGenerator::_b_generate_block(Ref<VoxelBuffer> out_buffer, Vector3 origin_in_voxels, int lod) {
ERR_FAIL_COND(lod < 0);
VoxelBlockRequest r = { out_buffer, Vector3i(origin_in_voxels), lod };
generate_block(r);
}
void VoxelGenerator::_bind_methods() {
ClassDB::bind_method(D_METHOD("generate_block", "out_buffer", "origin_in_voxels", "lod"),
&VoxelGenerator::_b_generate_block);
}