draw.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. return {
  2. tag = 'callbacks',
  3. summary = 'Called continuously to render frames to the display.',
  4. description = [[
  5. This callback is called every frame, and receives a `Pass` object as an argument which can be
  6. used to render graphics to the display. If a VR headset is connected, this function renders to
  7. the headset display, otherwise it will render to the desktop window.
  8. ]],
  9. arguments = {
  10. {
  11. name = 'pass',
  12. type = 'Pass',
  13. description = 'A render pass targeting the main display (headset or window).'
  14. }
  15. },
  16. returns = {
  17. {
  18. name = 'skip',
  19. type = 'boolean',
  20. description = 'If truthy, the input Pass will not be submitted to the GPU.'
  21. }
  22. },
  23. notes = [[
  24. To render to the desktop window when a VR headset is connected, use the `lovr.mirror` callback.
  25. The display is cleared to the global background color before this callback is called, which can
  26. be changed using `lovr.graphics.setBackgroundColor`.
  27. Since the `lovr.graphics.submit` function always returns true, the following idiom can be used
  28. to submit graphics work manually and override the default submission:
  29. function lovr.draw(pass)
  30. local passes = {}
  31. -- ... record multiple passes and add to passes table
  32. return lovr.graphics.submit(passes)
  33. end
  34. ]],
  35. related = {
  36. 'lovr.mirror',
  37. 'lovr.headset.getPass',
  38. 'lovr.graphics.getWindowPass',
  39. 'lovr.graphics.setBackgroundColor'
  40. }
  41. }