getCanvas.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. return {
  2. tag = 'canvas',
  3. summary = 'Get the Pass\'s canvas.',
  4. description = [[
  5. Returns the Pass's canvas, or `nil` if the Pass doesn't have a canvas. The canvas is a set of
  6. textures that the Pass will draw to when it's submitted.
  7. ]],
  8. arguments = {},
  9. returns = {
  10. canvas = {
  11. type = 'table',
  12. description = [[
  13. The canvas. Numeric keys will contain the color Textures, along with the following keys:
  14. ]],
  15. table = {
  16. {
  17. name = 'depth',
  18. type = '*',
  19. description = 'A `Texture` or `TextureFormat` with the depth buffer.'
  20. },
  21. {
  22. name = 'samples',
  23. type = 'number',
  24. description = 'The number of multisamples used for antialiasing (either 1 or 4).'
  25. }
  26. }
  27. }
  28. },
  29. variants = {
  30. {
  31. arguments = {},
  32. returns = { 'canvas' }
  33. },
  34. {
  35. description = 'This function returns nil when a canvas hasn\'t been set.',
  36. arguments = {},
  37. returns = {}
  38. }
  39. },
  40. notes = [[
  41. If the Pass has multiple color textures, a fragment shader should be used to write a different
  42. color to each texture. Here's an example that writes red to the first texture and blue to the
  43. second texture:
  44. // Declare an output variable for the second texture
  45. layout(location = 1) out vec4 secondColor;
  46. vec4 lovrmain() {
  47. secondColor = vec4(0, 0, 1, 1);
  48. return vec4(1, 0, 0, 1);
  49. }
  50. ]],
  51. related = {
  52. 'Pass:getClear',
  53. 'Pass:setClear',
  54. 'Pass:getWidth',
  55. 'Pass:getHeight',
  56. 'Pass:getDimensions'
  57. }
  58. }