mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Remove trailing whitespace and irregular whitespace
This commit is contained in:
@@ -7,4 +7,3 @@ Creating content
|
||||
|
||||
procedural_geometry/index
|
||||
making_trees
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ which takes up to four parameters. The first two are required, while the second
|
||||
|
||||
The first is the ``PrimitiveType``, this is an OpenGL concept that instructs the GPU
|
||||
how to arrange the primitive based on the vertices given whether it is triangles,
|
||||
lines, points, etc. A complete list can be found under the :ref:`Mesh <class_mesh>`
|
||||
lines, points, etc. A complete list can be found under the :ref:`Mesh <class_mesh>`
|
||||
class reference page.
|
||||
|
||||
The second is the actual Array that stores the mesh information. The array is a normal Godot array that
|
||||
@@ -202,7 +202,7 @@ that you find online.
|
||||
|
||||
Combined with the code above, this code will generate a sphere.
|
||||
|
||||
When it comes to generating geometry with the ArrayMesh you need to understand what goes
|
||||
When it comes to generating geometry with the ArrayMesh you need to understand what goes
|
||||
in each array and then you can follow tutorials for any language/engine and convert it into Godot.
|
||||
|
||||
Saving
|
||||
|
||||
@@ -2,8 +2,8 @@ Procedural geometry
|
||||
===================
|
||||
|
||||
There are many ways to procedurally generate geometry in Godot. In this tutorial series
|
||||
we will explore a few of them. Each technique has its own benefits and drawbacks, so
|
||||
it is best to understand each one and how it can be useful in a given situation.
|
||||
we will explore a few of them. Each technique has its own benefits and drawbacks, so
|
||||
it is best to understand each one and how it can be useful in a given situation.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
@@ -23,19 +23,19 @@ by an array of positions called "vertices". In Godot, geometry is represented by
|
||||
What is a Mesh?
|
||||
---------------
|
||||
|
||||
Many things in Godot have mesh in their name: the :ref:`Mesh <class_Mesh>`, the :ref:`ArrayMesh <class_ArrayMesh>`,
|
||||
the :ref:`MeshInstance <class_MeshInstance>`, the :ref:`MultiMesh <class_MultiMesh>`, and
|
||||
the :ref:`MultiMeshInstance <class_MultiMeshInstance>`. While they are all related, they have slightly different uses.
|
||||
Many things in Godot have mesh in their name: the :ref:`Mesh <class_Mesh>`, the :ref:`ArrayMesh <class_ArrayMesh>`,
|
||||
the :ref:`MeshInstance <class_MeshInstance>`, the :ref:`MultiMesh <class_MultiMesh>`, and
|
||||
the :ref:`MultiMeshInstance <class_MultiMeshInstance>`. While they are all related, they have slightly different uses.
|
||||
|
||||
Meshes and ArrayMeshes are resources that are drawn using a MeshInstance node. Resources like
|
||||
Meshes and ArrayMeshes cannot be added to the scene directly. A MeshInstance represents one
|
||||
instance of a mesh in your scene. You can reuse a single mesh in multiple MeshInstances
|
||||
to draw it in different parts of your scene with different materials or transformations (scale,
|
||||
rotation, position etc.).
|
||||
Meshes and ArrayMeshes are resources that are drawn using a MeshInstance node. Resources like
|
||||
Meshes and ArrayMeshes cannot be added to the scene directly. A MeshInstance represents one
|
||||
instance of a mesh in your scene. You can reuse a single mesh in multiple MeshInstances
|
||||
to draw it in different parts of your scene with different materials or transformations (scale,
|
||||
rotation, position etc.).
|
||||
|
||||
If you are going to draw the same object many times, it can be helpful to use a MultiMesh with
|
||||
a MultiMeshInstance. The MultiMeshInstance draws meshes thousands of times very
|
||||
cheaply. It takes advantage of hardware instancing in order to do so. The drawback with
|
||||
If you are going to draw the same object many times, it can be helpful to use a MultiMesh with
|
||||
a MultiMeshInstance. The MultiMeshInstance draws meshes thousands of times very
|
||||
cheaply. It takes advantage of hardware instancing in order to do so. The drawback with
|
||||
using a MultiMeshInstance is that you are limited to one material for all instances. It uses an
|
||||
instance array to store different colors and transformations for each instance, but all the
|
||||
instances use the same material.
|
||||
@@ -58,15 +58,15 @@ Surface array
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
The surface array is an array of length ``ArrayMesh.ARRAY_MAX``. Each position in the array is
|
||||
filled with a sub-array containing per-vertex information. For example, the array located at
|
||||
``ArrayMesh.ARRAY_NORMAL`` is a :ref:`PackedVector3Array <class_PackedVector3Array>` of vertex normals.
|
||||
filled with a sub-array containing per-vertex information. For example, the array located at
|
||||
``ArrayMesh.ARRAY_NORMAL`` is a :ref:`PackedVector3Array <class_PackedVector3Array>` of vertex normals.
|
||||
|
||||
The surface array can be indexed or non-indexed. Creating a non-indexed array is as easy as not assigning
|
||||
an array at the index ``ArrayMesh.ARRAY_INDEX``. A non-indexed array stores unique vertex information for
|
||||
every triangle, meaning that when two triangle share a vertex, the vertex is duplicated in the array. An
|
||||
indexed surface array only stores vertex information for each unique vertex and then also stores an array
|
||||
of indices which maps out how to construct the triangles from the vertex array. In general, using an indexed
|
||||
array is faster, but it means you have to share vertex data between triangles, which is not always desired
|
||||
every triangle, meaning that when two triangle share a vertex, the vertex is duplicated in the array. An
|
||||
indexed surface array only stores vertex information for each unique vertex and then also stores an array
|
||||
of indices which maps out how to construct the triangles from the vertex array. In general, using an indexed
|
||||
array is faster, but it means you have to share vertex data between triangles, which is not always desired
|
||||
(e.g. when you want per-face normals).
|
||||
|
||||
Tools
|
||||
@@ -78,7 +78,7 @@ be provided in the following tutorials.
|
||||
ArrayMesh
|
||||
^^^^^^^^^
|
||||
|
||||
The ArrayMesh resource extends Mesh to add a few different quality of life functions, and most
|
||||
The ArrayMesh resource extends Mesh to add a few different quality of life functions, and most
|
||||
importantly, the ability to construct a Mesh surface through scripting.
|
||||
|
||||
For more information about the ArrayMesh, please see the :ref:`ArrayMesh tutorial <doc_arraymesh>`.
|
||||
@@ -86,7 +86,7 @@ For more information about the ArrayMesh, please see the :ref:`ArrayMesh tutoria
|
||||
MeshDataTool
|
||||
^^^^^^^^^^^^
|
||||
|
||||
The MeshDataTool is a resource that converts Mesh data into arrays of vertices, faces, and edges that can
|
||||
The MeshDataTool is a resource that converts Mesh data into arrays of vertices, faces, and edges that can
|
||||
be modified at runtime.
|
||||
|
||||
For more information about the MeshDataTool, please see the :ref:`MeshDataTool tutorial <doc_meshdatatool>`.
|
||||
@@ -94,7 +94,7 @@ For more information about the MeshDataTool, please see the :ref:`MeshDataTool t
|
||||
SurfaceTool
|
||||
^^^^^^^^^^^
|
||||
|
||||
The SurfaceTool allows the creation of Meshes using an OpenGL 1.x immediate mode style interface.
|
||||
The SurfaceTool allows the creation of Meshes using an OpenGL 1.x immediate mode style interface.
|
||||
|
||||
For more information about the SurfaceTool, please see the :ref:`SurfaceTool tutorial <doc_surfacetool>`.
|
||||
|
||||
@@ -103,11 +103,11 @@ ImmediateGeometry
|
||||
|
||||
ImmediateGeometry is a node that uses an immediate mode style interface (like SurfaceTool) to draw objects. The
|
||||
difference between ImmediateGeometry and the SurfaceTool is that ImmediateGeometry is a node itself that can be
|
||||
added to the scene tree and is drawn directly from the code. The SurfaceTool generates a Mesh that needs to be added
|
||||
a MeshInstance to be seen.
|
||||
added to the scene tree and is drawn directly from the code. The SurfaceTool generates a Mesh that needs to be added
|
||||
a MeshInstance to be seen.
|
||||
|
||||
ImmediateGeometry is useful for prototyping because of the straightforward API, but it is slow because the geometry
|
||||
is rebuilt every frame. It is most useful for quickly adding simple geometry to debug visually (e.g. by drawing lines to
|
||||
is rebuilt every frame. It is most useful for quickly adding simple geometry to debug visually (e.g. by drawing lines to
|
||||
visualize physics raycasts etc.).
|
||||
|
||||
For more information about ImmediateGeometry, please see the :ref:`ImmediateGeometry tutorial <doc_immediategeometry>`.
|
||||
@@ -126,7 +126,7 @@ ImmediateGeometry regenerates the mesh every frame, so it is much slower than Ar
|
||||
need the geometry to change every frame anyway it provides a much easier interface that may even be a little faster than generating
|
||||
an ArrayMesh every frame.
|
||||
|
||||
The MeshDataTool is not fast, but it gives you access to all kinds of properties of the mesh that you don't get with the others
|
||||
The MeshDataTool is not fast, but it gives you access to all kinds of properties of the mesh that you don't get with the others
|
||||
(edges, faces, etc.). It is incredibly useful when you need that sort of data to transform the mesh, but it is not a good idea
|
||||
to use if that information is not needed. The MeshDataTool is best used if you are going to be using an algorithm that requires
|
||||
access to the face or edge array.
|
||||
|
||||
@@ -4,10 +4,10 @@ Using the MeshDataTool
|
||||
======================
|
||||
|
||||
The MeshDataTool is not used to generate geometry. But it is helpful for dynamically altering geometry, for example
|
||||
if you want to write a script to tessellate, simplify, or deform meshes.
|
||||
if you want to write a script to tessellate, simplify, or deform meshes.
|
||||
|
||||
The MeshDataTool is not as fast as altering arrays directly using ArrayMesh. However, it provides more information
|
||||
and tools to work with meshes than the ArrayMesh does. When the MeshDataTool
|
||||
and tools to work with meshes than the ArrayMesh does. When the MeshDataTool
|
||||
is used, it calculates mesh data that is not available in ArrayMeshes such as faces and edges, which are necessary
|
||||
for certain mesh algorithms. If you do not need this extra information then it may be better to use an ArrayMesh.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user