{{newin (日本語)|[[0.10.0 (日本語)|0.10.0]]|100|type=関数}}
Attaches a vertex attribute from a different Mesh onto this Mesh, for use when drawing. This can be used to share vertex attribute data between several different Meshes.
== 関数 ==
=== 概要 ===
<source lang="lua">
Mesh:attachAttribute( name, mesh )
</source>
=== 引数 ===
{{param (日本語)|string|name|The name of the vertex attribute to attach.}}
{{param (日本語)|Mesh|mesh|The Mesh to get the vertex attribute from.}}
=== 返値 ===
ありません。

== 関数 ==
{{newin (日本語)|[[11.0 (日本語)|11.0]]|110|type=異形}}
=== 概要 ===
<source lang="lua">
Mesh:attachAttribute( name, mesh, step, attachname )
</source>
=== 引数 ===
{{param (日本語)|string|name|The name of the vertex attribute to attach.}}
{{param (日本語)|Mesh|mesh|The Mesh to get the vertex attribute from.}}
{{param (日本語)|VertexAttributeStep|step ("pervertex")|Whether the attribute will be per-vertex or [[love.graphics.drawInstanced|per-instance]] when the mesh is drawn.}}
{{param (日本語)|string|attachname (name)|The name of the attribute to use in shader code. Defaults to the name of the attribute in the given mesh. Can be used to use a different name for this attribute when rendering.}}
=== 返値 ===
ありません。

== 注釈 ==
If a Mesh wasn't [[love.graphics.newMesh|created]] with a custom vertex format, it will have 3 vertex attributes named <code>VertexPosition</code>, <code>VertexTexCoord</code>, and <code>VertexColor</code>.

Custom named attributes can be accessed in a [[Shader|vertex shader]] by declaring them as <code>attribute vec4 MyCustomAttributeName;</code> at the top-level of the vertex shader code. The name must match what was specified in the Mesh's vertex format and in the <code>name</code> argument of [[Mesh:attachAttribute]].

== 関連 ==
* [[parent::Mesh (日本語)]]
* [[Mesh:getVertexFormat (日本語)]]
* [[love.graphics.draw (日本語)]]
[[Category:Functions (日本語)]]
{{#set:Description=Attaches a vertex attribute from a different Mesh onto this Mesh, for use when drawing. Optionally allows per-[[love.graphics.drawInstanced|instance]] attributes.}}
== そのほかの言語 ==
{{i18n (日本語)|Mesh:attachAttribute}}