setVertex.lua 879 B

12345678910111213141516171819202122232425262728293031323334
  1. return {
  2. summary = 'Update a single vertex in the Mesh.',
  3. description = 'Update a single vertex in the Mesh.',
  4. arguments = {
  5. {
  6. name = 'index',
  7. type = 'number',
  8. description = 'The index of the vertex to set.'
  9. },
  10. {
  11. name = '...',
  12. type = 'number',
  13. description = 'The attributes of the vertex.'
  14. }
  15. },
  16. returns = {},
  17. notes = 'Any unspecified components will be set to 0.',
  18. example = {
  19. description = 'Set the position of a vertex:',
  20. code = [[
  21. function lovr.load()
  22. mesh = lovr.graphics.newMesh({
  23. { -1, 1, 0, 0, 0, 1, 0, 0 },
  24. { 1, 1, 0, 0, 0, 1, 1, 0 },
  25. { -1, -1, 0, 0, 0, 1, 0, 1 },
  26. { 1, -1, 0, 0, 0, 1, 1, 1 }
  27. }, 'strip')
  28. mesh:setVertex(2, { 7, 7, 7 })
  29. print(mesh:getVertex(2)) -- 7, 7, 7, 0, 0, 0, 0, 0
  30. end
  31. ]]
  32. }
  33. }