#ifndef VOXEL_TOOL_TERRAIN_H #define VOXEL_TOOL_TERRAIN_H #include "voxel_tool.h" class VoxelTerrain; class VoxelLibrary; namespace zylann::voxel { class VoxelDataMap; } class VoxelToolTerrain : public VoxelTool { GDCLASS(VoxelToolTerrain, VoxelTool) public: VoxelToolTerrain(); VoxelToolTerrain(VoxelTerrain *terrain); bool is_area_editable(const Box3i &box) const override; Ref raycast( Vector3 p_pos, Vector3 p_dir, float p_max_distance, uint32_t p_collision_mask) override; void set_voxel_metadata(Vector3i pos, Variant meta) override; Variant get_voxel_metadata(Vector3i pos) const override; void copy(Vector3i pos, Ref dst, uint8_t channels_mask) const override; void paste(Vector3i pos, Ref p_voxels, uint8_t channels_mask, bool use_mask, uint64_t mask_value) override; void do_sphere(Vector3 center, float radius) override; // Specialized API void run_blocky_random_tick( AABB voxel_area, int voxel_count, const Callable &callback, int block_batch_count) const; // For easier unit testing (the regular one needs a terrain setup etc, harder to test atm) // The `_static` suffix is because it otherwise conflicts with the non-static method when registering the class static void run_blocky_random_tick_static(zylann::voxel::VoxelDataMap &map, Box3i voxel_box, const VoxelLibrary &lib, int voxel_count, int batch_count, void *callback_data, bool (*callback)(void *, Vector3i, int64_t)); void for_each_voxel_metadata_in_area(AABB voxel_area, const Callable &callback); protected: uint64_t _get_voxel(Vector3i pos) const override; float _get_voxel_f(Vector3i pos) const override; void _set_voxel(Vector3i pos, uint64_t v) override; void _set_voxel_f(Vector3i pos, float v) override; void _post_edit(const Box3i &box) override; private: static void _bind_methods(); VoxelTerrain *_terrain = nullptr; }; #endif // VOXEL_TOOL_TERRAIN_H