khronosTextureContainer.d.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import type { InternalTexture } from "../Materials/Textures/internalTexture";
  2. /**
  3. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  4. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  5. */
  6. export declare class KhronosTextureContainer {
  7. /** contents of the KTX container file */
  8. data: ArrayBufferView;
  9. private static HEADER_LEN;
  10. private static COMPRESSED_2D;
  11. private static COMPRESSED_3D;
  12. private static TEX_2D;
  13. private static TEX_3D;
  14. /**
  15. * Gets the openGL type
  16. */
  17. glType: number;
  18. /**
  19. * Gets the openGL type size
  20. */
  21. glTypeSize: number;
  22. /**
  23. * Gets the openGL format
  24. */
  25. glFormat: number;
  26. /**
  27. * Gets the openGL internal format
  28. */
  29. glInternalFormat: number;
  30. /**
  31. * Gets the base internal format
  32. */
  33. glBaseInternalFormat: number;
  34. /**
  35. * Gets image width in pixel
  36. */
  37. pixelWidth: number;
  38. /**
  39. * Gets image height in pixel
  40. */
  41. pixelHeight: number;
  42. /**
  43. * Gets image depth in pixels
  44. */
  45. pixelDepth: number;
  46. /**
  47. * Gets the number of array elements
  48. */
  49. numberOfArrayElements: number;
  50. /**
  51. * Gets the number of faces
  52. */
  53. numberOfFaces: number;
  54. /**
  55. * Gets the number of mipmap levels
  56. */
  57. numberOfMipmapLevels: number;
  58. /**
  59. * Gets the bytes of key value data
  60. */
  61. bytesOfKeyValueData: number;
  62. /**
  63. * Gets the load type
  64. */
  65. loadType: number;
  66. /**
  67. * If the container has been made invalid (eg. constructor failed to correctly load array buffer)
  68. */
  69. isInvalid: boolean;
  70. /**
  71. * Creates a new KhronosTextureContainer
  72. * @param data contents of the KTX container file
  73. * @param facesExpected should be either 1 or 6, based whether a cube texture or or
  74. */
  75. constructor(
  76. /** contents of the KTX container file */
  77. data: ArrayBufferView, facesExpected: number);
  78. /**
  79. * Uploads KTX content to a Babylon Texture.
  80. * It is assumed that the texture has already been created & is currently bound
  81. * @internal
  82. */
  83. uploadLevels(texture: InternalTexture, loadMipmaps: boolean): void;
  84. private _upload2DCompressedLevels;
  85. /**
  86. * Checks if the given data starts with a KTX file identifier.
  87. * @param data the data to check
  88. * @returns true if the data is a KTX file or false otherwise
  89. */
  90. static IsValid(data: ArrayBufferView): boolean;
  91. }