clear.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. return {
  2. tag = 'texture-transfer',
  3. summary = 'Clear the Texture to a color.',
  4. description = [[
  5. Clears layers and mipmaps in a texture to a given color.
  6. When a Texture is being used as a canvas for a `Pass`, the clear color can be set with
  7. `Pass:setClear`, which a more efficient way to clear the texture before rendering.
  8. ]],
  9. arguments = {
  10. hex = {
  11. type = 'number',
  12. description = 'The hexcode color to clear to.'
  13. },
  14. r = {
  15. type = 'number',
  16. description = 'The red component of the clear color.'
  17. },
  18. g = {
  19. type = 'number',
  20. description = 'The green component of the clear color.'
  21. },
  22. b = {
  23. type = 'number',
  24. description = 'The blue component of the clear color.'
  25. },
  26. a = {
  27. type = 'number',
  28. description = 'The alpha component of the clear color.'
  29. },
  30. t = {
  31. type = 'table',
  32. description = 'A table with color components.'
  33. },
  34. v3 = {
  35. type = 'Vec3',
  36. description = 'A vec3 with the clear color.'
  37. },
  38. v4 = {
  39. type = 'Vec4',
  40. description = 'A vec4 with the clear color.'
  41. },
  42. layer = {
  43. type = 'number',
  44. default = '1',
  45. description = 'The index of the first layer to clear.'
  46. },
  47. layerCount = {
  48. type = 'number',
  49. default = 'nil',
  50. description = 'The number of layers to clear. If nil, clears the rest of the layers.'
  51. },
  52. mipmap = {
  53. type = 'number',
  54. default = '1',
  55. description = 'The index of the first mipmap to clear.'
  56. },
  57. mipmapCount = {
  58. type = 'number',
  59. default = 'nil',
  60. description = 'The number of mipmaps to clear. If nil, clears the rest of the mipmaps.'
  61. }
  62. },
  63. returns = {},
  64. variants = {
  65. {
  66. description = 'Clear the whole texture to zero (transparent black).',
  67. arguments = {},
  68. returns = {}
  69. },
  70. {
  71. arguments = { 'hex', 'layer', 'layerCount', 'mipmap', 'mipmapCount' },
  72. returns = {}
  73. },
  74. {
  75. arguments = { 'r', 'g', 'b', 'a', 'layer', 'layerCount', 'mipmap', 'mipmapCount' },
  76. returns = {}
  77. },
  78. {
  79. arguments = { 't', 'layer', 'layerCount', 'mipmap', 'mipmapCount' },
  80. returns = {}
  81. },
  82. {
  83. arguments = { 'v3', 'layer', 'layerCount', 'mipmap', 'mipmapCount' },
  84. returns = {}
  85. },
  86. {
  87. arguments = { 'v4', 'layer', 'layerCount', 'mipmap', 'mipmapCount' },
  88. returns = {}
  89. }
  90. },
  91. notes = [[
  92. The texture must have been created with the `transfer` usage to clear it.
  93. The clear color will be interpreted as a linear color for sRGB formats.
  94. ]],
  95. related = {
  96. 'Buffer:clear',
  97. 'Texture:setPixels',
  98. 'Pass:setClear'
  99. }
  100. }