godot_voxel/doc/classes/VoxelGeneratorScript.xml

38 lines
2.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGeneratorScript" inherits="VoxelGenerator" version="3.2">
<brief_description>
Base class for custom generators defined with a script.
2021-01-31 16:24:26 +00:00
Important: this engine makes heavy use of threads. Generators will run in one of them, so make sure you don't access the scene tree or other unsafe APIs from within a generator.
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="_generate_block" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="out_buffer" type="VoxelBuffer">
</argument>
<argument index="1" name="origin_in_voxels" type="Vector3">
</argument>
<argument index="2" name="lod" type="int">
</argument>
<description>
[code]out_buffer[/code]: Buffer in which to populate voxel data. It will never be [code]null[/code] and will have the requested size. It is only valid for this function, do not store it anywhere after the end.
[code]origin_in_voxels[/code]: Coordinates of the lower corner of the box to generate, relative to LOD0. The size of the box is known from [code]out_buffer[/code].
2021-02-16 20:47:43 +00:00
[code]lod[/code]: Level of detail index to use for this block. It can be ignored if you don't use LOD. This may be used as a power of two, telling how big is one voxel. For example, if you use a loop to fill the buffer using noise, you should sample that noise at steps of 2^lod, starting from [code]origin_in_voxels[/code] (in code you can use [code]1 &lt;&lt; lod[/code] for fast computation, instead of [code]pow(2, lod)[/code]). You may want to separate variables that iterate the coordinates in [code]out_buffer[/code] and variables used to generate voxel values in space.
</description>
</method>
<method name="_get_used_channels_mask" qualifiers="virtual">
<return type="int">
</return>
<description>
2021-02-16 20:47:43 +00:00
Use this to indicate which channels your generator will use. It returns a bitmask, so for example you may provide information like this: [code](1 &lt;&lt; channel1) | (1 &lt;&lt; channel2)[/code]
</description>
</method>
</methods>
<constants>
</constants>
</class>