godot_voxel/terrain/voxel_node.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

45 lines
1.2 KiB
C++

#ifndef VOXEL_NODE_H
#define VOXEL_NODE_H
#include <scene/3d/spatial.h>
class VoxelMesher;
class VoxelStream;
class VoxelGenerator;
// Base class for voxel volumes
class VoxelNode : public Spatial {
GDCLASS(VoxelNode, Spatial)
public:
virtual void set_mesher(Ref<VoxelMesher> mesher);
virtual Ref<VoxelMesher> get_mesher() const;
virtual void set_stream(Ref<VoxelStream> stream);
virtual Ref<VoxelStream> get_stream() const;
virtual void set_generator(Ref<VoxelGenerator> generator);
virtual Ref<VoxelGenerator> get_generator() const;
virtual void restart_stream();
virtual void remesh_all_blocks();
String get_configuration_warning() const override;
protected:
int get_used_channels_mask() const;
private:
Ref<VoxelMesher> _b_get_mesher() { return get_mesher(); }
void _b_set_mesher(Ref<VoxelMesher> mesher) { set_mesher(mesher); }
Ref<VoxelStream> _b_get_stream() { return get_stream(); }
void _b_set_stream(Ref<VoxelStream> stream) { set_stream(stream); }
Ref<VoxelGenerator> _b_get_generator() { return get_generator(); }
void _b_set_generator(Ref<VoxelGenerator> g) { set_generator(g); }
static void _bind_methods();
};
#endif // VOXEL_NODE_H