{{newin (日本語)|[[0.9.0 (日本語)|0.9.0]]|090|type=関数}}
Sets the vertex map for the Mesh. The vertex map describes the order in which the vertices are used when the Mesh is drawn. The vertices, vertex map, and mesh draw mode work together to determine what exactly is displayed on the screen.

The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters or duplicating vertices. It is especially useful when combined with different [[MeshDrawMode|Mesh Draw Modes]].

== 関数 ==
=== 概要 ===
<source lang="lua">
Mesh:setVertexMap( map )
</source>
=== 引数 ===
{{param (日本語)|table|map|A table containing a list of vertex indices to use when drawing. Values must be in the range of [1, [[Mesh:getVertexCount|Mesh:getVertexCount()]]].}}
=== 返値 ===
ありません。

== 関数 ==
=== 概要 ===
<source lang="lua">
Mesh:setVertexMap( vi1, vi2, vi3, ... )
</source>
=== 引数 ===
{{param (日本語)|number|vi1|The index of the first vertex to use when drawing. Must be in the range of [1, [[Mesh:getVertexCount|Mesh:getVertexCount()]]].}}
{{param (日本語)|number|vi2|The index of the second vertex to use when drawing.}}
{{param (日本語)|number|vi3|The index of the third vertex to use when drawing.}}
=== 返値 ===
ありません。

== 関数 ==
{{newin (日本語)|[[11.0 (日本語)|11.0]]|110|type=異形}}
=== 概要 ===
<source lang="lua">
Mesh:setVertexMap( data, datatype )
</source>
=== 引数 ===
{{param (日本語)|Data|data|Array of vertex indices to use when drawing. Values must be in the range of [0, [[Mesh:getVertexCount|Mesh:getVertexCount()]]-1]}}
{{param (日本語)|IndexDataType|datatype|Datatype of the vertex indices array above.}}

=== 返値 ===
ありません。

== 用例 ==
Use a vertex map to fix a visual glitch without copy/pasting vertices.
<source lang="lua">
function love.load()
    image = love.graphics.newImage("pig.png")
    local w,h = image:getDimensions()

    -- We want to make a Mesh with 1 vertex in the middle of the image, and 4 at the corners.
    local vertices = {
        {w/2, h/2,   0.5, 0.5,   1, 0, 0}, -- Center vertex, with a red tint.
        {0,   0,     0,   0,     1, 1, 1}, -- Top left.
        {w,   0,     1,   0,     1, 1, 1}, -- Top right.
        {w,   h,     1,   1,     1, 1, 1}, -- Bottom right.
        {0,   h,     0,   1,     1, 1, 1}, -- Bottom left.
    }

    -- But there's a problem! The drawn mesh will have a big triangle missing on its left side.
    -- This is because, in the default mesh draw mode ("fan"), the vertices don't "loop": the top left vertex (#2) is unconnected to the bottom left one (#5).
    mesh = love.graphics.newMesh(vertices)
    mesh:setTexture(image)

    -- We could copy/paste the second vertex onto the end of the table of vertices.
    -- But instead we can just change the vertex map!
    mesh:setVertexMap(1, 2, 3, 4, 5, 2)
end

function love.draw()
    love.graphics.draw(mesh, 0, 0)
end
</source>

== 関連 ==
* [[parent::Mesh (日本語)]]
* [[Mesh:getVertexMap (日本語)]]
* [[MeshDrawMode (日本語)]]
[[Category:Functions (日本語)]]
{{#set:Description=Sets the vertex map for the Mesh.}}
== そのほかの言語 ==
{{i18n (日本語)|Mesh:setVertexMap}}