2019-09-08 11:42:25 -07:00
|
|
|
#ifndef VOXEL_TOOL_TERRAIN_H
|
|
|
|
#define VOXEL_TOOL_TERRAIN_H
|
|
|
|
|
|
|
|
#include "voxel_tool.h"
|
|
|
|
|
|
|
|
class VoxelTerrain;
|
2020-07-28 12:32:33 -07:00
|
|
|
class FuncRef;
|
2019-09-08 11:42:25 -07:00
|
|
|
|
|
|
|
class VoxelToolTerrain : public VoxelTool {
|
|
|
|
GDCLASS(VoxelToolTerrain, VoxelTool)
|
|
|
|
public:
|
2020-07-28 12:32:33 -07:00
|
|
|
VoxelToolTerrain();
|
2020-11-21 10:28:06 -08:00
|
|
|
VoxelToolTerrain(VoxelTerrain *terrain);
|
2019-09-08 11:42:25 -07:00
|
|
|
|
2021-05-31 09:10:54 -07:00
|
|
|
bool is_area_editable(const Box3i &box) const override;
|
2021-05-15 20:29:08 -07:00
|
|
|
Ref<VoxelRaycastResult> raycast(Vector3 p_pos, Vector3 p_dir, float p_max_distance, uint32_t p_collision_mask) override;
|
2019-09-08 11:42:25 -07:00
|
|
|
|
2020-08-10 11:03:01 -07:00
|
|
|
void set_voxel_metadata(Vector3i pos, Variant meta) override;
|
2021-09-09 10:52:00 -07:00
|
|
|
Variant get_voxel_metadata(Vector3i pos) const override;
|
2020-08-10 11:03:01 -07:00
|
|
|
|
2021-09-09 10:52:00 -07:00
|
|
|
void copy(Vector3i pos, Ref<VoxelBuffer> dst, uint8_t channels_mask) const override;
|
2021-09-23 18:09:58 -07:00
|
|
|
void paste(Vector3i pos, Ref<VoxelBuffer> p_voxels, uint8_t channels_mask, bool use_mask, uint64_t mask_value) override;
|
2021-02-21 10:22:40 -08:00
|
|
|
|
2021-05-29 15:28:11 -07:00
|
|
|
void do_sphere(Vector3 center, float radius) override;
|
|
|
|
|
2020-08-10 11:03:01 -07:00
|
|
|
// Specialized API
|
|
|
|
|
2020-07-28 12:32:33 -07:00
|
|
|
void run_blocky_random_tick(AABB voxel_area, int voxel_count, Ref<FuncRef> callback, int block_batch_count) const;
|
2021-06-16 15:31:00 -07:00
|
|
|
void for_each_voxel_metadata_in_area(AABB voxel_area, Ref<FuncRef> callback);
|
2020-07-28 12:32:33 -07:00
|
|
|
|
2019-09-08 11:42:25 -07:00
|
|
|
protected:
|
2020-12-30 12:09:31 -08:00
|
|
|
uint64_t _get_voxel(Vector3i pos) const override;
|
|
|
|
float _get_voxel_f(Vector3i pos) const override;
|
2020-08-06 11:54:47 -07:00
|
|
|
void _set_voxel(Vector3i pos, uint64_t v) override;
|
2019-09-08 11:42:25 -07:00
|
|
|
void _set_voxel_f(Vector3i pos, float v) override;
|
2021-05-31 09:10:54 -07:00
|
|
|
void _post_edit(const Box3i &box) override;
|
2019-09-08 11:42:25 -07:00
|
|
|
|
|
|
|
private:
|
2020-07-28 12:32:33 -07:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2019-09-08 11:42:25 -07:00
|
|
|
VoxelTerrain *_terrain = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VOXEL_TOOL_TERRAIN_H
|