@woosh/meep-engine 3.14.1 → 3.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -24
- package/package.json +1 -1
- package/src/avif/native/DECISIONS.md +544 -536
- package/src/avif/native/heif/parse_avif_file.d.ts.map +1 -1
- package/src/avif/native/heif/parse_avif_file.js +384 -383
- package/src/avif/native/heif/parse_image_grid.d.ts.map +1 -1
- package/src/avif/native/heif/parse_image_grid.js +49 -48
- package/src/basis/BasisBitReader.d.ts +77 -0
- package/src/basis/BasisBitReader.d.ts.map +1 -0
- package/src/basis/BasisBitReader.js +231 -0
- package/src/basis/BasisHuffmanTable.d.ts +53 -0
- package/src/basis/BasisHuffmanTable.d.ts.map +1 -0
- package/src/basis/BasisHuffmanTable.js +263 -0
- package/src/basis/basis_read_huffman_table.d.ts +20 -0
- package/src/basis/basis_read_huffman_table.d.ts.map +1 -0
- package/src/basis/basis_read_huffman_table.js +187 -0
- package/src/basis/etc1s/Etc1sSelectorHistory.d.ts +50 -0
- package/src/basis/etc1s/Etc1sSelectorHistory.d.ts.map +1 -0
- package/src/basis/etc1s/Etc1sSelectorHistory.js +89 -0
- package/src/basis/etc1s/etc1s_block_colors.d.ts +14 -0
- package/src/basis/etc1s/etc1s_block_colors.d.ts.map +1 -0
- package/src/basis/etc1s/etc1s_block_colors.js +75 -0
- package/src/basis/etc1s/etc1s_decode_slice.d.ts +57 -0
- package/src/basis/etc1s/etc1s_decode_slice.d.ts.map +1 -0
- package/src/basis/etc1s/etc1s_decode_slice.js +258 -0
- package/src/basis/etc1s/etc1s_read_endpoint_codebook.d.ts +48 -0
- package/src/basis/etc1s/etc1s_read_endpoint_codebook.d.ts.map +1 -0
- package/src/basis/etc1s/etc1s_read_endpoint_codebook.js +111 -0
- package/src/basis/etc1s/etc1s_read_selector_codebook.d.ts +42 -0
- package/src/basis/etc1s/etc1s_read_selector_codebook.d.ts.map +1 -0
- package/src/basis/etc1s/etc1s_read_selector_codebook.js +127 -0
- package/src/basis/etc1s/etc1s_read_slice_tables.d.ts +54 -0
- package/src/basis/etc1s/etc1s_read_slice_tables.d.ts.map +1 -0
- package/src/basis/etc1s/etc1s_read_slice_tables.js +47 -0
- package/src/basis/transcode/build_range_plan.js +54 -0
- package/src/basis/transcode/etc1s_to_bc1.d.ts +24 -0
- package/src/basis/transcode/etc1s_to_bc1.d.ts.map +1 -0
- package/src/basis/transcode/etc1s_to_bc1.js +205 -0
- package/src/basis/transcode/etc1s_to_bc7.d.ts +30 -0
- package/src/basis/transcode/etc1s_to_bc7.d.ts.map +1 -0
- package/src/basis/transcode/etc1s_to_bc7.js +496 -0
- package/src/basis/transcode/fit_endpoints.d.ts +59 -0
- package/src/basis/transcode/fit_endpoints.d.ts.map +1 -0
- package/src/basis/transcode/fit_endpoints.js +226 -0
- package/src/{avif/native/isobmff → core/binary}/ByteCursor.d.ts +19 -6
- package/src/core/binary/ByteCursor.d.ts.map +1 -0
- package/src/{avif/native/isobmff → core/binary}/ByteCursor.js +41 -14
- package/src/engine/EngineHarness.js +1 -1
- package/src/engine/asset/codec/Codec.d.ts.map +1 -0
- package/src/engine/asset/codec/CodecWithFallback.d.ts.map +1 -0
- package/src/engine/asset/{loaders/image/codec → codec}/CodecWithFallback.js +2 -2
- package/src/engine/asset/loaders/image/IMAGE_CODEC_REVIEW_2026_08_28.md +4 -4
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts +1 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.js +1 -1
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts +1 -1
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.js +1 -1
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.d.ts +1 -1
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +1 -1
- package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -0
- package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -1
- package/src/engine/physics/broadphase/generate_pairs.js +7 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/ktx2/KTX2_IDENTIFIER.d.ts +14 -0
- package/src/ktx2/KTX2_IDENTIFIER.d.ts.map +1 -0
- package/src/ktx2/KTX2_IDENTIFIER.js +15 -0
- package/src/ktx2/KhrDfModel.d.ts +35 -0
- package/src/ktx2/KhrDfModel.d.ts.map +1 -0
- package/src/ktx2/KhrDfModel.js +49 -0
- package/src/ktx2/SupercompressionScheme.d.ts +16 -0
- package/src/ktx2/SupercompressionScheme.d.ts.map +1 -0
- package/src/ktx2/SupercompressionScheme.js +23 -0
- package/src/ktx2/ktx2_read.d.ts +71 -0
- package/src/ktx2/ktx2_read.d.ts.map +1 -0
- package/src/ktx2/ktx2_read.js +581 -0
- package/src/ktx2/ktx2_read_basis_lz_global_data.d.ts +27 -0
- package/src/ktx2/ktx2_read_basis_lz_global_data.d.ts.map +1 -0
- package/src/ktx2/ktx2_read_basis_lz_global_data.js +189 -0
- package/src/ktx2/vk_format_to_texture_format.d.ts +55 -0
- package/src/ktx2/vk_format_to_texture_format.d.ts.map +1 -0
- package/src/ktx2/vk_format_to_texture_format.js +290 -0
- package/src/shade/descriptor/GPUTextureUsage.d.ts +23 -0
- package/src/shade/descriptor/GPUTextureUsage.d.ts.map +1 -0
- package/src/shade/descriptor/GPUTextureUsage.js +24 -0
- package/src/shade/descriptor/WebGPUExtensionType.d.ts +3 -0
- package/src/shade/descriptor/WebGPUExtensionType.js +26 -0
- package/src/shade/descriptor/texture/TextureDescriptor.d.ts +2 -6
- package/src/shade/descriptor/texture/TextureDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/TextureDescriptor.js +24 -40
- package/src/shade/descriptor/texture/format/TextureFormat.d.ts +125 -0
- package/src/shade/descriptor/texture/format/TextureFormat.d.ts.map +1 -0
- package/src/shade/descriptor/texture/format/TextureFormat.js +146 -0
- package/src/shade/descriptor/texture/format/gpu_texture_format_info.d.ts +60 -0
- package/src/shade/descriptor/texture/format/gpu_texture_format_info.d.ts.map +1 -1
- package/src/shade/descriptor/texture/format/gpu_texture_format_info.js +102 -0
- package/src/shade/device/graph/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/TextureResourceDescriptor.js +160 -155
- package/src/shade/device/mock/SoftwareGPUQueue.d.ts +11 -4
- package/src/shade/device/mock/SoftwareGPUQueue.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUQueue.js +31 -37
- package/src/shade/device/mock/SoftwareGPUTexture.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUTexture.js +8 -4
- package/src/shade/device/timing/profile/frame_graph_extract_topology.d.ts.map +1 -1
- package/src/shade/device/timing/profile/frame_graph_extract_topology.js +164 -174
- package/src/shade/playground/ground_seam/README.md +235 -0
- package/src/shade/playground/ground_seam/capture_scene_color.d.ts +45 -0
- package/src/shade/playground/ground_seam/capture_scene_color.d.ts.map +1 -0
- package/src/shade/playground/ground_seam/capture_scene_color.js +242 -0
- package/src/shade/playground/ground_seam/depth_step_across_seam.d.ts +11 -0
- package/src/shade/playground/ground_seam/depth_step_across_seam.d.ts.map +1 -0
- package/src/shade/playground/ground_seam/depth_step_across_seam.js +185 -0
- package/src/shade/playground/ground_seam/index.html +195 -0
- package/src/shade/playground/ground_seam/main.d.ts +2 -0
- package/src/shade/playground/ground_seam/main.d.ts.map +1 -0
- package/src/shade/playground/ground_seam/main.js +879 -0
- package/src/shade/playground/ground_seam/make_grid_texture.d.ts +29 -0
- package/src/shade/playground/ground_seam/make_grid_texture.d.ts.map +1 -0
- package/src/shade/playground/ground_seam/make_grid_texture.js +105 -0
- package/src/shade/playground/ground_seam/make_ground.d.ts +70 -0
- package/src/shade/playground/ground_seam/make_ground.d.ts.map +1 -0
- package/src/shade/playground/ground_seam/make_ground.js +161 -0
- package/src/shade/playground/ground_seam/measure_flicker.d.ts +71 -0
- package/src/shade/playground/ground_seam/measure_flicker.d.ts.map +1 -0
- package/src/shade/playground/ground_seam/measure_flicker.js +531 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +2519 -2511
- package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts.map +1 -1
- package/src/shade/renderer/hiz/HierarchicalZBuffer.js +275 -274
- package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
- package/src/shade/renderer/light/GPULightCollection.js +323 -314
- package/src/shade/renderer/lightmap/GPULightMap.js +336 -336
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +12 -2
- package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts.map +1 -1
- package/src/shade/renderer/material/standard/fragment_gbuffer.js +3 -1
- package/src/shade/renderer/material/standard/fragment_gbuffer_vt.js +169 -169
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +3 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/rasterize/native/oit/chunk_forward_shade_standard_fragment_brick4.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/chunk_forward_shade_standard_fragment_brick4.js +3 -1
- package/src/shade/renderer/rasterize/native/oit/chunk_forward_shade_standard_fragment_ibl.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/chunk_forward_shade_standard_fragment_ibl.js +3 -1
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_tangent_normal.d.ts +28 -0
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_tangent_normal.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_tangent_normal.js +39 -0
- package/src/shade/renderer/shader/chunk/geometry/triangle/chunk_barycentric_full.d.ts +45 -0
- package/src/shade/renderer/shader/chunk/geometry/triangle/chunk_barycentric_full.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/triangle/chunk_barycentric_full.js +94 -61
- package/src/shade/renderer/shader/chunk/geometry/triangle/chunk_barycentric_solve.d.ts +24 -0
- package/src/shade/renderer/shader/chunk/geometry/triangle/chunk_barycentric_solve.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/triangle/chunk_barycentric_solve.js +43 -0
- package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +1462 -0
- package/src/shade/renderer/texture/TextureManager.d.ts.map +1 -1
- package/src/shade/renderer/texture/TextureManager.js +20 -8
- package/src/shade/renderer/texture/TextureRole.d.ts +19 -0
- package/src/shade/renderer/texture/TextureRole.d.ts.map +1 -0
- package/src/shade/renderer/texture/TextureRole.js +26 -0
- package/src/shade/renderer/texture/TextureVariantSet.d.ts +71 -0
- package/src/shade/renderer/texture/TextureVariantSet.d.ts.map +1 -0
- package/src/shade/renderer/texture/TextureVariantSet.js +105 -0
- package/src/shade/renderer/texture/download_texture_data.d.ts.map +1 -1
- package/src/shade/renderer/texture/download_texture_data.js +22 -0
- package/src/shade/renderer/texture/format/gpu_texture_compression_support.d.ts +15 -0
- package/src/shade/renderer/texture/format/gpu_texture_compression_support.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/gpu_texture_compression_support.js +50 -0
- package/src/shade/renderer/texture/format/gpu_texture_format_can_generate_mipmaps.d.ts +27 -0
- package/src/shade/renderer/texture/format/gpu_texture_format_can_generate_mipmaps.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/gpu_texture_format_can_generate_mipmaps.js +65 -0
- package/src/shade/renderer/texture/format/infer_format_from_parameters.d.ts +11 -0
- package/src/shade/renderer/texture/format/infer_format_from_parameters.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/infer_format_from_parameters.js +88 -0
- package/src/shade/renderer/texture/format/texture_format_from_shade_image.d.ts +24 -0
- package/src/shade/renderer/texture/format/texture_format_from_shade_image.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/texture_format_from_shade_image.js +71 -0
- package/src/shade/renderer/texture/format/texture_format_preference.d.ts +22 -0
- package/src/shade/renderer/texture/format/texture_format_preference.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/texture_format_preference.js +89 -0
- package/src/shade/renderer/texture/format/texture_variant_select.d.ts +24 -0
- package/src/shade/renderer/texture/format/texture_variant_select.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/texture_variant_select.js +38 -0
- package/src/shade/renderer/texture/shade_texture_might_have_alpha.d.ts +9 -1
- package/src/shade/renderer/texture/shade_texture_might_have_alpha.d.ts.map +1 -1
- package/src/shade/renderer/texture/shade_texture_might_have_alpha.js +73 -8
- package/src/shade/renderer/texture/source/AlphaMode.d.ts +27 -0
- package/src/shade/renderer/texture/source/AlphaMode.d.ts.map +1 -0
- package/src/shade/renderer/texture/source/AlphaMode.js +52 -0
- package/src/shade/renderer/texture/source/ShadeImage.d.ts +33 -0
- package/src/shade/renderer/texture/source/ShadeImage.d.ts.map +1 -1
- package/src/shade/renderer/texture/source/ShadeImage.js +74 -0
- package/src/shade/renderer/texture/source/ShadeTexelData.d.ts +78 -0
- package/src/shade/renderer/texture/source/ShadeTexelData.d.ts.map +1 -0
- package/src/shade/renderer/texture/source/ShadeTexelData.js +158 -0
- package/src/shade/renderer/texture/texture_descriptor_from_texture_shade.d.ts +0 -10
- package/src/shade/renderer/texture/texture_descriptor_from_texture_shade.d.ts.map +1 -1
- package/src/shade/renderer/texture/texture_descriptor_from_texture_shade.js +73 -175
- package/src/shade/renderer/texture/texture_write_level.d.ts +32 -0
- package/src/shade/renderer/texture/texture_write_level.d.ts.map +1 -0
- package/src/shade/renderer/texture/texture_write_level.js +77 -0
- package/src/shade/renderer/texture/texture_write_to_gpu.d.ts +8 -1
- package/src/shade/renderer/texture/texture_write_to_gpu.d.ts.map +1 -1
- package/src/shade/renderer/texture/texture_write_to_gpu.js +62 -37
- package/src/shade/renderer/texture/virtual/source/VTSourceImage.d.ts +8 -0
- package/src/shade/renderer/texture/virtual/source/VTSourceImage.d.ts.map +1 -1
- package/src/shade/renderer/texture/virtual/source/VTSourceImage.js +8 -0
- package/src/shade/util/texture_mip_extent.d.ts +49 -0
- package/src/shade/util/texture_mip_extent.d.ts.map +1 -0
- package/src/shade/util/texture_mip_extent.js +87 -0
- package/src/avif/native/isobmff/ByteCursor.d.ts.map +0 -1
- package/src/engine/asset/loaders/image/codec/Codec.d.ts.map +0 -1
- package/src/engine/asset/loaders/image/codec/CodecWithFallback.d.ts.map +0 -1
- package/src/shade/util/compute_max_mip_count.d.ts +0 -8
- package/src/shade/util/compute_max_mip_count.d.ts.map +0 -1
- package/src/shade/util/compute_max_mip_count.js +0 -27
- /package/src/engine/asset/{loaders/image/codec → codec}/Codec.d.ts +0 -0
- /package/src/engine/asset/{loaders/image/codec → codec}/Codec.js +0 -0
- /package/src/engine/asset/{loaders/image/codec → codec}/CodecWithFallback.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The twelve bytes every KTX2 file starts with: `«KTX 20»\r\n\x1A\n`.
|
|
3
|
+
*
|
|
4
|
+
* The escape sequences are not decoration. `\r\n` catches a transfer that translated line endings,
|
|
5
|
+
* `\x1A` stops a DOS `type` from printing the rest of the file, and the high bytes at either end of
|
|
6
|
+
* `«…»` fail a naive "is this text" check. A file that does not begin with exactly these is not a
|
|
7
|
+
* KTX2 file and is refused by name rather than parsed hopefully.
|
|
8
|
+
*
|
|
9
|
+
* @see https://registry.khronos.org/KTX/specs/2.0/ktxspec.v2.html#_identifier
|
|
10
|
+
* @readonly
|
|
11
|
+
* @type {Uint8Array}
|
|
12
|
+
*/
|
|
13
|
+
export const KTX2_IDENTIFIER: Uint8Array;
|
|
14
|
+
//# sourceMappingURL=KTX2_IDENTIFIER.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KTX2_IDENTIFIER.d.ts","sourceRoot":"","sources":["../../../src/ktx2/KTX2_IDENTIFIER.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,8BAFU,UAAU,CAIjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The twelve bytes every KTX2 file starts with: `«KTX 20»\r\n\x1A\n`.
|
|
3
|
+
*
|
|
4
|
+
* The escape sequences are not decoration. `\r\n` catches a transfer that translated line endings,
|
|
5
|
+
* `\x1A` stops a DOS `type` from printing the rest of the file, and the high bytes at either end of
|
|
6
|
+
* `«…»` fail a naive "is this text" check. A file that does not begin with exactly these is not a
|
|
7
|
+
* KTX2 file and is refused by name rather than parsed hopefully.
|
|
8
|
+
*
|
|
9
|
+
* @see https://registry.khronos.org/KTX/specs/2.0/ktxspec.v2.html#_identifier
|
|
10
|
+
* @readonly
|
|
11
|
+
* @type {Uint8Array}
|
|
12
|
+
*/
|
|
13
|
+
export const KTX2_IDENTIFIER = new Uint8Array([
|
|
14
|
+
0xAB, 0x4B, 0x54, 0x58, 0x20, 0x32, 0x30, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
|
|
15
|
+
]);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {KhrDfModel|number} model
|
|
3
|
+
* @returns {string} the specification's name for `model`, or a description of the number when it
|
|
4
|
+
* names nothing this reader knows
|
|
5
|
+
*/
|
|
6
|
+
export function khr_df_model_name(model: KhrDfModel | number): string;
|
|
7
|
+
/**
|
|
8
|
+
* The `colorModel` field of a Khronos Data Format basic descriptor block.
|
|
9
|
+
*
|
|
10
|
+
* Only the models a KTX2 file can carry are named, and only two of them matter to this reader: when
|
|
11
|
+
* `vkFormat` is `VK_FORMAT_UNDEFINED` the payload is Basis Universal, and this field is the one
|
|
12
|
+
* thing in the file that says which of the two Basis encodings it is. Every other model reaches the
|
|
13
|
+
* reader through `vkFormat` instead, so the value is read for the refusal message rather than for
|
|
14
|
+
* the format.
|
|
15
|
+
*/
|
|
16
|
+
export type KhrDfModel = number;
|
|
17
|
+
export namespace KhrDfModel {
|
|
18
|
+
let Unspecified: number;
|
|
19
|
+
let RGBSDA: number;
|
|
20
|
+
let BC1A: number;
|
|
21
|
+
let BC2: number;
|
|
22
|
+
let BC3: number;
|
|
23
|
+
let BC4: number;
|
|
24
|
+
let BC5: number;
|
|
25
|
+
let BC6H: number;
|
|
26
|
+
let BC7: number;
|
|
27
|
+
let ETC1: number;
|
|
28
|
+
let ETC2: number;
|
|
29
|
+
let ASTC: number;
|
|
30
|
+
let ETC1S: number;
|
|
31
|
+
let PVRTC: number;
|
|
32
|
+
let PVRTC2: number;
|
|
33
|
+
let UASTC: number;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=KhrDfModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KhrDfModel.d.ts","sourceRoot":"","sources":["../../../src/ktx2/KhrDfModel.js"],"names":[],"mappings":"AAmCA;;;;GAIG;AACH,yCAJW,UAAU,GAAC,MAAM,GACf,MAAM,CAWlB;;;;;;;;;;yBArCS,MAAM"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `colorModel` field of a Khronos Data Format basic descriptor block.
|
|
3
|
+
*
|
|
4
|
+
* Only the models a KTX2 file can carry are named, and only two of them matter to this reader: when
|
|
5
|
+
* `vkFormat` is `VK_FORMAT_UNDEFINED` the payload is Basis Universal, and this field is the one
|
|
6
|
+
* thing in the file that says which of the two Basis encodings it is. Every other model reaches the
|
|
7
|
+
* reader through `vkFormat` instead, so the value is read for the refusal message rather than for
|
|
8
|
+
* the format.
|
|
9
|
+
*
|
|
10
|
+
* @see https://registry.khronos.org/DataFormat/specs/1.3/dataformat.v1.3.html#_khr_df_model
|
|
11
|
+
* @readonly
|
|
12
|
+
* @enum {number}
|
|
13
|
+
*/
|
|
14
|
+
export const KhrDfModel = {
|
|
15
|
+
Unspecified: 0,
|
|
16
|
+
/** ordinary colour channels — red, green, blue, stencil, depth, alpha */
|
|
17
|
+
RGBSDA: 1,
|
|
18
|
+
BC1A: 128,
|
|
19
|
+
BC2: 129,
|
|
20
|
+
BC3: 130,
|
|
21
|
+
BC4: 131,
|
|
22
|
+
BC5: 132,
|
|
23
|
+
BC6H: 133,
|
|
24
|
+
BC7: 134,
|
|
25
|
+
ETC1: 160,
|
|
26
|
+
ETC2: 161,
|
|
27
|
+
ASTC: 162,
|
|
28
|
+
/** Basis Universal, low quality tier. Transcoded, never sampled directly. */
|
|
29
|
+
ETC1S: 163,
|
|
30
|
+
PVRTC: 164,
|
|
31
|
+
PVRTC2: 165,
|
|
32
|
+
/** Basis Universal, high quality tier. Transcoded, never sampled directly. */
|
|
33
|
+
UASTC: 166,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {KhrDfModel|number} model
|
|
38
|
+
* @returns {string} the specification's name for `model`, or a description of the number when it
|
|
39
|
+
* names nothing this reader knows
|
|
40
|
+
*/
|
|
41
|
+
export function khr_df_model_name(model) {
|
|
42
|
+
for (const [name, value] of Object.entries(KhrDfModel)) {
|
|
43
|
+
if (value === model) {
|
|
44
|
+
return name;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return `colour model ${model}`;
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What, if anything, was applied to a KTX2 level's bytes after encoding.
|
|
3
|
+
*
|
|
4
|
+
* Orthogonal to `vkFormat`: supercompression wraps an already-encoded payload, so a BC7 file and a
|
|
5
|
+
* ZLIB-supercompressed BC7 file hold the same blocks and differ only in how they got there. The one
|
|
6
|
+
* exception is {@link BasisLZ }, which is not a wrapper at all — it is an encoding, with its own
|
|
7
|
+
* global data in the SGD section, and a file that uses it carries no `vkFormat`.
|
|
8
|
+
*/
|
|
9
|
+
export type SupercompressionScheme = number;
|
|
10
|
+
export namespace SupercompressionScheme {
|
|
11
|
+
let None: number;
|
|
12
|
+
let BasisLZ: number;
|
|
13
|
+
let Zstandard: number;
|
|
14
|
+
let ZLIB: number;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=SupercompressionScheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupercompressionScheme.d.ts","sourceRoot":"","sources":["../../../src/ktx2/SupercompressionScheme.js"],"names":[],"mappings":";;;;;;;;qCAUU,MAAM"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What, if anything, was applied to a KTX2 level's bytes after encoding.
|
|
3
|
+
*
|
|
4
|
+
* Orthogonal to `vkFormat`: supercompression wraps an already-encoded payload, so a BC7 file and a
|
|
5
|
+
* ZLIB-supercompressed BC7 file hold the same blocks and differ only in how they got there. The one
|
|
6
|
+
* exception is {@link BasisLZ}, which is not a wrapper at all — it is an encoding, with its own
|
|
7
|
+
* global data in the SGD section, and a file that uses it carries no `vkFormat`.
|
|
8
|
+
*
|
|
9
|
+
* @see https://registry.khronos.org/KTX/specs/2.0/ktxspec.v2.html#_supercompressionscheme
|
|
10
|
+
* @readonly
|
|
11
|
+
* @enum {number}
|
|
12
|
+
*/
|
|
13
|
+
export const SupercompressionScheme = {
|
|
14
|
+
/** the level bytes are the texel bytes */
|
|
15
|
+
None: 0,
|
|
16
|
+
/** ETC1S with a BasisLZ-coded endpoint/selector codebook. Needs a transcoder, not a decompressor. */
|
|
17
|
+
BasisLZ: 1,
|
|
18
|
+
/** each level is an independent Zstandard frame */
|
|
19
|
+
Zstandard: 2,
|
|
20
|
+
/** each level is an independent zlib stream, RFC 1950 framing */
|
|
21
|
+
ZLIB: 3,
|
|
22
|
+
};
|
|
23
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a KTX2 file into the texel payload the engine uploads.
|
|
3
|
+
*
|
|
4
|
+
* **The whole contract is `bytes -> ShadeTexelData`.** No device, no queue, no engine: the same
|
|
5
|
+
* function serves a worker, a node tool and the offline encoder, which is why a container reader is
|
|
6
|
+
* not engine code. What it produces is the ordinary payload — a compressed texture entering this way
|
|
7
|
+
* is indistinguishable, below `ShadeImage`, from one that arrived any other way.
|
|
8
|
+
*
|
|
9
|
+
* **What it reads.** A file whose payload is already in a format WebGPU can sample: any `vkFormat`
|
|
10
|
+
* that maps to a `GPUTextureFormat` (see {@link vk_format_to_texture_format}), with
|
|
11
|
+
* {@link SupercompressionScheme.None} or {@link SupercompressionScheme.ZLIB}. That is what
|
|
12
|
+
* first-party tooling emits, and it needs no transcoder.
|
|
13
|
+
*
|
|
14
|
+
* **What it refuses, by name.** Everything else, individually, because the point of a refusal is to
|
|
15
|
+
* say which feature is missing rather than to produce a texture full of the wrong bytes:
|
|
16
|
+
*
|
|
17
|
+
* | Refused | Why |
|
|
18
|
+
* |---|---|
|
|
19
|
+
* | {@link SupercompressionScheme.BasisLZ} | ETC1S, and a transcoder is not a decompressor |
|
|
20
|
+
* | {@link SupercompressionScheme.Zstandard} | there is no Zstandard decompressor in this repository |
|
|
21
|
+
* | `VK_FORMAT_UNDEFINED` (ETC1S / UASTC) | Basis Universal, transcoded rather than sampled |
|
|
22
|
+
* | an unmapped `vkFormat` | WebGPU does not expose it |
|
|
23
|
+
* | `layerCount > 0`, `faceCount == 6` | array and cube textures, which {@link ShadeTexelData} does not model |
|
|
24
|
+
* | `pixelHeight == 0` | a 1D texture, likewise |
|
|
25
|
+
* | a 3D block-compressed payload | needs `texture-compression-*-sliced-3d`, which nothing here asks for |
|
|
26
|
+
* | `levelCount == 0` on a block format | see below |
|
|
27
|
+
* | a non-default `KTXorientation` or `KTXswizzle` | the bytes would need rearranging, and nothing here rearranges them |
|
|
28
|
+
*
|
|
29
|
+
* **`levelCount == 0` means "generate the mip chain at load", which is not the same as `1`.** It is
|
|
30
|
+
* an *instruction*, and the payload type carries data rather than instructions: the engine's
|
|
31
|
+
* instruction is `ShadeTextureFlags.GenerateMipMaps`, which lives on the `ShadeTexture` and is
|
|
32
|
+
* honoured or thrown. So a `levelCount == 0` file reads as the single level it physically contains,
|
|
33
|
+
* and whether mips get generated is the caller's to state — which is the same rule that makes a
|
|
34
|
+
* supplied chain and a generated one distinguishable at all. For a block-compressed payload the
|
|
35
|
+
* instruction cannot be honoured by anything, at any layer, so that combination is refused here
|
|
36
|
+
* rather than left to fail later with a message about a flag the file never mentioned.
|
|
37
|
+
*
|
|
38
|
+
* **The level index is base-first; the image data usually is not.** KTX2 conventionally stores the
|
|
39
|
+
* smallest level at the lowest offset, so levels are read through `byteOffset` and never by walking
|
|
40
|
+
* the file. `levels[0]` is the base level whatever order the file laid its bytes out in.
|
|
41
|
+
*
|
|
42
|
+
* Level bytes are views onto `bytes`, not copies, wherever supercompression permits it — the payload
|
|
43
|
+
* is the overwhelming majority of a texture file, and copying it to hand it to `writeTexture` would
|
|
44
|
+
* double the peak memory of every texture load for nothing.
|
|
45
|
+
*
|
|
46
|
+
* @param {ArrayBuffer|Uint8Array} bytes the whole file
|
|
47
|
+
* @returns {ShadeTexelData}
|
|
48
|
+
* @throws {Error} naming the feature, for a file this reader does not read; naming the field, for a
|
|
49
|
+
* file that is truncated or self-inconsistent
|
|
50
|
+
*
|
|
51
|
+
* @see https://registry.khronos.org/KTX/specs/2.0/ktxspec.v2.html
|
|
52
|
+
* @author Alex Goldring
|
|
53
|
+
* @copyright Company Named Limited (c) 2026
|
|
54
|
+
*/
|
|
55
|
+
export function ktx2_read(bytes: ArrayBuffer | Uint8Array): ShadeTexelData;
|
|
56
|
+
export type Ktx2LevelIndexEntry = {
|
|
57
|
+
/**
|
|
58
|
+
* where this level's bytes are, from the start of the file
|
|
59
|
+
*/
|
|
60
|
+
byte_offset: number;
|
|
61
|
+
/**
|
|
62
|
+
* how many of them there are, supercompressed
|
|
63
|
+
*/
|
|
64
|
+
byte_length: number;
|
|
65
|
+
/**
|
|
66
|
+
* how many there are after inflation
|
|
67
|
+
*/
|
|
68
|
+
uncompressed_byte_length: number;
|
|
69
|
+
};
|
|
70
|
+
import { ShadeTexelData } from "../shade/renderer/texture/source/ShadeTexelData.js";
|
|
71
|
+
//# sourceMappingURL=ktx2_read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ktx2_read.d.ts","sourceRoot":"","sources":["../../../src/ktx2/ktx2_read.js"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,iCATW,WAAW,GAAC,UAAU,GACpB,cAAc,CA2F1B;;;;;iBA4Sa,MAAM;;;;iBACN,MAAM;;;;8BACN,MAAM;;+BAheW,oDAAoD"}
|