Skip to content

Commit ba4f59f

Browse files
committed
Documented VoxelMesherCubes
1 parent fb73b52 commit ba4f59f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/classes/VoxelMesherCubes.xml

+22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<class name="VoxelMesherCubes" inherits="VoxelMesher" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
33
<brief_description>
4+
Generates a cubic voxels mesh from colors.
45
</brief_description>
56
<description>
7+
Builds meshes representing cubic voxels, based on color values stored in the [constant VoxelBuffer.CHANNEL_COLOR] channel.
8+
Colors will usually be stored in the [code]COLOR[/code] vertex attribute and may require a material with vertex colors enabled, or a custom shader.
69
</description>
710
<tutorials>
811
</tutorials>
@@ -12,40 +15,59 @@
1215
<param index="0" name="image" type="Image" />
1316
<param index="1" name="voxel_size" type="float" />
1417
<description>
18+
Generates a 1-voxel thick greedy mesh from pixels of an image.
1519
</description>
1620
</method>
1721
<method name="set_material_by_index">
1822
<return type="void" />
1923
<param index="0" name="id" type="int" enum="VoxelMesherCubes.Materials" />
2024
<param index="1" name="material" type="Material" />
2125
<description>
26+
Sets one of the materials that will be used when building meshes. This is equivalent to using either [member opaque_material] or [member transparent_material].
2227
</description>
2328
</method>
2429
</methods>
2530
<members>
2631
<member name="color_mode" type="int" setter="set_color_mode" getter="get_color_mode" enum="VoxelMesherCubes.ColorMode" default="0">
32+
Sets how voxel color is determined when building the mesh.
2733
</member>
2834
<member name="greedy_meshing_enabled" type="bool" setter="set_greedy_meshing_enabled" getter="is_greedy_meshing_enabled" default="true">
35+
Enables greedy meshing: the mesher will attempt to merge contiguous faces having the same color to reduce the number of polygons.
2936
</member>
3037
<member name="opaque_material" type="Material" setter="_set_opaque_material" getter="_get_opaque_material">
38+
Material that will be used for opaque parts of the mesh.
3139
</member>
3240
<member name="palette" type="VoxelColorPalette" setter="set_palette" getter="get_palette">
41+
Palette that will be used when using the [constant COLOR_MESHER_PALETTE] color mode.
3342
</member>
3443
<member name="transparent_material" type="Material" setter="_set_transparent_material" getter="_get_transparent_material">
44+
Material that will be used for transparent parts of the mesh (colors where alpha is not set to max).
3545
</member>
3646
</members>
3747
<constants>
3848
<constant name="MATERIAL_OPAQUE" value="0" enum="Materials">
49+
Index of the opaque material.
3950
</constant>
4051
<constant name="MATERIAL_TRANSPARENT" value="1" enum="Materials">
52+
Index of the transparent material.
4153
</constant>
4254
<constant name="MATERIAL_COUNT" value="2" enum="Materials">
55+
Maximum number of materials.
4356
</constant>
4457
<constant name="COLOR_RAW" value="0" enum="ColorMode">
58+
Voxel values will be directly interpreted as colors.
59+
8-bit voxels are interpreted as [code]rrggbbaa[/code] (2 bits per component) where the range per component is converted from 0..3 to 0..255.
60+
16-bit voxels are interpreted as [code]rrrrgggg bbbbaaaa[/code] (4 bits per component) where the range per component is converted from 0..15 to 0..255.
61+
32-bit voxels are interpreted as [code]rrrrrrrr gggggggg bbbbbbbb aaaaaaaa[/code] (8 bits per component) where each component is in 0..255.
4562
</constant>
4663
<constant name="COLOR_MESHER_PALETTE" value="1" enum="ColorMode">
64+
Voxel values will be interpreted as indices within the color palette assigned in the [member palette] property.
4765
</constant>
4866
<constant name="COLOR_SHADER_PALETTE" value="2" enum="ColorMode">
67+
Voxel values will be directly written as such in the mesh, instead of colors.
68+
They are written in the red component of the [code]COLOR[/code], leaving red and blue to zero. Note, it will be normalized to 0..1 in shader, so if you need the integer value back you may use [code]int(COLOR.r * 255.0)[/code].
69+
The alpha component will be set to the transparency of the corresponding color in [member palette] (a palette resource is still needed to differenciate transparent parts; RGB values are not used).
70+
You are expected to use a [ShaderMaterial] to read vertex data and choose the actual color with a custom shader. [StandardMaterial] will not work with this mode.
4971
</constant>
5072
</constants>
5173
</class>

0 commit comments

Comments
 (0)