attachAttributes.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. return {
  2. summary = 'Attach attributes from another Mesh onto this one.',
  3. description = [[
  4. Attaches attributes from another Mesh onto this one. This can be used to share vertex data
  5. across multiple meshes without duplicating the data, and can also be used for instanced
  6. rendering by using the `divisor` parameter.
  7. ]],
  8. arguments = {
  9. mesh = {
  10. type = 'Mesh',
  11. description = 'The Mesh to attach attributes from.'
  12. },
  13. divisor = {
  14. type = 'number',
  15. default = '0',
  16. description = 'The attribute divisor for all attached attributes.'
  17. },
  18. attributes = {
  19. type = 'table',
  20. description = 'A table of attribute names to attach from the other Mesh.'
  21. },
  22. ['...'] = {
  23. type = 'string',
  24. description = 'The names of attributes to attach from the other Mesh.'
  25. }
  26. },
  27. returns = {},
  28. variants = {
  29. {
  30. description = 'Attach all attributes from the other mesh.',
  31. arguments = { 'mesh', 'divisor' },
  32. returns = {}
  33. },
  34. {
  35. arguments = { 'mesh', 'divisor', '...' },
  36. returns = {}
  37. },
  38. {
  39. arguments = { 'mesh', 'divisor', 'attributes' },
  40. returns = {}
  41. }
  42. },
  43. notes = [[
  44. The attribute divisor is a number used to control how the attribute data relates to instancing.
  45. If 0, then the attribute data is considered "per vertex", and each vertex will get the next
  46. element of the attribute's data. If the divisor 1 or more, then the attribute data is
  47. considered "per instance", and every N instances will get the next element of the attribute
  48. data.
  49. To prevent cycles, it is not possible to attach attributes onto a Mesh that already has
  50. attributes attached to a different Mesh.
  51. ]],
  52. related = {
  53. 'Mesh:detachAttributes',
  54. 'Mesh:drawInstanced'
  55. }
  56. }