getVertices.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. return {
  2. summary = 'Get the vertices for a piece of text.',
  3. description = [[
  4. Returns a table of vertices for a piece of text, along with a Material to use when rendering it.
  5. The Material returned by this function may not be the same if the Font's texture atlas needs to
  6. be recreated with a bigger size to make room for more glyphs.
  7. ]],
  8. arguments = {
  9. string = {
  10. type = 'string',
  11. description = 'The text to render.'
  12. },
  13. strings = {
  14. type = 'table',
  15. description = [[
  16. A table of colored strings, each given as a `{ color, string }` pair. The color can be a
  17. `Vec3`, `Vec4`, table, or hexcode.
  18. ]]
  19. },
  20. wrap = {
  21. type = 'number',
  22. default = '0',
  23. description = [[
  24. The maximum line length. The units depend on the pixel density of the font, but are in
  25. meters by default.
  26. ]]
  27. },
  28. halign = {
  29. type = 'HorizontalAlign',
  30. description = 'The horizontal align.'
  31. },
  32. valign = {
  33. type = 'VerticalAlign',
  34. description = 'The vertical align.'
  35. }
  36. },
  37. returns = {
  38. vertices = {
  39. type = 'table',
  40. description = 'The table of vertices. See below for the format of each vertex.'
  41. },
  42. material = {
  43. type = 'Material',
  44. description = 'A Material to use when rendering the vertices.'
  45. }
  46. },
  47. variants = {
  48. {
  49. arguments = { 'string', 'wrap', 'halign', 'valign' },
  50. returns = { 'vertices', 'material' }
  51. },
  52. {
  53. arguments = { 'strings', 'wrap', 'halign', 'valign' },
  54. returns = { 'vertices', 'material' }
  55. }
  56. },
  57. notes = [[
  58. Each vertex is a table of 4 floating point numbers with the following data:
  59. { x, y, u, v }
  60. These could be placed in a vertex buffer using the following buffer format:
  61. { 'vec2:VertexPosition', 'vec2:VertexUV' }
  62. ]]
  63. }