godot_voxel/generators/voxel_generator.h
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

27 lines
669 B
C++

#ifndef VOXEL_GENERATOR_H
#define VOXEL_GENERATOR_H
#include "../streams/voxel_block_request.h"
#include <core/resource.h>
// Provides access to read-only generated voxels.
// Must be implemented in a multi-thread-safe way.
class VoxelGenerator : public Resource {
GDCLASS(VoxelGenerator, Resource)
public:
VoxelGenerator();
virtual void generate_block(VoxelBlockRequest &input);
// TODO Single sample
// Declares the channels this generator will use
virtual int get_used_channels_mask() const;
protected:
static void _bind_methods();
void _b_generate_block(Ref<VoxelBuffer> out_buffer, Vector3 origin_in_voxels, int lod);
};
#endif // VOXEL_GENERATOR_H