Available since LÖVE 0.10.0
This function is not supported in earlier versions.
Sets the properties of a specific attribute within a vertex in the Mesh.
Meshes without a custom vertex format specified in love.graphics.newMesh have position as their first attribute, texture coordinates as their second attribute, and color as their third attribute.
Mesh:setVertexAttribute( vertexindex, attributeindex, value1, value2, ... )
number vertexindex
number attributeindex
number value1
number value2
number ...
Nothing.
Attribute components which exist within the attribute but are not specified as arguments default to 0 for attributes with the float
data type, and 255 for the byte
data type.
Modify the colors of a standard mesh after it's created.
-- Standard mesh with position, texture coordinates, and color attributes. mesh = love.graphics.newMesh { {0, 0, 0, 0, 255, 255, 255, 255}, -- first vertex positioned at (0, 0) {400, 0, 0, 0, 255, 255, 255, 255}, -- second vertex positioned at (400, 0) {200, 400, 0, 0, 255, 255, 255, 255}, -- third vertex positioned at (200, 400) } local time = 0 function love.update(dt) time = time + dt for i = 1, mesh:getVertexCount() do -- The 3rd vertex attribute for a standard mesh is its color. mesh:setVertexAttribute(i, 3, (time * 10) % 255, 255, 255) end end function love.draw() love.graphics.draw(mesh) end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/Mesh:setVertexAttribute