mirror.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. return {
  2. tag = 'callbacks',
  3. summary = 'Called to render content to the desktop window.',
  4. description = [[
  5. This callback is called every frame after rendering to the headset and is usually used to render
  6. a mirror of the headset display onto the desktop window. It can be overridden for custom
  7. mirroring behavior. For example, a stereo view could be drawn instead of a single eye or a 2D
  8. HUD could be rendered.
  9. ]],
  10. arguments = {
  11. {
  12. name = 'pass',
  13. type = 'Pass',
  14. description = 'A render pass targeting the window.'
  15. }
  16. },
  17. returns = {
  18. {
  19. name = 'skip',
  20. type = 'boolean',
  21. description = 'If truthy, the input Pass will not be submitted to the GPU.'
  22. }
  23. },
  24. example = {
  25. description = [[
  26. The default `lovr.mirror` implementation draws the headset mirror texture to the window if
  27. the headset is active, or just calls `lovr.draw` if there isn't a headset.
  28. ]],
  29. code = [[
  30. function lovr.mirror(pass)
  31. if lovr.headset then
  32. local texture = lovr.headset.getTexture()
  33. if texture then
  34. pass:fill(texture)
  35. else
  36. return true
  37. end
  38. else
  39. return lovr.draw and lovr.draw(pass)
  40. end
  41. end
  42. ]]
  43. },
  44. related = {
  45. 'lovr.system.openWindow',
  46. 'lovr.draw'
  47. }
  48. }