智慧水务管理系统 - 精河县供水工程综合管理平台

container.d.ts 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import type { Supercompression, VKFormat } from './constants.js';
  2. /**
  3. * Represents an unpacked KTX 2.0 texture container. Data for individual mip levels are stored in
  4. * the `.levels` array, typically compressed in Basis Universal formats. Additional properties
  5. * provide metadata required to process, transcode, and upload these textures.
  6. */
  7. export interface KTX2Container {
  8. /**
  9. * Specifies the image format using Vulkan VkFormat enum values. When using Basis Universal
  10. * texture formats, `vkFormat` must be VK_FORMAT_UNDEFINED.
  11. */
  12. vkFormat: VKFormat;
  13. /**
  14. * Size of the data type in bytes used to upload the data to a graphics API. When `vkFormat` is
  15. * VK_FORMAT_UNDEFINED, `typeSize` must be 1.
  16. */
  17. typeSize: number;
  18. /** Width of the texture image for level 0, in pixels. */
  19. pixelWidth: number;
  20. /** Height of the texture image for level 0, in pixels. */
  21. pixelHeight: number;
  22. /** Depth of the texture image for level 0, in pixels (3D textures only). */
  23. pixelDepth: number;
  24. /** Number of array elements (array textures only). */
  25. layerCount: number;
  26. /**
  27. * Number of cubemap faces. For cubemaps and cubemap arrays, `faceCount` must be 6. For all
  28. * other textures, `faceCount` must be 1. Cubemap faces are stored in +X, -X, +Y, -Y, +Z, -Z
  29. * order.
  30. */
  31. faceCount: number;
  32. /**
  33. * Number of levels in the mipmap level array. Mipmap pyramid may not necessarily be complete.
  34. * `levelCount = 1` implies that the file contains only the base level, and is not meant to have
  35. * other levels. `levelCount = 0` implies that the file contains only the base level, and that
  36. * other levels should be generated by the loader at runtime. For block-compressed formats,
  37. * `levelCount = 0` is disallowed.
  38. */
  39. levelCount: number;
  40. /** Indicates which supercompression scheme has been applied to mip level images, if any. */
  41. supercompressionScheme: Supercompression;
  42. /** Mip levels, ordered largest (original) to smallest (~1px). */
  43. levels: KTX2Level[];
  44. /** Data Format Descriptor. */
  45. dataFormatDescriptor: KTX2DataFormatDescriptorBasicFormat[];
  46. /** Key/Value Data. */
  47. keyValue: {
  48. [key: string]: string | Uint8Array;
  49. };
  50. /** Supercompression Global Data. */
  51. globalData: KTX2GlobalDataBasisLZ | null;
  52. }
  53. export interface KTX2Level {
  54. /** Compressed data of the mip level. */
  55. levelData: Uint8Array;
  56. /**
  57. * Size of the mip level after reflation from supercompression, if applicable. When
  58. * `supercompressionType` is BASISLZ, `uncompressedByteLength` must be 0. When
  59. * `supercompressionType` is `NONE`, `uncompressedByteLength` must match the `levelData` byte
  60. * length.
  61. *
  62. * _**NOTICE:** this implies that for formats such as UASTC, `uncompressedByteLength` may
  63. * indicate size after ZSTD reflation (and of transcoded ASTC data), but does _not_ indicate
  64. * size of decoded RGBA32 pixels._
  65. */
  66. uncompressedByteLength: number;
  67. }
  68. export interface KTX2DataFormatDescriptorBasicFormat {
  69. vendorId: number;
  70. descriptorType: number;
  71. versionNumber: number;
  72. colorModel: number;
  73. colorPrimaries: number;
  74. transferFunction: number;
  75. flags: number;
  76. texelBlockDimension: [number, number, number, number];
  77. bytesPlane: [number, number, number, number, number, number, number, number];
  78. samples: KTX2BasicFormatSample[];
  79. }
  80. export interface KTX2BasicFormatSample {
  81. bitOffset: number;
  82. bitLength: number;
  83. channelType: number;
  84. samplePosition: number[];
  85. sampleLower: number;
  86. sampleUpper: number;
  87. }
  88. export interface KTX2GlobalDataBasisLZ {
  89. endpointCount: number;
  90. selectorCount: number;
  91. imageDescs: KTX2GlobalDataBasisLZImageDesc[];
  92. endpointsData: Uint8Array;
  93. selectorsData: Uint8Array;
  94. tablesData: Uint8Array;
  95. extendedData: Uint8Array;
  96. }
  97. interface KTX2GlobalDataBasisLZImageDesc {
  98. imageFlags: number;
  99. rgbSliceByteOffset: number;
  100. rgbSliceByteLength: number;
  101. alphaSliceByteOffset: number;
  102. alphaSliceByteLength: number;
  103. }
  104. export {};