mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
222 lines
9.6 KiB
ReStructuredText
222 lines
9.6 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ImmediateMesh.xml.
|
|
|
|
.. _class_ImmediateMesh:
|
|
|
|
ImmediateMesh
|
|
=============
|
|
|
|
**继承:** :ref:`Mesh<class_Mesh>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
为手动创建几何体,而优化的网格。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
描述
|
|
----
|
|
|
|
针对手动创建几何体优化的网格类型,与 OpenGL 1.x 的立即模式类似。
|
|
|
|
以下是生成三角形面的示例:
|
|
|
|
|
|
.. tabs::
|
|
|
|
.. code-tab:: gdscript
|
|
|
|
var mesh = ImmediateMesh.new()
|
|
mesh.surface_begin(Mesh.PRIMITIVE_TRIANGLES)
|
|
mesh.surface_add_vertex(Vector3.LEFT)
|
|
mesh.surface_add_vertex(Vector3.FORWARD)
|
|
mesh.surface_add_vertex(Vector3.ZERO)
|
|
mesh.surface_end()
|
|
|
|
.. code-tab:: csharp
|
|
|
|
var mesh = new ImmediateMesh();
|
|
mesh.SurfaceBegin(Mesh.PrimitiveType.Triangles);
|
|
mesh.SurfaceAddVertex(Vector3.Left);
|
|
mesh.SurfaceAddVertex(Vector3.Forward);
|
|
mesh.SurfaceAddVertex(Vector3.Zero);
|
|
mesh.SurfaceEnd();
|
|
|
|
|
|
|
|
\ **注意:**\ 使用 **ImmediateMesh** 生成复杂的几何体极其低效。这种网格的设计目的是用来生成经常变化的简单几何体。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
教程
|
|
----
|
|
|
|
- :doc:`使用 ImmediateMesh <../tutorials/3d/procedural_geometry/immediatemesh>`
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
方法
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_surfaces<class_ImmediateMesh_method_clear_surfaces>`\ (\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_add_vertex<class_ImmediateMesh_method_surface_add_vertex>`\ (\ vertex\: :ref:`Vector3<class_Vector3>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_add_vertex_2d<class_ImmediateMesh_method_surface_add_vertex_2d>`\ (\ vertex\: :ref:`Vector2<class_Vector2>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_begin<class_ImmediateMesh_method_surface_begin>`\ (\ primitive\: :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`, material\: :ref:`Material<class_Material>` = null\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_end<class_ImmediateMesh_method_surface_end>`\ (\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_set_color<class_ImmediateMesh_method_surface_set_color>`\ (\ color\: :ref:`Color<class_Color>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_set_normal<class_ImmediateMesh_method_surface_set_normal>`\ (\ normal\: :ref:`Vector3<class_Vector3>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_set_tangent<class_ImmediateMesh_method_surface_set_tangent>`\ (\ tangent\: :ref:`Plane<class_Plane>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_set_uv<class_ImmediateMesh_method_surface_set_uv>`\ (\ uv\: :ref:`Vector2<class_Vector2>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`surface_set_uv2<class_ImmediateMesh_method_surface_set_uv2>`\ (\ uv2\: :ref:`Vector2<class_Vector2>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
方法说明
|
|
--------
|
|
|
|
.. _class_ImmediateMesh_method_clear_surfaces:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_surfaces**\ (\ ) :ref:`🔗<class_ImmediateMesh_method_clear_surfaces>`
|
|
|
|
清除所有表面。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_add_vertex:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_add_vertex**\ (\ vertex\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_add_vertex>`
|
|
|
|
使用先前设置的当前属性,添加一个 3D 顶点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_add_vertex_2d:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_add_vertex_2d**\ (\ vertex\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_add_vertex_2d>`
|
|
|
|
使用先前设置的当前属性,添加一个 2D 顶点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_begin:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_begin**\ (\ primitive\: :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`, material\: :ref:`Material<class_Material>` = null\ ) :ref:`🔗<class_ImmediateMesh_method_surface_begin>`
|
|
|
|
开始一个新的表面。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_end:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_end**\ (\ ) :ref:`🔗<class_ImmediateMesh_method_surface_end>`
|
|
|
|
结束并提交当前表面。请注意,在该函数被调用之前,创建的表面将不可见。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_set_color:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_set_color**\ (\ color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_color>`
|
|
|
|
设置将与下一个顶点一起推送的颜色属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_set_normal:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_set_normal**\ (\ normal\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_normal>`
|
|
|
|
设置将与下一个顶点一起推送的法线属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_set_tangent:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_set_tangent**\ (\ tangent\: :ref:`Plane<class_Plane>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_tangent>`
|
|
|
|
设置将与下一个顶点一起推送的切线属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_set_uv:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_set_uv**\ (\ uv\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_uv>`
|
|
|
|
设置将与下一个顶点一起推送的 UV 属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_ImmediateMesh_method_surface_set_uv2:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **surface_set_uv2**\ (\ uv2\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_uv2>`
|
|
|
|
设置将与下一个顶点一起推送的 UV2 属性。
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
|
|
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
|
|
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
|
|
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
|
|
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
|
|
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
|
|
.. |void| replace:: :abbr:`void (无返回值。)`
|