Difference between revisions of "Mesh:attachAttribute"
(Updated with 11.0's changes...) |
(→See Also) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 13: | Line 13: | ||
== Function == | == Function == | ||
− | {{newin|[[11.0]]|110|type= | + | {{newin|[[11.0]]|110|type=variant}} |
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
Line 21: | Line 21: | ||
{{param|string|name|The name of the vertex attribute to attach.}} | {{param|string|name|The name of the vertex attribute to attach.}} | ||
{{param|Mesh|mesh|The Mesh to get the vertex attribute from.}} | {{param|Mesh|mesh|The Mesh to get the vertex attribute from.}} | ||
− | {{param| | + | {{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.}} | {{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.}} | ||
=== Returns === | === Returns === | ||
Line 34: | Line 34: | ||
* [[parent::Mesh]] | * [[parent::Mesh]] | ||
* [[Mesh:getVertexFormat]] | * [[Mesh:getVertexFormat]] | ||
+ | * [[Mesh:detachAttribute]] | ||
* [[love.graphics.draw]] | * [[love.graphics.draw]] | ||
[[Category:Functions]] | [[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.}} | {{#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.}} | ||
+ | |||
== Other Languages == | == Other Languages == | ||
{{i18n|Mesh:attachAttribute}} | {{i18n|Mesh:attachAttribute}} |
Latest revision as of 14:20, 22 August 2021
Available since LÖVE 0.10.0 |
This function is not supported in earlier versions. |
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.
Contents
Function
Synopsis
Mesh:attachAttribute( name, mesh )
Arguments
string name
- The name of the vertex attribute to attach.
Mesh mesh
- The Mesh to get the vertex attribute from.
Returns
Nothing.
Function
Available since LÖVE 11.0 |
This variant is not supported in earlier versions. |
Synopsis
Mesh:attachAttribute( name, mesh, step, attachname )
Arguments
string name
- The name of the vertex attribute to attach.
Mesh mesh
- The Mesh to get the vertex attribute from.
VertexAttributeStep step ("pervertex")
- Whether the attribute will be per-vertex or per-instance when the mesh is drawn.
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.
Returns
Nothing.
Notes
If a Mesh wasn't created with a custom vertex format, it will have 3 vertex attributes named VertexPosition
, VertexTexCoord
, and VertexColor
.
Custom named attributes can be accessed in a vertex shader by declaring them as attribute vec4 MyCustomAttributeName;
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 name
argument of Mesh:attachAttribute.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info