newTexture.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. return {
  2. tag = 'graphicsObjects',
  3. summary = 'Create a new Texture.',
  4. description = 'Creates a new Texture from an image file.',
  5. arguments = {
  6. width = {
  7. type = 'number',
  8. description = 'The width of the Texture.'
  9. },
  10. height = {
  11. type = 'number',
  12. description = 'The height of the Texture.'
  13. },
  14. depth = {
  15. type = 'number',
  16. description = 'The depth of the Texture.'
  17. },
  18. filename = {
  19. type = 'string',
  20. description = 'The filename of the image to load.'
  21. },
  22. blob = {
  23. type = 'Blob',
  24. description = 'The Blob containing encoded image data used to create the Texture.'
  25. },
  26. textureData = {
  27. type = 'TextureData',
  28. description = 'The TextureData to create the Texture from.'
  29. },
  30. images = {
  31. type = 'table',
  32. description = 'A table of image filenames to load.'
  33. },
  34. flags = {
  35. type = 'table',
  36. default = '{}',
  37. description = 'Optional settings for the texture.',
  38. table = {
  39. {
  40. name = 'linear',
  41. type = 'boolean',
  42. default = 'false',
  43. description = 'Whether the texture is in linear color space instead of the usual sRGB.'
  44. },
  45. {
  46. name = 'mipmaps',
  47. type = 'boolean',
  48. default = 'true',
  49. description = 'Whether mipmaps will be generated for the texture.'
  50. },
  51. {
  52. name = 'type',
  53. type = 'TextureType',
  54. default = 'nil',
  55. description = [[
  56. The type of Texture to load the images into. If nil, the type will be `2d` for a
  57. single image, `array` for a table of images with numeric keys, or `cube` for a table
  58. of images with string keys.
  59. ]]
  60. },
  61. {
  62. name = 'format',
  63. type = 'TextureFormat',
  64. default = [['rgba']],
  65. description = 'The format used for the Texture (when creating a blank texture).'
  66. },
  67. {
  68. name = 'msaa',
  69. type = 'number',
  70. default = '0',
  71. description = 'The antialiasing level to use (when attaching the Texture to a Canvas).'
  72. }
  73. }
  74. }
  75. },
  76. returns = {
  77. texture = {
  78. name = 'texture',
  79. type = 'Texture',
  80. description = 'The new Texture.'
  81. }
  82. },
  83. variants = {
  84. {
  85. arguments = { 'filename', 'flags' },
  86. returns = { 'texture' }
  87. },
  88. {
  89. description = [[
  90. Create a Texture from a table of filenames, Blobs, or TextureData. For cube textures, the
  91. individual faces can be specified using the string keys "right", "left", "top", "bottom",
  92. "back", "front".
  93. ]],
  94. arguments = { 'images', 'flags' },
  95. returns = { 'texture' }
  96. },
  97. {
  98. description = [[
  99. Creates a blank Texture with specified dimensions. This saves memory if you're planning on
  100. rendering to the Texture using a Canvas or a compute shader, but the contents of the Texture
  101. will be initialized to random data.
  102. ]],
  103. arguments = { 'width', 'height', 'depth', 'flags' },
  104. returns = { 'texture' }
  105. },
  106. {
  107. description = 'Create a texture from a single Blob.',
  108. arguments = { 'blob', 'flags' },
  109. returns = { 'texture' }
  110. },
  111. {
  112. description = 'Create a texture from a single TextureData.',
  113. arguments = { 'textureData', 'flags' },
  114. returns = { 'texture' }
  115. }
  116. },
  117. notes = [[
  118. The "linear" flag should be set to true for textures that don't contain color information, such
  119. as normal maps.
  120. Right now the supported image file formats are png, jpg, hdr, dds (DXT1, DXT3, DXT5), ktx, and
  121. astc.
  122. ]]
  123. }