thinTexture.d.ts 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import type { Nullable } from "../../types";
  2. import type { InternalTexture } from "../../Materials/Textures/internalTexture";
  3. import type { ISize } from "../../Maths/math.size";
  4. import type { AbstractEngine } from "../../Engines/abstractEngine";
  5. import type { RenderTargetWrapper } from "../../Engines/renderTargetWrapper.js";
  6. /**
  7. * Base class of all the textures in babylon.
  8. * It groups all the common properties required to work with Thin Engine.
  9. */
  10. export declare class ThinTexture {
  11. protected _wrapU: number;
  12. /**
  13. * | Value | Type | Description |
  14. * | ----- | ------------------ | ----------- |
  15. * | 0 | CLAMP_ADDRESSMODE | |
  16. * | 1 | WRAP_ADDRESSMODE | |
  17. * | 2 | MIRROR_ADDRESSMODE | |
  18. */
  19. get wrapU(): number;
  20. set wrapU(value: number);
  21. protected _wrapV: number;
  22. /**
  23. * | Value | Type | Description |
  24. * | ----- | ------------------ | ----------- |
  25. * | 0 | CLAMP_ADDRESSMODE | |
  26. * | 1 | WRAP_ADDRESSMODE | |
  27. * | 2 | MIRROR_ADDRESSMODE | |
  28. */
  29. get wrapV(): number;
  30. set wrapV(value: number);
  31. /**
  32. * | Value | Type | Description |
  33. * | ----- | ------------------ | ----------- |
  34. * | 0 | CLAMP_ADDRESSMODE | |
  35. * | 1 | WRAP_ADDRESSMODE | |
  36. * | 2 | MIRROR_ADDRESSMODE | |
  37. */
  38. wrapR: number;
  39. /**
  40. * With compliant hardware and browser (supporting anisotropic filtering)
  41. * this defines the level of anisotropic filtering in the texture.
  42. * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.
  43. */
  44. anisotropicFilteringLevel: number;
  45. /**
  46. * Define the current state of the loading sequence when in delayed load mode.
  47. */
  48. delayLoadState: number;
  49. /**
  50. * How a texture is mapped.
  51. * Unused in thin texture mode.
  52. */
  53. get coordinatesMode(): number;
  54. /**
  55. * Define if the texture is a cube texture or if false a 2d texture.
  56. */
  57. get isCube(): boolean;
  58. protected set isCube(value: boolean);
  59. /**
  60. * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
  61. */
  62. get is3D(): boolean;
  63. protected set is3D(value: boolean);
  64. /**
  65. * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.
  66. */
  67. get is2DArray(): boolean;
  68. protected set is2DArray(value: boolean);
  69. /**
  70. * Get the class name of the texture.
  71. * @returns "ThinTexture"
  72. */
  73. getClassName(): string;
  74. /** @internal */
  75. _texture: Nullable<InternalTexture>;
  76. protected _engine: Nullable<AbstractEngine>;
  77. private _cachedSize;
  78. private _cachedBaseSize;
  79. private static _IsRenderTargetWrapper;
  80. /**
  81. * Instantiates a new ThinTexture.
  82. * Base class of all the textures in babylon.
  83. * This can be used as an internal texture wrapper in AbstractEngine to benefit from the cache
  84. * @param internalTexture Define the internalTexture to wrap. You can also pass a RenderTargetWrapper, in which case the texture will be the render target's texture
  85. */
  86. constructor(internalTexture: Nullable<InternalTexture | RenderTargetWrapper>);
  87. /**
  88. * Get if the texture is ready to be used (downloaded, converted, mip mapped...).
  89. * @returns true if fully ready
  90. */
  91. isReady(): boolean;
  92. /**
  93. * Triggers the load sequence in delayed load mode.
  94. */
  95. delayLoad(): void;
  96. /**
  97. * Get the underlying lower level texture from Babylon.
  98. * @returns the internal texture
  99. */
  100. getInternalTexture(): Nullable<InternalTexture>;
  101. /**
  102. * Get the size of the texture.
  103. * @returns the texture size.
  104. */
  105. getSize(): ISize;
  106. /**
  107. * Get the base size of the texture.
  108. * It can be different from the size if the texture has been resized for POT for instance
  109. * @returns the base size
  110. */
  111. getBaseSize(): ISize;
  112. /** @internal */
  113. protected _initialSamplingMode: number;
  114. /**
  115. * Get the current sampling mode associated with the texture.
  116. */
  117. get samplingMode(): number;
  118. /**
  119. * Update the sampling mode of the texture.
  120. * Default is Trilinear mode.
  121. *
  122. * | Value | Type | Description |
  123. * | ----- | ------------------ | ----------- |
  124. * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |
  125. * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
  126. * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
  127. * | 4 | NEAREST_NEAREST_MIPNEAREST | |
  128. * | 5 | NEAREST_LINEAR_MIPNEAREST | |
  129. * | 6 | NEAREST_LINEAR_MIPLINEAR | |
  130. * | 7 | NEAREST_LINEAR | |
  131. * | 8 | NEAREST_NEAREST | |
  132. * | 9 | LINEAR_NEAREST_MIPNEAREST | |
  133. * | 10 | LINEAR_NEAREST_MIPLINEAR | |
  134. * | 11 | LINEAR_LINEAR | |
  135. * | 12 | LINEAR_NEAREST | |
  136. *
  137. * > _mag_: magnification filter (close to the viewer)
  138. * > _min_: minification filter (far from the viewer)
  139. * > _mip_: filter used between mip map levels
  140. *@param samplingMode Define the new sampling mode of the texture
  141. */
  142. updateSamplingMode(samplingMode: number): void;
  143. /**
  144. * Release and destroy the underlying lower level texture aka internalTexture.
  145. */
  146. releaseInternalTexture(): void;
  147. /**
  148. * Dispose the texture and release its associated resources.
  149. */
  150. dispose(): void;
  151. }