getBackgroundColor.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. return {
  2. tag = 'graphics-global',
  3. summary = 'Get the background color.',
  4. description = [[
  5. Returns the global background color. The textures in a render pass will be cleared to this
  6. color at the beginning of the pass if no other clear option is specified. Additionally, the
  7. headset and window will be cleared to this color before rendering.
  8. ]],
  9. arguments = {},
  10. returns = {
  11. r = {
  12. type = 'number',
  13. description = 'The red component of the background color.',
  14. },
  15. g = {
  16. type = 'number',
  17. description = 'The green component of the background color.',
  18. },
  19. b = {
  20. type = 'number',
  21. description = 'The blue component of the background color.',
  22. },
  23. a = {
  24. type = 'number',
  25. description = 'The alpha component of the background color.',
  26. }
  27. },
  28. variants = {
  29. {
  30. arguments = {},
  31. returns = { 'r', 'g', 'b', 'a' }
  32. }
  33. },
  34. notes = [[
  35. Setting the background color in `lovr.draw` will apply on the following frame, since the default
  36. pass is cleared before `lovr.draw` is called.
  37. Internally, this color is applied to the default pass objects when retrieving one of them using
  38. `lovr.headset.getPass` or `lovr.graphics.getWindowPass`. Both are called automatically by the
  39. default `lovr.run` implementation.
  40. Using the background color to clear the display is expected to be more efficient than manually
  41. clearing after a render pass begins, especially on mobile GPUs.
  42. ]],
  43. related = {
  44. 'lovr.graphics.newPass',
  45. 'Pass:setClear',
  46. 'Texture:clear',
  47. 'Pass:fill'
  48. }
  49. }