newMesh.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. return {
  2. tag = 'graphicsObjects',
  3. summary = 'Create a new Mesh.',
  4. description = [[
  5. Creates a new Mesh. Meshes contain the data for an arbitrary set of vertices, and can be drawn.
  6. You must specify either the capacity for the Mesh or an initial set of vertex data. Optionally,
  7. a custom format table can be used to specify the set of vertex attributes the mesh will provide
  8. to the active shader. The draw mode and usage hint can also optionally be specified.
  9. The default data type for an attribute is `float`, and the default component count is 1.
  10. ]],
  11. arguments = {
  12. size = {
  13. type = 'number',
  14. description = 'The maximum number of vertices the Mesh can store.'
  15. },
  16. mode = {
  17. type = 'DrawMode',
  18. default = [['fan']],
  19. description = 'How the Mesh will connect its vertices into triangles.'
  20. },
  21. usage = {
  22. type = 'MeshUsage',
  23. default = [['dynamic']],
  24. description = [[
  25. An optimization hint indicating how often the data in the Mesh will be updated.
  26. ]]
  27. },
  28. readable = {
  29. type = 'boolean',
  30. default = 'false',
  31. description = 'Whether vertices from the Mesh can be read.'
  32. },
  33. vertices = {
  34. type = 'table',
  35. description = 'A table of vertices. Each vertex is a table containing the vertex data.'
  36. },
  37. blob = {
  38. type = 'Blob',
  39. description = 'A binary Blob containing vertex data.'
  40. },
  41. format = {
  42. type = 'table',
  43. description = 'A table describing the attribute format for the vertices.'
  44. }
  45. },
  46. returns = {
  47. mesh = {
  48. type = 'Mesh',
  49. description = 'The new Mesh.'
  50. }
  51. },
  52. variants = {
  53. {
  54. arguments = { 'size', 'mode', 'usage', 'readable' },
  55. returns = { 'mesh' }
  56. },
  57. {
  58. arguments = { 'vertices', 'mode', 'usage', 'readable' },
  59. returns = { 'mesh' }
  60. },
  61. {
  62. arguments = { 'blob', 'mode', 'usage', 'readable' },
  63. returns = { 'mesh' }
  64. },
  65. {
  66. description = [[
  67. These variants accept a custom vertex format. For more info, see the `Mesh` page.
  68. ]],
  69. arguments = { 'format', 'size', 'mode', 'usage', 'readable' },
  70. returns = { 'mesh' }
  71. },
  72. {
  73. arguments = { 'format', 'vertices', 'mode', 'usage', 'readable' },
  74. returns = { 'mesh' }
  75. },
  76. {
  77. arguments = { 'format', 'blob', 'mode', 'usage', 'readable' },
  78. returns = { 'mesh' }
  79. }
  80. },
  81. notes = [[
  82. Once created, the size and format of the Mesh cannot be changed.'
  83. The default mesh format is:
  84. {
  85. { 'lovrPosition', 'float', 3 },
  86. { 'lovrNormal', 'float', 3 },
  87. { 'lovrTexCoord', 'float', 2 }
  88. }
  89. ]]
  90. }