rawTexture.d.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import { Texture } from "./texture";
  2. import "../../Engines/Extensions/engine.rawTexture";
  3. import type { Nullable } from "../../types";
  4. import type { AbstractEngine } from "../../Engines/abstractEngine";
  5. import type { Scene } from "../../scene";
  6. /**
  7. * Raw texture can help creating a texture directly from an array of data.
  8. * This can be super useful if you either get the data from an uncompressed source or
  9. * if you wish to create your texture pixel by pixel.
  10. */
  11. export declare class RawTexture extends Texture {
  12. /**
  13. * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)
  14. */
  15. format: number;
  16. /**
  17. * Instantiates a new RawTexture.
  18. * Raw texture can help creating a texture directly from an array of data.
  19. * This can be super useful if you either get the data from an uncompressed source or
  20. * if you wish to create your texture pixel by pixel.
  21. * @param data define the array of data to use to create the texture (null to create an empty texture)
  22. * @param width define the width of the texture
  23. * @param height define the height of the texture
  24. * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)
  25. * @param sceneOrEngine defines the scene or engine the texture will belong to
  26. * @param generateMipMaps define whether mip maps should be generated or not
  27. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  28. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  29. * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
  30. * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
  31. * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
  32. */
  33. constructor(data: Nullable<ArrayBufferView>, width: number, height: number,
  34. /**
  35. * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)
  36. */
  37. format: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number, creationFlags?: number, useSRGBBuffer?: boolean);
  38. /**
  39. * Updates the texture underlying data.
  40. * @param data Define the new data of the texture
  41. */
  42. update(data: ArrayBufferView): void;
  43. /**
  44. * Creates a luminance texture from some data.
  45. * @param data Define the texture data
  46. * @param width Define the width of the texture
  47. * @param height Define the height of the texture
  48. * @param sceneOrEngine defines the scene or engine the texture will belong to
  49. * @param generateMipMaps Define whether or not to create mip maps for the texture
  50. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  51. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  52. * @returns the luminance texture
  53. */
  54. static CreateLuminanceTexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  55. /**
  56. * Creates a luminance alpha texture from some data.
  57. * @param data Define the texture data
  58. * @param width Define the width of the texture
  59. * @param height Define the height of the texture
  60. * @param sceneOrEngine defines the scene or engine the texture will belong to
  61. * @param generateMipMaps Define whether or not to create mip maps for the texture
  62. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  63. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  64. * @returns the luminance alpha texture
  65. */
  66. static CreateLuminanceAlphaTexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  67. /**
  68. * Creates an alpha texture from some data.
  69. * @param data Define the texture data
  70. * @param width Define the width of the texture
  71. * @param height Define the height of the texture
  72. * @param sceneOrEngine defines the scene or engine the texture will belong to
  73. * @param generateMipMaps Define whether or not to create mip maps for the texture
  74. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  75. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  76. * @returns the alpha texture
  77. */
  78. static CreateAlphaTexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  79. /**
  80. * Creates a RGB texture from some data.
  81. * @param data Define the texture data
  82. * @param width Define the width of the texture
  83. * @param height Define the height of the texture
  84. * @param sceneOrEngine defines the scene or engine the texture will belong to
  85. * @param generateMipMaps Define whether or not to create mip maps for the texture
  86. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  87. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  88. * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
  89. * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
  90. * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
  91. * @returns the RGB alpha texture
  92. */
  93. static CreateRGBTexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number, creationFlags?: number, useSRGBBuffer?: boolean): RawTexture;
  94. /**
  95. * Creates a RGBA texture from some data.
  96. * @param data Define the texture data
  97. * @param width Define the width of the texture
  98. * @param height Define the height of the texture
  99. * @param sceneOrEngine defines the scene or engine the texture will belong to
  100. * @param generateMipMaps Define whether or not to create mip maps for the texture
  101. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  102. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  103. * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
  104. * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
  105. * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
  106. * @returns the RGBA texture
  107. */
  108. static CreateRGBATexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number, creationFlags?: number, useSRGBBuffer?: boolean): RawTexture;
  109. /**
  110. * Creates a RGBA storage texture from some data.
  111. * @param data Define the texture data
  112. * @param width Define the width of the texture
  113. * @param height Define the height of the texture
  114. * @param sceneOrEngine defines the scene or engine the texture will belong to
  115. * @param generateMipMaps Define whether or not to create mip maps for the texture
  116. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  117. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  118. * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
  119. * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
  120. * @returns the RGBA texture
  121. */
  122. static CreateRGBAStorageTexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number, useSRGBBuffer?: boolean): RawTexture;
  123. /**
  124. * Creates a R texture from some data.
  125. * @param data Define the texture data
  126. * @param width Define the width of the texture
  127. * @param height Define the height of the texture
  128. * @param sceneOrEngine defines the scene or engine the texture will belong to
  129. * @param generateMipMaps Define whether or not to create mip maps for the texture
  130. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  131. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  132. * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
  133. * @returns the R texture
  134. */
  135. static CreateRTexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
  136. /**
  137. * Creates a R storage texture from some data.
  138. * @param data Define the texture data
  139. * @param width Define the width of the texture
  140. * @param height Define the height of the texture
  141. * @param sceneOrEngine defines the scene or engine the texture will belong to
  142. * @param generateMipMaps Define whether or not to create mip maps for the texture
  143. * @param invertY define if the data should be flipped on Y when uploaded to the GPU
  144. * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
  145. * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
  146. * @returns the R texture
  147. */
  148. static CreateRStorageTexture(data: Nullable<ArrayBufferView>, width: number, height: number, sceneOrEngine: Nullable<Scene | AbstractEngine>, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
  149. }