2020-02-13 00:48:18 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-08-10 21:15:37 +01:00
<class name= "VoxelTool" inherits= "Reference" version= "3.2" >
2020-02-13 00:48:18 +08:00
<brief_description >
2020-09-14 01:58:35 +01:00
Helper class to easily access and modify voxels
2020-02-13 00:48:18 +08:00
</brief_description>
<description >
2021-01-24 14:32:38 +00:00
Abstract interface to access and edit voxels. It allows accessing individual voxels, or doing bulk operations such as carving large chunks or copy/paste boxes.
It's not a class to instantiate alone, you may get it from the voxel objects you want to work with.
2020-02-13 00:48:18 +08:00
</description>
<tutorials >
</tutorials>
<methods >
2020-08-10 21:15:37 +01:00
<method name= "do_box" >
2020-02-13 00:48:18 +08:00
<return type= "void" >
</return>
2020-08-10 21:15:37 +01:00
<argument index= "0" name= "begin" type= "Vector3" >
</argument>
<argument index= "1" name= "end" type= "Vector3" >
2020-02-13 00:48:18 +08:00
</argument>
<description >
2020-08-10 21:15:37 +01:00
Operate on a rectangular cuboid section of the terrain. [code]begin[/code] and [code]end[/code] are inclusive. Choose operation and which voxel to use by setting [code]value[/code] and [code]mode[/code] before calling this function.
2020-02-13 00:48:18 +08:00
</description>
</method>
2020-08-10 21:15:37 +01:00
<method name= "do_point" >
2020-02-13 00:48:18 +08:00
<return type= "void" >
</return>
2020-08-10 21:15:37 +01:00
<argument index= "0" name= "pos" type= "Vector3" >
2020-02-13 00:48:18 +08:00
</argument>
<description >
</description>
</method>
2020-08-10 21:15:37 +01:00
<method name= "do_sphere" >
2020-08-05 17:21:13 -07:00
<return type= "void" >
</return>
2020-08-10 21:15:37 +01:00
<argument index= "0" name= "center" type= "Vector3" >
2020-08-05 17:21:13 -07:00
</argument>
2020-08-10 21:15:37 +01:00
<argument index= "1" name= "radius" type= "float" >
2020-08-05 17:21:13 -07:00
</argument>
<description >
</description>
</method>
2020-02-13 00:48:18 +08:00
<method name= "get_voxel" >
<return type= "int" >
</return>
<argument index= "0" name= "pos" type= "Vector3" >
</argument>
<description >
</description>
</method>
<method name= "get_voxel_f" >
<return type= "float" >
</return>
<argument index= "0" name= "pos" type= "Vector3" >
</argument>
<description >
</description>
</method>
2020-08-10 21:15:37 +01:00
<method name= "get_voxel_metadata" >
<return type= "Variant" >
</return>
<argument index= "0" name= "pos" type= "Vector3" >
</argument>
<description >
</description>
</method>
2020-09-14 01:58:35 +01:00
<method name= "is_area_editable" >
<return type= "bool" >
</return>
<argument index= "0" name= "box" type= "AABB" >
</argument>
<description >
</description>
</method>
2020-08-10 21:15:37 +01:00
<method name= "paste" >
<return type= "void" >
</return>
<argument index= "0" name= "dst_pos" type= "Vector3" >
</argument>
<argument index= "1" name= "src_buffer" type= "Reference" >
</argument>
<argument index= "2" name= "src_mask_value" type= "int" >
</argument>
<description >
</description>
</method>
2020-02-13 00:48:18 +08:00
<method name= "raycast" >
<return type= "VoxelRaycastResult" >
</return>
<argument index= "0" name= "origin" type= "Vector3" >
</argument>
<argument index= "1" name= "direction" type= "Vector3" >
</argument>
<argument index= "2" name= "max_distance" type= "float" default= "10.0" >
</argument>
2020-08-10 21:15:37 +01:00
<argument index= "3" name= "collision_mask" type= "int" default= "4294967295" >
</argument>
2020-02-13 00:48:18 +08:00
<description >
</description>
</method>
<method name= "set_voxel" >
<return type= "void" >
</return>
<argument index= "0" name= "pos" type= "Vector3" >
</argument>
<argument index= "1" name= "v" type= "int" >
</argument>
<description >
</description>
</method>
<method name= "set_voxel_f" >
<return type= "void" >
</return>
<argument index= "0" name= "pos" type= "Vector3" >
</argument>
<argument index= "1" name= "v" type= "float" >
</argument>
<description >
</description>
</method>
2020-08-10 21:15:37 +01:00
<method name= "set_voxel_metadata" >
<return type= "void" >
</return>
<argument index= "0" name= "pos" type= "Vector3" >
</argument>
<argument index= "1" name= "meta" type= "Variant" >
</argument>
<description >
</description>
</method>
2020-02-13 00:48:18 +08:00
</methods>
<members >
<member name= "channel" type= "int" setter= "set_channel" getter= "get_channel" default= "0" >
2021-01-24 14:32:38 +00:00
Set which channel will be edited. When used on a terrain node, it will default to the first available channel, based on the stream and generator.
2020-02-13 00:48:18 +08:00
</member>
<member name= "eraser_value" type= "int" setter= "set_eraser_value" getter= "get_eraser_value" default= "0" >
2021-01-24 14:32:38 +00:00
Sets which value will be used to erase voxels when editing the [enum VoxelBuffer.CHANNEL_TYPE] channel in [enum MODE_REMOVE] mode.
2020-02-13 00:48:18 +08:00
</member>
<member name= "mode" type= "int" setter= "set_mode" getter= "get_mode" enum= "VoxelTool.Mode" default= "0" >
2021-01-24 14:32:38 +00:00
Sets how [code]do_*[/code] functions will behave. This may vary depending on the channel.
</member>
2021-02-16 20:03:30 +00:00
<member name= "sdf_scale" type= "float" setter= "set_sdf_scale" getter= "get_sdf_scale" default= "0.002" >
2021-01-24 14:32:38 +00:00
When working with smooth voxels, applies a scale to the signed distance field. A high scale (1 or higher) will tend to produce blocky results, and a low scale (below 1, but not too close to zero) will tend to be smoother.
This is related to the [enum VoxelBuffer.Depth] configuration on voxels. For 8-bit and 16-bit, there is a limited range of values the Signed Distance Field can take, and by default it is clamped to -1..1, so the gradient can only range across 2 voxels. But when LOD is used, it is better to stretch that range over a longer distance, and this is achieved by scaling SDF values.
2020-02-13 00:48:18 +08:00
</member>
<member name= "value" type= "int" setter= "set_value" getter= "get_value" default= "0" >
2021-01-24 14:32:38 +00:00
Sets which voxel value will be used. This is not relevant when editing [enum VoxelBuffer.CHANNEL_SDF].
2020-02-13 00:48:18 +08:00
</member>
</members>
<constants >
<constant name= "MODE_ADD" value= "0" enum= "Mode" >
2021-01-24 14:32:38 +00:00
When editing [enum VoxelBuffer.CHANNEL_SDF], will add matter. Useful for building.
2020-02-13 00:48:18 +08:00
</constant>
<constant name= "MODE_REMOVE" value= "1" enum= "Mode" >
2021-01-24 14:32:38 +00:00
When editing [enum VoxelBuffer.CHANNEL_SDF], will subtract matter. Useful for digging.
2020-02-13 00:48:18 +08:00
</constant>
<constant name= "MODE_SET" value= "2" enum= "Mode" >
2021-01-24 14:32:38 +00:00
Replace voxel values without any blending. Useful for blocky voxels.
2020-02-13 00:48:18 +08:00
</constant>
</constants>
</class>