|
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?>
|
2 | 2 | <class name="VoxelMesherCubes" inherits="VoxelMesher" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
3 | 3 | <brief_description>
|
| 4 | + Generates a cubic voxels mesh from colors. |
4 | 5 | </brief_description>
|
5 | 6 | <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. |
6 | 9 | </description>
|
7 | 10 | <tutorials>
|
8 | 11 | </tutorials>
|
|
12 | 15 | <param index="0" name="image" type="Image" />
|
13 | 16 | <param index="1" name="voxel_size" type="float" />
|
14 | 17 | <description>
|
| 18 | + Generates a 1-voxel thick greedy mesh from pixels of an image. |
15 | 19 | </description>
|
16 | 20 | </method>
|
17 | 21 | <method name="set_material_by_index">
|
18 | 22 | <return type="void" />
|
19 | 23 | <param index="0" name="id" type="int" enum="VoxelMesherCubes.Materials" />
|
20 | 24 | <param index="1" name="material" type="Material" />
|
21 | 25 | <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]. |
22 | 27 | </description>
|
23 | 28 | </method>
|
24 | 29 | </methods>
|
25 | 30 | <members>
|
26 | 31 | <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. |
27 | 33 | </member>
|
28 | 34 | <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. |
29 | 36 | </member>
|
30 | 37 | <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. |
31 | 39 | </member>
|
32 | 40 | <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. |
33 | 42 | </member>
|
34 | 43 | <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). |
35 | 45 | </member>
|
36 | 46 | </members>
|
37 | 47 | <constants>
|
38 | 48 | <constant name="MATERIAL_OPAQUE" value="0" enum="Materials">
|
| 49 | + Index of the opaque material. |
39 | 50 | </constant>
|
40 | 51 | <constant name="MATERIAL_TRANSPARENT" value="1" enum="Materials">
|
| 52 | + Index of the transparent material. |
41 | 53 | </constant>
|
42 | 54 | <constant name="MATERIAL_COUNT" value="2" enum="Materials">
|
| 55 | + Maximum number of materials. |
43 | 56 | </constant>
|
44 | 57 | <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. |
45 | 62 | </constant>
|
46 | 63 | <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. |
47 | 65 | </constant>
|
48 | 66 | <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. |
49 | 71 | </constant>
|
50 | 72 | </constants>
|
51 | 73 | </class>
|
0 commit comments