2019-09-03 22:54:40 +01:00
|
|
|
#ifndef VOXEL_TOOL_LOD_TERRAIN_H
|
|
|
|
#define VOXEL_TOOL_LOD_TERRAIN_H
|
|
|
|
|
2019-09-05 19:43:25 +01:00
|
|
|
#include "voxel_tool.h"
|
2019-09-03 22:54:40 +01:00
|
|
|
|
2022-01-30 15:21:59 +00:00
|
|
|
class Node;
|
|
|
|
|
2022-01-08 23:04:49 +00:00
|
|
|
namespace zylann::voxel {
|
2022-01-09 22:13:10 +00:00
|
|
|
|
|
|
|
class VoxelLodTerrain;
|
2021-04-03 20:39:37 +01:00
|
|
|
class VoxelDataMap;
|
2019-09-03 22:54:40 +01:00
|
|
|
|
|
|
|
class VoxelToolLodTerrain : public VoxelTool {
|
|
|
|
GDCLASS(VoxelToolLodTerrain, VoxelTool)
|
|
|
|
public:
|
2021-02-21 03:06:40 +00:00
|
|
|
VoxelToolLodTerrain() {}
|
2021-09-17 20:01:15 +01:00
|
|
|
VoxelToolLodTerrain(VoxelLodTerrain *terrain);
|
2019-09-03 22:54:40 +01:00
|
|
|
|
2021-05-31 17:10:54 +01:00
|
|
|
bool is_area_editable(const Box3i &box) const override;
|
2021-02-21 03:06:40 +00:00
|
|
|
Ref<VoxelRaycastResult> raycast(Vector3 pos, Vector3 dir, float max_distance, uint32_t collision_mask) override;
|
|
|
|
|
|
|
|
int get_raycast_binary_search_iterations() const;
|
|
|
|
void set_raycast_binary_search_iterations(int iterations);
|
2019-09-03 22:54:40 +01:00
|
|
|
|
2021-04-25 22:20:05 +01:00
|
|
|
void do_sphere(Vector3 center, float radius) override;
|
2021-10-04 19:20:36 +01:00
|
|
|
void do_sphere_async(Vector3 center, float radius);
|
2021-04-25 22:20:05 +01:00
|
|
|
|
2022-02-15 21:49:20 +00:00
|
|
|
void copy(Vector3i pos, Ref<gd::VoxelBuffer> dst, uint8_t channels_mask) const override;
|
2021-07-10 20:19:44 +01:00
|
|
|
|
2021-07-01 22:44:27 +01:00
|
|
|
// Specialized API
|
|
|
|
|
2021-07-01 23:14:23 +01:00
|
|
|
float get_voxel_f_interpolated(Vector3 position) const;
|
2021-07-11 16:19:49 +01:00
|
|
|
Array separate_floating_chunks(AABB world_box, Node *parent_node);
|
2021-07-01 22:44:27 +01:00
|
|
|
|
2019-09-03 22:54:40 +01:00
|
|
|
protected:
|
2020-12-30 20:09:31 +00:00
|
|
|
uint64_t _get_voxel(Vector3i pos) const override;
|
|
|
|
float _get_voxel_f(Vector3i pos) const override;
|
2020-08-06 19:54:47 +01:00
|
|
|
void _set_voxel(Vector3i pos, uint64_t v) override;
|
2019-09-03 22:54:40 +01:00
|
|
|
void _set_voxel_f(Vector3i pos, float v) override;
|
2021-05-31 17:10:54 +01:00
|
|
|
void _post_edit(const Box3i &box) override;
|
2019-09-03 22:54:40 +01:00
|
|
|
|
|
|
|
private:
|
2021-02-21 03:06:40 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2019-09-03 22:54:40 +01:00
|
|
|
VoxelLodTerrain *_terrain = nullptr;
|
2021-02-21 03:06:40 +00:00
|
|
|
int _raycast_binary_search_iterations = 0;
|
2019-09-03 22:54:40 +01:00
|
|
|
};
|
|
|
|
|
2022-01-09 22:13:10 +00:00
|
|
|
} // namespace zylann::voxel
|
|
|
|
|
2019-09-03 22:54:40 +01:00
|
|
|
#endif // VOXEL_TOOL_LOD_TERRAIN_H
|