Skip to content

Commit

Permalink
Doc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Oct 15, 2024
1 parent fa354c6 commit f9c57ef
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 31 deletions.
4 changes: 4 additions & 0 deletions doc/classes/VoxelBuffer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<method name="get_allocator" qualifiers="const">
<return type="int" enum="VoxelBuffer.Allocator" />
<description>
Gets which memory allocator is used by this buffer.
</description>
</method>
<method name="get_block_metadata" qualifiers="const">
Expand Down Expand Up @@ -408,12 +409,15 @@
How many compression modes there are.
</constant>
<constant name="ALLOCATOR_DEFAULT" value="0" enum="Allocator">
Uses Godot's default memory allocator (at time of writing, it is [code]malloc[/code]). Preferred for occasional buffers with uncommon size, or very large size.
</constant>
<constant name="ALLOCATOR_POOL" value="1" enum="Allocator">
Uses a pool allocator. Can be faster than the default allocator buffers are created very frequently with similar size. This memory will remain allocated after use, under the assumption that other buffers will need it soon after. Does not support very large buffers (greater than 2 megabytes)
</constant>
<constant name="ALLOCATOR_COUNT" value="2" enum="Allocator">
</constant>
<constant name="MAX_SIZE" value="65535">
Maximum size a buffer can have when serialized. Buffers that contain uniform-compressed voxels can reach it, but in practice, the limit is much lower and depends on available memory.
</constant>
</constants>
</class>
3 changes: 3 additions & 0 deletions doc/classes/VoxelColorPalette.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<description>
Contains a list of colors that can be accessed quickly by their index. This is useful to store colored voxels with small memory footprint.
It can be used with [VoxelMesherCubes].
Note: colors are internally stored with 8-bit components, so floats used by [Color] will be rounded to the nearest value.
</description>
<tutorials>
</tutorials>
Expand All @@ -26,8 +27,10 @@
</methods>
<members>
<member name="colors" type="PackedColorArray" setter="set_colors" getter="get_colors" default="PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1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0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)">
Array of all the colors in the palette. It must have 256 elements. You may use this if you want to get or set all colors at once. Otherwise, prefer using [method get_color] and [method set_color].
</member>
<member name="data" type="PackedInt32Array" setter="set_data" getter="get_data" default="PackedInt32Array(0, -1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255)">
Array used to store colors as 8-bit binary components in the resource file. It must have 256 elements. To access colors with a script, prefer using [method get_color] and [method set_color].
</member>
</members>
<constants>
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/VoxelGeneratorFlat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
</tutorials>
<members>
<member name="channel" type="int" setter="set_channel" getter="get_channel" enum="VoxelBuffer.ChannelId" default="1">
Channel that will be used to generate the ground.
Channel that will be used to generate the ground. Use [member VoxelBuffer.CHANNEL_SDF] for smooth terrain, other channels for blocky.
</member>
<member name="height" type="float" setter="set_height" getter="get_height" default="0.0">
Altitude of the ground.
</member>
<member name="voxel_type" type="int" setter="set_voxel_type" getter="get_voxel_type" default="1">
If [member channel] is set to [constant VoxelBuffer.CHANNEL_TYPE], this value will be used to fill ground voxels.
If [member channel] is set to any channel other than [constant VoxelBuffer.CHANNEL_SDF], this value will be used to fill ground voxels, while air voxels will be set to 0.
</member>
</members>
</class>
4 changes: 3 additions & 1 deletion doc/classes/VoxelGeneratorHeightmap.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGeneratorHeightmap" inherits="VoxelGenerator" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Base class for several basic height-based generators.
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<members>
<member name="channel" type="int" setter="set_channel" getter="get_channel" enum="VoxelBuffer.ChannelId" default="1">
Channel where voxels will be generated. If set to [constant VoxelBuffer.CHANNEL_SDF], voxels will be a signed distance field usable by smooth meshers. Otherwise, the value 1 will be set below ground, and the value 0 will be set above ground (blocky).
</member>
<member name="height_range" type="float" setter="set_height_range" getter="get_height_range" default="30.0">
Maximum distance between the lowest and highest surface points that can generate.
Expand All @@ -17,7 +19,7 @@
Minimum height where the surface will generate.
</member>
<member name="iso_scale" type="float" setter="set_iso_scale" getter="get_iso_scale" default="1.0">
Scale applied to the signed distance field. This is useful when smooth voxels are used, to reduce blockyness over large distances.
Scale applied to the signed distance field when using a smooth terrain configuration.
</member>
</members>
</class>
3 changes: 3 additions & 0 deletions doc/classes/VoxelGeneratorImage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Voxel generator producing a heightmap-based shape using an image.
</brief_description>
<description>
Uses the red channel of an image to generate a heightmap, such that the top left corner is centered on the world origin. The image will repeat if terrain generates beyond its size.
Note: values in the image are read using `get_pixel` and are assumed to be between 0 and 1 (normalized). These values will be transformed by [member VoxelGeneratorHeightmap.height_start] and [member VoxelGeneratorHeightmap.height_range].
</description>
<tutorials>
</tutorials>
Expand All @@ -12,6 +14,7 @@
</member>
<member name="height_range" type="float" setter="set_height_range" getter="get_height_range" overrides="VoxelGeneratorHeightmap" default="200.0" />
<member name="image" type="Image" setter="set_image" getter="get_image">
Sets the image that will be used as a heightmap. Only the red channel will be used. It is preferable to use an image using the `RF` or `RH` format, which contain higher resolution heights. Common images only have 8-bit depth and will appear blocky.
</member>
</members>
</class>
36 changes: 29 additions & 7 deletions doc/classes/VoxelGraphFunction.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGraphFunction" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Graph for generating or processing voxels.
Graph for generating or processing series of 3D values.
</brief_description>
<description>
Contains a graph that can be used to generate voxel data (when used as main function of a generator), or to be re-used into other graphs (like a sub-graph).
Currently this class only stores a graph, it cannot run actual processing on its own. To generate voxels with it, see [VoxelGeneratorGraph].
Note: node types are identified with the enum [enum VoxelGraphFunction.NodeTypeID]. This enum shouldn't be used in persistent contexts (such as save files) as its values may change between versions.
Contains a graph that can be used to process series of values, such as voxel positions (when used as main function of a generator), or to be re-used into other graphs (like a sub-graph).
Currently this class only stores a graph, it cannot run actual processing on its own. It is usually embedded into another resource which then makes use of the graph in a specific way.
To generate voxels with it, see [VoxelGeneratorGraph].
Nodes can be connected together from their outputs to the inputs of next nodes. Unconnected inputs can have default values or default implicit connections.
Nodes can also have "parameters" which are constants setup per node.
Nodes come in 3 main families: inputs (only have outputs), outputs (only have inputs), and others (which have both inputs and output to do some calculation).
Node types are identified with the enum [enum VoxelGraphFunction.NodeTypeID]. This enum shouldn't be used in persistent contexts (such as save files) as its values may change between versions.
Graphs can only process 32-bit floating point values.
Description of node types is present in the graph editor node dialog, or at [url]https://voxel-tools.readthedocs.io/en/latest/graph_nodes[/url].
</description>
<tutorials>
</tutorials>
Expand Down Expand Up @@ -68,6 +74,19 @@
<method name="get_connections" qualifiers="const">
<return type="Array" />
<description>
Gets an array describing all connections between nodes.
The array has the following format:
[codeblock]
[
{
"src_node_id": int,
"src_port_index": int,
"dst_node_id": int,
"dst_port_index": int
},
...
]
[/codeblock]
</description>
</method>
<method name="get_node_default_input" qualifiers="const">
Expand Down Expand Up @@ -101,6 +120,7 @@
<return type="PackedInt32Array" />
<description>
Get a list of IDs of all the nodes in the graph.
Note: the order in which IDs are returned is not guaranteed to be the same after nodes are added or removed.
</description>
</method>
<method name="get_node_name" qualifiers="const">
Expand All @@ -115,6 +135,7 @@
<param index="0" name="node_id" type="int" />
<param index="1" name="param_index" type="int" />
<description>
Get a parameter of a node. The parameter index corresponds to the position that parameter comes in when seen in the editor.
</description>
</method>
<method name="get_node_type_count" qualifiers="const">
Expand Down Expand Up @@ -168,7 +189,7 @@
<description>
Copies nodes into another graph, and connections between them only.
Resources in node parameters will be duplicated if they don't have a file path.
If [code]node_ids[/code] is provided with non-zero size, defines the IDs of copied nodes. Otherwise, they are generated.
If [code]node_ids[/code] is provided with non-zero size, defines the IDs copied nodes will have in the destination graph, in the same order as [method get_node_ids] from the source graph. The array must have the same size as the number of copied nodes and IDs must not already exist in the destination graph. If the array is empty, they will be generated instead.
</description>
</method>
<method name="remove_connection">
Expand All @@ -194,7 +215,7 @@
<param index="1" name="names" type="PackedStringArray" />
<description>
Configures inputs for an Expression node. [code]names[/code] is the list of input names used in the expression.
[code]value[/code] must be a [code]float[/code] for now.
If you create an Expression node from code, you should call this method afterwards.
</description>
</method>
<method name="set_node_default_input">
Expand All @@ -203,6 +224,7 @@
<param index="1" name="input_index" type="int" />
<param index="2" name="value" type="Variant" />
<description>
Sets the value an input of a node will have when it is left unconnected.
</description>
</method>
<method name="set_node_default_inputs_autoconnect">
Expand All @@ -211,7 +233,7 @@
<param index="1" name="enabled" type="bool" />
<description>
Sets wether a node input with no inbound connection will automatically create a default connection when the graph is compiled.
This is only available on specific nodes. On other nodes, it has no effect.
This is only available on specific nodes (for example, 2D or 3D noise defaults to XYZ inputs). On other nodes, it has no effect.
</description>
</method>
<method name="set_node_gui_position">
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/VoxelMesherTransvoxel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<param index="0" name="voxel_buffer" type="VoxelBuffer" />
<param index="1" name="direction" type="int" />
<description>
Generates only the part of the mesh that Transvoxel uses to connect surfaces with different level of detail. This method is mainly for testing purposes.
</description>
</method>
</methods>
Expand All @@ -35,8 +36,13 @@
</members>
<constants>
<constant name="TEXTURES_NONE" value="0" enum="TexturingMode">
Disables texturing information. This mode is the fastest if you can use a shader to apply textures procedurally.
</constant>
<constant name="TEXTURES_BLEND_4_OVER_16" value="1" enum="TexturingMode">
Adds texturing information as 4 texture indices and 4 weights, encoded in [code]CUSTOM1.xy[/code] in Godot fragment shaders, where x and y contain 4 packed 8-bit values.
Expects voxels to have 4 4-bit indices packed in 16-bit values in [constant VoxelBuffer.CHANNEL_INDICES], and 4 4-bit weights in [constant VoxelBuffer.CHANNEL_WEIGHTS].
In cases where more than 4 textures cross each other in a 2x2x2 voxel area, triangles in that area will only use the 4 indices with the highest weights.
A custom shader is required to render this, usually with texture arrays to index textures easily.
</constant>
</constants>
</class>
5 changes: 3 additions & 2 deletions doc/classes/VoxelRaycastResult.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
</tutorials>
<members>
<member name="distance" type="float" setter="" getter="get_distance" default="0.0">
Distance between the origin of the ray and the surface of the cube representing the hit voxel.
</member>
<member name="position" type="Vector3i" setter="" getter="get_position" default="Vector3i(0, 0, 0)">
Integer position of the voxel that was hit.
Integer position of the voxel that was hit. In a blocky game, this would be the position of the voxel to interact with.
</member>
<member name="previous_position" type="Vector3i" setter="" getter="get_previous_position" default="Vector3i(0, 0, 0)">
Integer position of the previous voxel along the ray before the final hit.
Integer position of the previous voxel along the ray before the final hit. In a blocky game, this would be the position of the voxel to place on top of the pointed one.
</member>
</members>
</class>
1 change: 1 addition & 0 deletions doc/classes/VoxelSaveCompletionTracker.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelSaveCompletionTracker" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Object returned by some asynchronous functions to track progress and completion.
</brief_description>
<description>
</description>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/VoxelStreamScript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<method name="_get_used_channels_mask" qualifiers="virtual const">
<return type="int" />
<description>
Tells which channels in [VoxelBuffer] are supported to save voxel data, in case the stream only saves specific ones.
</description>
</method>
<method name="_load_voxel_block" qualifiers="virtual">
Expand All @@ -19,6 +20,7 @@
<param index="1" name="position_in_blocks" type="Vector3i" />
<param index="2" name="lod" type="int" />
<description>
Called when a block of voxels needs to be loaded. Assumes [code]out_buffer[/code] always has the same size. Returns [enum VoxelStream.ResultCode].
</description>
</method>
<method name="_save_voxel_block" qualifiers="virtual">
Expand All @@ -27,6 +29,7 @@
<param index="1" name="position_in_blocks" type="Vector3i" />
<param index="2" name="lod" type="int" />
<description>
Called when a block of voxels needs to be saved. Assumes [code]out_buffer[/code] always has the same size.
</description>
</method>
</methods>
Expand Down
Loading

0 comments on commit f9c57ef

Please sign in to comment.