mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
classref: Sync with current master branch (f87858a8f)
This commit is contained in:
@@ -14,10 +14,12 @@ SurfaceTool
|
||||
|
||||
Helper tool to create geometry.
|
||||
|
||||
.. rst-class:: classref-introduction-group
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
The ``SurfaceTool`` is used to construct a :ref:`Mesh<class_Mesh>` by specifying vertex attributes individually. It can be used to construct a :ref:`Mesh<class_Mesh>` from a script. All properties except indices need to be added before calling :ref:`add_vertex<class_SurfaceTool_method_add_vertex>`. For example, to add vertex colors and UVs:
|
||||
The **SurfaceTool** is used to construct a :ref:`Mesh<class_Mesh>` by specifying vertex attributes individually. It can be used to construct a :ref:`Mesh<class_Mesh>` from a script. All properties except indices need to be added before calling :ref:`add_vertex<class_SurfaceTool_method_add_vertex>`. For example, to add vertex colors and UVs:
|
||||
|
||||
|
||||
.. tabs::
|
||||
@@ -40,7 +42,7 @@ The ``SurfaceTool`` is used to construct a :ref:`Mesh<class_Mesh>` by specifying
|
||||
|
||||
|
||||
|
||||
The above ``SurfaceTool`` now contains one vertex of a triangle which has a UV coordinate and a specified :ref:`Color<class_Color>`. If another vertex were added without calling :ref:`set_uv<class_SurfaceTool_method_set_uv>` or :ref:`set_color<class_SurfaceTool_method_set_color>`, then the last values would be used.
|
||||
The above **SurfaceTool** now contains one vertex of a triangle which has a UV coordinate and a specified :ref:`Color<class_Color>`. If another vertex were added without calling :ref:`set_uv<class_SurfaceTool_method_set_uv>` or :ref:`set_color<class_SurfaceTool_method_set_color>`, then the last values would be used.
|
||||
|
||||
Vertex attributes must be passed **before** calling :ref:`add_vertex<class_SurfaceTool_method_add_vertex>`. Failure to do so will result in an error when committing the vertex information to a mesh.
|
||||
|
||||
@@ -50,245 +52,364 @@ See also :ref:`ArrayMesh<class_ArrayMesh>`, :ref:`ImmediateMesh<class_ImmediateM
|
||||
|
||||
\ **Note:** Godot uses clockwise `winding order <https://learnopengl.com/Advanced-OpenGL/Face-culling>`__ for front faces of triangle primitive modes.
|
||||
|
||||
.. rst-class:: classref-introduction-group
|
||||
|
||||
Tutorials
|
||||
---------
|
||||
|
||||
- `3D Voxel Demo <https://godotengine.org/asset-library/asset/676>`__
|
||||
|
||||
.. rst-class:: classref-reftable-group
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_index<class_SurfaceTool_method_add_index>` **(** :ref:`int<class_int>` index **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_triangle_fan<class_SurfaceTool_method_add_triangle_fan>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` vertices, :ref:`PackedVector2Array<class_PackedVector2Array>` uvs=PackedVector2Array(), :ref:`PackedColorArray<class_PackedColorArray>` colors=PackedColorArray(), :ref:`PackedVector2Array<class_PackedVector2Array>` uv2s=PackedVector2Array(), :ref:`PackedVector3Array<class_PackedVector3Array>` normals=PackedVector3Array(), :ref:`Array<class_Array>` tangents=[] **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_vertex<class_SurfaceTool_method_add_vertex>` **(** :ref:`Vector3<class_Vector3>` vertex **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`append_from<class_SurfaceTool_method_append_from>` **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`Transform3D<class_Transform3D>` transform **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`begin<class_SurfaceTool_method_begin>` **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear<class_SurfaceTool_method_clear>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`ArrayMesh<class_ArrayMesh>` | :ref:`commit<class_SurfaceTool_method_commit>` **(** :ref:`ArrayMesh<class_ArrayMesh>` existing=null, :ref:`int<class_int>` flags=0 **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Array<class_Array>` | :ref:`commit_to_arrays<class_SurfaceTool_method_commit_to_arrays>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`create_from<class_SurfaceTool_method_create_from>` **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`create_from_blend_shape<class_SurfaceTool_method_create_from_blend_shape>` **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`String<class_String>` blend_shape **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`deindex<class_SurfaceTool_method_deindex>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`generate_lod<class_SurfaceTool_method_generate_lod>` **(** :ref:`float<class_float>` nd_threshold, :ref:`int<class_int>` target_index_count=3 **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`generate_normals<class_SurfaceTool_method_generate_normals>` **(** :ref:`bool<class_bool>` flip=false **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`generate_tangents<class_SurfaceTool_method_generate_tangents>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`AABB<class_AABB>` | :ref:`get_aabb<class_SurfaceTool_method_get_aabb>` **(** **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` | :ref:`get_custom_format<class_SurfaceTool_method_get_custom_format>` **(** :ref:`int<class_int>` channel_index **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` | :ref:`get_primitive_type<class_SurfaceTool_method_get_primitive_type>` **(** **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` | :ref:`get_skin_weight_count<class_SurfaceTool_method_get_skin_weight_count>` **(** **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`index<class_SurfaceTool_method_index>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`optimize_indices_for_cache<class_SurfaceTool_method_optimize_indices_for_cache>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_bones<class_SurfaceTool_method_set_bones>` **(** :ref:`PackedInt32Array<class_PackedInt32Array>` bones **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_color<class_SurfaceTool_method_set_color>` **(** :ref:`Color<class_Color>` color **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_custom<class_SurfaceTool_method_set_custom>` **(** :ref:`int<class_int>` channel_index, :ref:`Color<class_Color>` custom_color **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_custom_format<class_SurfaceTool_method_set_custom_format>` **(** :ref:`int<class_int>` channel_index, :ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` format **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_material<class_SurfaceTool_method_set_material>` **(** :ref:`Material<class_Material>` material **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_normal<class_SurfaceTool_method_set_normal>` **(** :ref:`Vector3<class_Vector3>` normal **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_skin_weight_count<class_SurfaceTool_method_set_skin_weight_count>` **(** :ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` count **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_smooth_group<class_SurfaceTool_method_set_smooth_group>` **(** :ref:`int<class_int>` index **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_tangent<class_SurfaceTool_method_set_tangent>` **(** :ref:`Plane<class_Plane>` tangent **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_uv<class_SurfaceTool_method_set_uv>` **(** :ref:`Vector2<class_Vector2>` uv **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_uv2<class_SurfaceTool_method_set_uv2>` **(** :ref:`Vector2<class_Vector2>` uv2 **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_weights<class_SurfaceTool_method_set_weights>` **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` weights **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_index<class_SurfaceTool_method_add_index>` **(** :ref:`int<class_int>` index **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_triangle_fan<class_SurfaceTool_method_add_triangle_fan>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` vertices, :ref:`PackedVector2Array<class_PackedVector2Array>` uvs=PackedVector2Array(), :ref:`PackedColorArray<class_PackedColorArray>` colors=PackedColorArray(), :ref:`PackedVector2Array<class_PackedVector2Array>` uv2s=PackedVector2Array(), :ref:`PackedVector3Array<class_PackedVector3Array>` normals=PackedVector3Array(), :ref:`Array<class_Array>` tangents=[] **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_vertex<class_SurfaceTool_method_add_vertex>` **(** :ref:`Vector3<class_Vector3>` vertex **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`append_from<class_SurfaceTool_method_append_from>` **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`Transform3D<class_Transform3D>` transform **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`begin<class_SurfaceTool_method_begin>` **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear<class_SurfaceTool_method_clear>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`ArrayMesh<class_ArrayMesh>` | :ref:`commit<class_SurfaceTool_method_commit>` **(** :ref:`ArrayMesh<class_ArrayMesh>` existing=null, :ref:`int<class_int>` flags=0 **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Array<class_Array>` | :ref:`commit_to_arrays<class_SurfaceTool_method_commit_to_arrays>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`create_from<class_SurfaceTool_method_create_from>` **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`create_from_blend_shape<class_SurfaceTool_method_create_from_blend_shape>` **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`String<class_String>` blend_shape **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`deindex<class_SurfaceTool_method_deindex>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`generate_lod<class_SurfaceTool_method_generate_lod>` **(** :ref:`float<class_float>` nd_threshold, :ref:`int<class_int>` target_index_count=3 **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`generate_normals<class_SurfaceTool_method_generate_normals>` **(** :ref:`bool<class_bool>` flip=false **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`generate_tangents<class_SurfaceTool_method_generate_tangents>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`AABB<class_AABB>` | :ref:`get_aabb<class_SurfaceTool_method_get_aabb>` **(** **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` | :ref:`get_custom_format<class_SurfaceTool_method_get_custom_format>` **(** :ref:`int<class_int>` channel_index **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` | :ref:`get_primitive_type<class_SurfaceTool_method_get_primitive_type>` **(** **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` | :ref:`get_skin_weight_count<class_SurfaceTool_method_get_skin_weight_count>` **(** **)** |const| |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`index<class_SurfaceTool_method_index>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`optimize_indices_for_cache<class_SurfaceTool_method_optimize_indices_for_cache>` **(** **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_bones<class_SurfaceTool_method_set_bones>` **(** :ref:`PackedInt32Array<class_PackedInt32Array>` bones **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_color<class_SurfaceTool_method_set_color>` **(** :ref:`Color<class_Color>` color **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_custom<class_SurfaceTool_method_set_custom>` **(** :ref:`int<class_int>` channel_index, :ref:`Color<class_Color>` custom_color **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_custom_format<class_SurfaceTool_method_set_custom_format>` **(** :ref:`int<class_int>` channel_index, :ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` format **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_material<class_SurfaceTool_method_set_material>` **(** :ref:`Material<class_Material>` material **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_normal<class_SurfaceTool_method_set_normal>` **(** :ref:`Vector3<class_Vector3>` normal **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_skin_weight_count<class_SurfaceTool_method_set_skin_weight_count>` **(** :ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` count **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_smooth_group<class_SurfaceTool_method_set_smooth_group>` **(** :ref:`int<class_int>` index **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_tangent<class_SurfaceTool_method_set_tangent>` **(** :ref:`Plane<class_Plane>` tangent **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_uv<class_SurfaceTool_method_set_uv>` **(** :ref:`Vector2<class_Vector2>` uv **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_uv2<class_SurfaceTool_method_set_uv2>` **(** :ref:`Vector2<class_Vector2>` uv2 **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_weights<class_SurfaceTool_method_set_weights>` **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` weights **)** |
|
||||
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
----
|
||||
|
||||
.. rst-class:: classref-descriptions-group
|
||||
|
||||
Enumerations
|
||||
------------
|
||||
|
||||
.. _enum_SurfaceTool_CustomFormat:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA8_UNORM:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA8_SNORM:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RG_HALF:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA_HALF:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_R_FLOAT:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RG_FLOAT:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGB_FLOAT:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA_FLOAT:
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_MAX:
|
||||
.. rst-class:: classref-enumeration
|
||||
|
||||
enum **CustomFormat**:
|
||||
|
||||
- **CUSTOM_RGBA8_UNORM** = **0** --- Limits range of data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` to unsigned normalized 0 to 1 stored in 8 bits per channel. See :ref:`Mesh.ARRAY_CUSTOM_RGBA8_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`.
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA8_UNORM:
|
||||
|
||||
- **CUSTOM_RGBA8_SNORM** = **1** --- Limits range of data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` to signed normalized -1 to 1 stored in 8 bits per channel. See :ref:`Mesh.ARRAY_CUSTOM_RGBA8_SNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM>`.
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
- **CUSTOM_RG_HALF** = **2** --- Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as half precision floats, and uses only red and green color channels. See :ref:`Mesh.ARRAY_CUSTOM_RG_HALF<class_Mesh_constant_ARRAY_CUSTOM_RG_HALF>`.
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_RGBA8_UNORM** = ``0``
|
||||
|
||||
- **CUSTOM_RGBA_HALF** = **3** --- Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as half precision floats and uses all color channels. See :ref:`Mesh.ARRAY_CUSTOM_RGBA_HALF<class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF>`.
|
||||
Limits range of data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` to unsigned normalized 0 to 1 stored in 8 bits per channel. See :ref:`Mesh.ARRAY_CUSTOM_RGBA8_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`.
|
||||
|
||||
- **CUSTOM_R_FLOAT** = **4** --- Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses only red color channel. See :ref:`Mesh.ARRAY_CUSTOM_R_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_R_FLOAT>`.
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA8_SNORM:
|
||||
|
||||
- **CUSTOM_RG_FLOAT** = **5** --- Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses only red and green color channels. See :ref:`Mesh.ARRAY_CUSTOM_RG_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_RG_FLOAT>`.
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
- **CUSTOM_RGB_FLOAT** = **6** --- Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses only red, green and blue color channels. See :ref:`Mesh.ARRAY_CUSTOM_RGB_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_RGB_FLOAT>`.
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_RGBA8_SNORM** = ``1``
|
||||
|
||||
- **CUSTOM_RGBA_FLOAT** = **7** --- Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses all color channels. See :ref:`Mesh.ARRAY_CUSTOM_RGBA_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_RGBA_FLOAT>`.
|
||||
Limits range of data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` to signed normalized -1 to 1 stored in 8 bits per channel. See :ref:`Mesh.ARRAY_CUSTOM_RGBA8_SNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM>`.
|
||||
|
||||
- **CUSTOM_MAX** = **8** --- Used to indicate a disabled custom channel.
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RG_HALF:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_RG_HALF** = ``2``
|
||||
|
||||
Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as half precision floats, and uses only red and green color channels. See :ref:`Mesh.ARRAY_CUSTOM_RG_HALF<class_Mesh_constant_ARRAY_CUSTOM_RG_HALF>`.
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA_HALF:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_RGBA_HALF** = ``3``
|
||||
|
||||
Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as half precision floats and uses all color channels. See :ref:`Mesh.ARRAY_CUSTOM_RGBA_HALF<class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF>`.
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_R_FLOAT:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_R_FLOAT** = ``4``
|
||||
|
||||
Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses only red color channel. See :ref:`Mesh.ARRAY_CUSTOM_R_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_R_FLOAT>`.
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RG_FLOAT:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_RG_FLOAT** = ``5``
|
||||
|
||||
Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses only red and green color channels. See :ref:`Mesh.ARRAY_CUSTOM_RG_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_RG_FLOAT>`.
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGB_FLOAT:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_RGB_FLOAT** = ``6``
|
||||
|
||||
Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses only red, green and blue color channels. See :ref:`Mesh.ARRAY_CUSTOM_RGB_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_RGB_FLOAT>`.
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_RGBA_FLOAT:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_RGBA_FLOAT** = ``7``
|
||||
|
||||
Stores data passed to :ref:`set_custom<class_SurfaceTool_method_set_custom>` as full precision floats, and uses all color channels. See :ref:`Mesh.ARRAY_CUSTOM_RGBA_FLOAT<class_Mesh_constant_ARRAY_CUSTOM_RGBA_FLOAT>`.
|
||||
|
||||
.. _class_SurfaceTool_constant_CUSTOM_MAX:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **CUSTOM_MAX** = ``8``
|
||||
|
||||
Used to indicate a disabled custom channel.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _enum_SurfaceTool_SkinWeightCount:
|
||||
|
||||
.. _class_SurfaceTool_constant_SKIN_4_WEIGHTS:
|
||||
|
||||
.. _class_SurfaceTool_constant_SKIN_8_WEIGHTS:
|
||||
.. rst-class:: classref-enumeration
|
||||
|
||||
enum **SkinWeightCount**:
|
||||
|
||||
- **SKIN_4_WEIGHTS** = **0** --- Each individual vertex can be influenced by only 4 bone weights.
|
||||
.. _class_SurfaceTool_constant_SKIN_4_WEIGHTS:
|
||||
|
||||
- **SKIN_8_WEIGHTS** = **1** --- Each individual vertex can be influenced by up to 8 bone weights.
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` **SKIN_4_WEIGHTS** = ``0``
|
||||
|
||||
Each individual vertex can be influenced by only 4 bone weights.
|
||||
|
||||
.. _class_SurfaceTool_constant_SKIN_8_WEIGHTS:
|
||||
|
||||
.. rst-class:: classref-enumeration-constant
|
||||
|
||||
:ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` **SKIN_8_WEIGHTS** = ``1``
|
||||
|
||||
Each individual vertex can be influenced by up to 8 bone weights.
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
----
|
||||
|
||||
.. rst-class:: classref-descriptions-group
|
||||
|
||||
Method Descriptions
|
||||
-------------------
|
||||
|
||||
.. _class_SurfaceTool_method_add_index:
|
||||
|
||||
- void **add_index** **(** :ref:`int<class_int>` index **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **add_index** **(** :ref:`int<class_int>` index **)**
|
||||
|
||||
Adds a vertex to index array if you are using indexed vertices. Does not need to be called before adding vertices.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_add_triangle_fan:
|
||||
|
||||
- void **add_triangle_fan** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` vertices, :ref:`PackedVector2Array<class_PackedVector2Array>` uvs=PackedVector2Array(), :ref:`PackedColorArray<class_PackedColorArray>` colors=PackedColorArray(), :ref:`PackedVector2Array<class_PackedVector2Array>` uv2s=PackedVector2Array(), :ref:`PackedVector3Array<class_PackedVector3Array>` normals=PackedVector3Array(), :ref:`Array<class_Array>` tangents=[] **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **add_triangle_fan** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` vertices, :ref:`PackedVector2Array<class_PackedVector2Array>` uvs=PackedVector2Array(), :ref:`PackedColorArray<class_PackedColorArray>` colors=PackedColorArray(), :ref:`PackedVector2Array<class_PackedVector2Array>` uv2s=PackedVector2Array(), :ref:`PackedVector3Array<class_PackedVector3Array>` normals=PackedVector3Array(), :ref:`Array<class_Array>` tangents=[] **)**
|
||||
|
||||
Inserts a triangle fan made of array data into :ref:`Mesh<class_Mesh>` being constructed.
|
||||
|
||||
Requires the primitive type be set to :ref:`Mesh.PRIMITIVE_TRIANGLES<class_Mesh_constant_PRIMITIVE_TRIANGLES>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_add_vertex:
|
||||
|
||||
- void **add_vertex** **(** :ref:`Vector3<class_Vector3>` vertex **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **add_vertex** **(** :ref:`Vector3<class_Vector3>` vertex **)**
|
||||
|
||||
Specifies the position of current vertex. Should be called after specifying other vertex properties (e.g. Color, UV).
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_append_from:
|
||||
|
||||
- void **append_from** **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`Transform3D<class_Transform3D>` transform **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **append_from** **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`Transform3D<class_Transform3D>` transform **)**
|
||||
|
||||
Append vertices from a given :ref:`Mesh<class_Mesh>` surface onto the current vertex array with specified :ref:`Transform3D<class_Transform3D>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_begin:
|
||||
|
||||
- void **begin** **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **begin** **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive **)**
|
||||
|
||||
Called before adding any vertices. Takes the primitive type as an argument (e.g. :ref:`Mesh.PRIMITIVE_TRIANGLES<class_Mesh_constant_PRIMITIVE_TRIANGLES>`).
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_clear:
|
||||
|
||||
- void **clear** **(** **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **clear** **(** **)**
|
||||
|
||||
Clear all information passed into the surface tool so far.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_commit:
|
||||
|
||||
- :ref:`ArrayMesh<class_ArrayMesh>` **commit** **(** :ref:`ArrayMesh<class_ArrayMesh>` existing=null, :ref:`int<class_int>` flags=0 **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`ArrayMesh<class_ArrayMesh>` **commit** **(** :ref:`ArrayMesh<class_ArrayMesh>` existing=null, :ref:`int<class_int>` flags=0 **)**
|
||||
|
||||
Returns a constructed :ref:`ArrayMesh<class_ArrayMesh>` from current information passed in. If an existing :ref:`ArrayMesh<class_ArrayMesh>` is passed in as an argument, will add an extra surface to the existing :ref:`ArrayMesh<class_ArrayMesh>`.
|
||||
|
||||
\ **FIXME:** Document possible values for ``flags``, it changed in 4.0. Likely some combinations of :ref:`ArrayFormat<enum_Mesh_ArrayFormat>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_commit_to_arrays:
|
||||
|
||||
- :ref:`Array<class_Array>` **commit_to_arrays** **(** **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`Array<class_Array>` **commit_to_arrays** **(** **)**
|
||||
|
||||
Commits the data to the same format used by :ref:`ArrayMesh.add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`. This way you can further process the mesh data using the :ref:`ArrayMesh<class_ArrayMesh>` API.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_create_from:
|
||||
|
||||
- void **create_from** **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **create_from** **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface **)**
|
||||
|
||||
Creates a vertex array from an existing :ref:`Mesh<class_Mesh>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_create_from_blend_shape:
|
||||
|
||||
- void **create_from_blend_shape** **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`String<class_String>` blend_shape **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **create_from_blend_shape** **(** :ref:`Mesh<class_Mesh>` existing, :ref:`int<class_int>` surface, :ref:`String<class_String>` blend_shape **)**
|
||||
|
||||
Creates a vertex array from the specified blend shape of an existing :ref:`Mesh<class_Mesh>`. This can be used to extract a specific pose from a blend shape.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_deindex:
|
||||
|
||||
- void **deindex** **(** **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **deindex** **(** **)**
|
||||
|
||||
Removes the index array by expanding the vertex array.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_generate_lod:
|
||||
|
||||
- :ref:`PackedInt32Array<class_PackedInt32Array>` **generate_lod** **(** :ref:`float<class_float>` nd_threshold, :ref:`int<class_int>` target_index_count=3 **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`PackedInt32Array<class_PackedInt32Array>` **generate_lod** **(** :ref:`float<class_float>` nd_threshold, :ref:`int<class_int>` target_index_count=3 **)**
|
||||
|
||||
Generates a LOD for a given ``nd_threshold`` in linear units (square root of quadric error metric), using at most ``target_index_count`` indices.
|
||||
|
||||
Deprecated. Unused internally and neglects to preserve normals or UVs. Consider using :ref:`ImporterMesh.generate_lods<class_ImporterMesh_method_generate_lods>` instead.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_generate_normals:
|
||||
|
||||
- void **generate_normals** **(** :ref:`bool<class_bool>` flip=false **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **generate_normals** **(** :ref:`bool<class_bool>` flip=false **)**
|
||||
|
||||
Generates normals from vertices so you do not have to do it manually. If ``flip`` is ``true``, the resulting normals will be inverted. :ref:`generate_normals<class_SurfaceTool_method_generate_normals>` should be called *after* generating geometry and *before* committing the mesh using :ref:`commit<class_SurfaceTool_method_commit>` or :ref:`commit_to_arrays<class_SurfaceTool_method_commit_to_arrays>`. For correct display of normal-mapped surfaces, you will also have to generate tangents using :ref:`generate_tangents<class_SurfaceTool_method_generate_tangents>`.
|
||||
|
||||
@@ -296,43 +417,63 @@ Generates normals from vertices so you do not have to do it manually. If ``flip`
|
||||
|
||||
\ **Note:** :ref:`generate_normals<class_SurfaceTool_method_generate_normals>` takes smooth groups into account. If you don't specify any smooth group for each vertex, :ref:`generate_normals<class_SurfaceTool_method_generate_normals>` will smooth normals for you.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_generate_tangents:
|
||||
|
||||
- void **generate_tangents** **(** **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **generate_tangents** **(** **)**
|
||||
|
||||
Generates a tangent vector for each vertex. Requires that each vertex have UVs and normals set already (see :ref:`generate_normals<class_SurfaceTool_method_generate_normals>`).
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_get_aabb:
|
||||
|
||||
- :ref:`AABB<class_AABB>` **get_aabb** **(** **)** |const|
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`AABB<class_AABB>` **get_aabb** **(** **)** |const|
|
||||
|
||||
Returns the axis-aligned bounding box of the vertex positions.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_get_custom_format:
|
||||
|
||||
- :ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **get_custom_format** **(** :ref:`int<class_int>` channel_index **)** |const|
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` **get_custom_format** **(** :ref:`int<class_int>` channel_index **)** |const|
|
||||
|
||||
Returns the format for custom ``channel_index`` (currently up to 4). Returns :ref:`CUSTOM_MAX<class_SurfaceTool_constant_CUSTOM_MAX>` if this custom channel is unused.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_get_primitive_type:
|
||||
|
||||
- :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **get_primitive_type** **(** **)** |const|
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **get_primitive_type** **(** **)** |const|
|
||||
|
||||
Returns the type of mesh geometry, such as :ref:`Mesh.PRIMITIVE_TRIANGLES<class_Mesh_constant_PRIMITIVE_TRIANGLES>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_get_skin_weight_count:
|
||||
|
||||
- :ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` **get_skin_weight_count** **(** **)** |const|
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` **get_skin_weight_count** **(** **)** |const|
|
||||
|
||||
By default, returns :ref:`SKIN_4_WEIGHTS<class_SurfaceTool_constant_SKIN_4_WEIGHTS>` to indicate only 4 bone influences per vertex are used.
|
||||
|
||||
@@ -340,81 +481,117 @@ Returns :ref:`SKIN_8_WEIGHTS<class_SurfaceTool_constant_SKIN_8_WEIGHTS>` if up t
|
||||
|
||||
\ **Note:** This function returns an enum, not the exact number of weights.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_index:
|
||||
|
||||
- void **index** **(** **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **index** **(** **)**
|
||||
|
||||
Shrinks the vertex array by creating an index array. This can improve performance by avoiding vertex reuse.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_optimize_indices_for_cache:
|
||||
|
||||
- void **optimize_indices_for_cache** **(** **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **optimize_indices_for_cache** **(** **)**
|
||||
|
||||
Optimizes triangle sorting for performance. Requires that :ref:`get_primitive_type<class_SurfaceTool_method_get_primitive_type>` is :ref:`Mesh.PRIMITIVE_TRIANGLES<class_Mesh_constant_PRIMITIVE_TRIANGLES>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_bones:
|
||||
|
||||
- void **set_bones** **(** :ref:`PackedInt32Array<class_PackedInt32Array>` bones **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_bones** **(** :ref:`PackedInt32Array<class_PackedInt32Array>` bones **)**
|
||||
|
||||
Specifies an array of bones to use for the *next* vertex. ``bones`` must contain 4 integers.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_color:
|
||||
|
||||
- void **set_color** **(** :ref:`Color<class_Color>` color **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_color** **(** :ref:`Color<class_Color>` color **)**
|
||||
|
||||
Specifies a :ref:`Color<class_Color>` to use for the *next* vertex. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
|
||||
|
||||
\ **Note:** The material must have :ref:`BaseMaterial3D.vertex_color_use_as_albedo<class_BaseMaterial3D_property_vertex_color_use_as_albedo>` enabled for the vertex color to be visible.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_custom:
|
||||
|
||||
- void **set_custom** **(** :ref:`int<class_int>` channel_index, :ref:`Color<class_Color>` custom_color **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_custom** **(** :ref:`int<class_int>` channel_index, :ref:`Color<class_Color>` custom_color **)**
|
||||
|
||||
Sets the custom value on this vertex for ``channel_index``.
|
||||
|
||||
\ :ref:`set_custom_format<class_SurfaceTool_method_set_custom_format>` must be called first for this ``channel_index``. Formats which are not RGBA will ignore other color channels.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_custom_format:
|
||||
|
||||
- void **set_custom_format** **(** :ref:`int<class_int>` channel_index, :ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` format **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_custom_format** **(** :ref:`int<class_int>` channel_index, :ref:`CustomFormat<enum_SurfaceTool_CustomFormat>` format **)**
|
||||
|
||||
Sets the color format for this custom ``channel_index``. Use :ref:`CUSTOM_MAX<class_SurfaceTool_constant_CUSTOM_MAX>` to disable.
|
||||
|
||||
Must be invoked after :ref:`begin<class_SurfaceTool_method_begin>` and should be set before :ref:`commit<class_SurfaceTool_method_commit>` or :ref:`commit_to_arrays<class_SurfaceTool_method_commit_to_arrays>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_material:
|
||||
|
||||
- void **set_material** **(** :ref:`Material<class_Material>` material **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_material** **(** :ref:`Material<class_Material>` material **)**
|
||||
|
||||
Sets :ref:`Material<class_Material>` to be used by the :ref:`Mesh<class_Mesh>` you are constructing.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_normal:
|
||||
|
||||
- void **set_normal** **(** :ref:`Vector3<class_Vector3>` normal **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_normal** **(** :ref:`Vector3<class_Vector3>` normal **)**
|
||||
|
||||
Specifies a normal to use for the *next* vertex. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_skin_weight_count:
|
||||
|
||||
- void **set_skin_weight_count** **(** :ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` count **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_skin_weight_count** **(** :ref:`SkinWeightCount<enum_SurfaceTool_SkinWeightCount>` count **)**
|
||||
|
||||
Set to :ref:`SKIN_8_WEIGHTS<class_SurfaceTool_constant_SKIN_8_WEIGHTS>` to indicate that up to 8 bone influences per vertex may be used.
|
||||
|
||||
@@ -422,43 +599,63 @@ By default, only 4 bone influences are used (:ref:`SKIN_4_WEIGHTS<class_SurfaceT
|
||||
|
||||
\ **Note:** This function takes an enum, not the exact number of weights.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_smooth_group:
|
||||
|
||||
- void **set_smooth_group** **(** :ref:`int<class_int>` index **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_smooth_group** **(** :ref:`int<class_int>` index **)**
|
||||
|
||||
Specifies whether the current vertex (if using only vertex arrays) or current index (if also using index arrays) should use smooth normals for normal calculation.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_tangent:
|
||||
|
||||
- void **set_tangent** **(** :ref:`Plane<class_Plane>` tangent **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_tangent** **(** :ref:`Plane<class_Plane>` tangent **)**
|
||||
|
||||
Specifies a tangent to use for the *next* vertex. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_uv:
|
||||
|
||||
- void **set_uv** **(** :ref:`Vector2<class_Vector2>` uv **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_uv** **(** :ref:`Vector2<class_Vector2>` uv **)**
|
||||
|
||||
Specifies a set of UV coordinates to use for the *next* vertex. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_uv2:
|
||||
|
||||
- void **set_uv2** **(** :ref:`Vector2<class_Vector2>` uv2 **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_uv2** **(** :ref:`Vector2<class_Vector2>` uv2 **)**
|
||||
|
||||
Specifies an optional second set of UV coordinates to use for the *next* vertex. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_SurfaceTool_method_set_weights:
|
||||
|
||||
- void **set_weights** **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` weights **)**
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **set_weights** **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` weights **)**
|
||||
|
||||
Specifies weight values to use for the *next* vertex. ``weights`` must contain 4 values. If every vertex needs to have this information set and you fail to submit it for the first vertex, this information may not be used at all.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user