godot_voxel/doc/classes/VoxelGeneratorScript.xml

31 lines
2.1 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGeneratorScript" inherits="VoxelGenerator" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Base class for custom generators defined with a script.
</brief_description>
<description>
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.
</description>
<tutorials>
</tutorials>
<methods>
<method name="_generate_block" qualifiers="virtual">
<return type="void" />
<param index="0" name="out_buffer" type="VoxelBuffer" />
<param index="1" name="origin_in_voxels" type="Vector3i" />
<param index="2" name="lod" type="int" />
<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].
[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 const">
<return type="int" />
<description>
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>
</class>