getViewport.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. return {
  2. tag = 'camera',
  3. summary = 'Get the viewport.',
  4. description = [[
  5. Returns the viewport, or `nil` if no viewport is set. Everything rendered will get mapped to
  6. the rectangle defined by the viewport. More specifically, this defines the transformation from
  7. normalized device coordinates to pixel coordinates.
  8. ]],
  9. arguments = {},
  10. returns = {
  11. x = {
  12. type = 'number',
  13. description = 'The x coordinate of the upper-left corner of the viewport.',
  14. },
  15. y = {
  16. type = 'number',
  17. description = 'The y coordinate of the upper-left corner of the viewport.',
  18. },
  19. w = {
  20. type = 'number',
  21. description = 'The width of the viewport.',
  22. },
  23. h = {
  24. type = 'number',
  25. description = 'The height of the viewport. May be negative.',
  26. },
  27. dmin = {
  28. type = 'number',
  29. default = '0.0',
  30. description = 'The min component of the depth range.'
  31. },
  32. dmax = {
  33. type = 'number',
  34. default = '1.0',
  35. description = 'The max component of the depth range.'
  36. }
  37. },
  38. variants = {
  39. {
  40. arguments = {},
  41. returns = { 'x', 'y', 'w', 'h', 'dmin', 'dmax' }
  42. }
  43. },
  44. notes = [[
  45. The viewport will apply to all draws in a Pass when the pass is submitted.
  46. The viewport rectangle can use floating point numbers.
  47. A negative viewport height (with a y coordinate equal to the bottom of the viewport) can be used
  48. to flip the rendering vertically.
  49. The default viewport extends from `(0, 0)` to the dimensions of the target textures, with min
  50. depth and max depth respectively set to 0 and 1.
  51. ]],
  52. related = {
  53. 'Pass:getScissor',
  54. 'Pass:setScissor',
  55. 'Pass:getDimensions'
  56. }
  57. }