@ignifx/core 0.15.0 → 0.16.0
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/decoders/draco3dgltf.LICENSE.md +201 -0
- package/decoders/draco_decoder.js +116 -0
- package/decoders/draco_decoder_gltf.wasm +0 -0
- package/decoders/vendored.json +22 -0
- package/dist/{decoders-CHJ7vduE.js → decoders-BUQrlS8U.js} +3 -2
- package/dist/decoders-BUQrlS8U.js.map +1 -0
- package/dist/index.d.ts +58 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +642 -489
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/dist/decoders-CHJ7vduE.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ignifx/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "ignifx core: app, world, entities, components, scripts, and the Babylon Lite adapter boundary.",
|
|
5
5
|
"homepage": "https://ignifx.com",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,7 +56,9 @@
|
|
|
56
56
|
"decoders/uastc_rgba8_srgb_v2.wasm",
|
|
57
57
|
"decoders/uastc_rgba8_unorm_v2.wasm",
|
|
58
58
|
"decoders/zstddec.wasm",
|
|
59
|
-
"decoders/meshopt_decoder.js"
|
|
59
|
+
"decoders/meshopt_decoder.js",
|
|
60
|
+
"decoders/draco_decoder.js",
|
|
61
|
+
"decoders/draco_decoder_gltf.wasm"
|
|
60
62
|
]
|
|
61
63
|
}
|
|
62
64
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decoders-CHJ7vduE.js","names":[],"sources":["../src/lite/gpu/decoders.ts"],"sourcesContent":["import {\n getOrCreateSampler,\n loadBasisTexture2D,\n loadKtx2Texture2D,\n setKtx2DecoderUrl,\n setMeshoptBaseUrl,\n} from \"@babylonjs/lite\";\nimport type { EngineContext, Texture2D, Texture2DOptions } from \"@babylonjs/lite\";\n\n/**\n * The compressed-texture and decoder half of the Babylon Lite adapter\n * (`docs/architecture/07-rendering.md` §7). Imported only dynamically, from `./texture.ts` and\n * `../../render/decoder-urls.ts`, so a game that loads no KTX2 texture and no glTF carries none of\n * Lite's KTX2, Basis or meshopt glue.\n *\n * Everything here is `@internal`.\n *\n * ## The decoders (verified against `@babylonjs/lite@1.34.0`)\n *\n * `loadKtx2Texture2D` (`index.d.ts` 7892) and the glTF `KHR_texture_basisu` path inject\n * `babylon.ktx2Decoder.js` as a `<script>` and read the `KTX2DECODER` global it defines; that\n * script then fetches its transcoders (`msc_basis_transcoder.js` and `.wasm` for ETC1S,\n * `uastc_*.wasm` for UASTC, `zstddec.wasm` for Zstandard supercompression). glTF\n * `EXT_meshopt_compression` injects `meshopt_decoder.js`. Every one of them comes from\n * `https://cdn.babylonjs.com/` unless `setKtx2DecoderUrl` (12484) and `setMeshoptBaseUrl` (12538)\n * say otherwise (`lib/texture/ktx2-loader.js`, `lib/loader-gltf/meshopt-decode.js`). Both setters\n * write process-wide state, and the KTX2 decoder is loaded once: a URL set after the first KTX2\n * load is ignored until a failed load clears Lite's cached promise.\n *\n * `loadBasisTexture2D` (7771) has no such setter. It always fetches `basis_transcoder.js` and its\n * WASM from `https://cdn.babylonjs.com/basisTranscoder/1/` (`lib/texture/basis-loader.js`), so a\n * `.basis` file cannot load under a `script-src 'self'` policy until Lite adds one.\n *\n * ## Transcode targets\n *\n * Lite picks them; the public API has no override. Its caps come from the device features\n * `texture-compression-{astc,bc,etc2}`, which `createEngine` requests whenever the adapter has\n * them (`lib/engine/engine.js`). The decoder's decision tree (`@babylonjs/ktx2decoder`\n * `transcodeDecisionTree.js`) then gives:\n *\n * - ETC1S: ETC2 (RGB, or RGBA with alpha) when `etc2` is present, else BC7 when `bc` is, else RGBA8.\n * - UASTC: ASTC 4×4 when `astc` is present, else BC7 when `bc` is, else ETC2 when `etc2` is, else\n * RGBA8.\n *\n * So a Windows or Linux desktop GPU gets BC7, Apple silicon gets ETC2 (ETC1S) or ASTC (UASTC),\n * and a device with no compression feature gets uncompressed RGBA8. `.basis` uses Lite's own\n * order: BC7, ASTC 4×4, ETC2, BC3, BC1, RGBA8.\n */\n\n/**\n * Where Lite should load its decoders from. A `null` field leaves Lite's default for that decoder.\n *\n * @internal\n */\nexport interface LiteDecoderUrls {\n /** The URL of `babylon.ktx2Decoder.js`, or `null` for Lite's CDN default. */\n readonly ktx2Decoder: string | null;\n /**\n * Overrides for the decoder's transcoder modules: class name in the `KTX2DECODER` namespace →\n * static property → URL, the second argument of `setKtx2DecoderUrl`. Ignored when\n * {@link LiteDecoderUrls.ktx2Decoder} is `null`.\n */\n readonly ktx2Transcoders: Readonly<Record<string, Readonly<Record<string, string>>>>;\n /** The directory `meshopt_decoder.js` is served from, or `null` for Lite's CDN default. */\n readonly meshoptBaseUrl: string | null;\n}\n\n/**\n * Points Lite at the given decoder locations.\n *\n * @param urls - The locations; `null` fields are left as they are.\n *\n * @internal\n */\nexport function applyLiteDecoderUrls(urls: LiteDecoderUrls): void {\n if (urls.ktx2Decoder !== null) {\n // `setKtx2DecoderUrl` keeps its own reference; a copy keeps the caller's object frozen-safe.\n const transcoders: Record<string, Record<string, string>> = {};\n for (const [name, properties] of Object.entries(urls.ktx2Transcoders)) {\n transcoders[name] = { ...properties };\n }\n setKtx2DecoderUrl(urls.ktx2Decoder, transcoders);\n }\n if (urls.meshoptBaseUrl !== null) {\n setMeshoptBaseUrl(urls.meshoptBaseUrl);\n }\n}\n\n/**\n * Loads a `.ktx2` texture through Lite's KTX2 decoder and gives it the requested sampler.\n *\n * @remarks\n * `loadKtx2Texture2D` takes only the URL and the sRGB flag. It uploads the file's own mip chain as\n * stored, with a fixed repeat/linear sampler; the sampler is rebuilt here from `options`.\n *\n * ## Orientation: rows as stored\n *\n * Compressed blocks cannot be flipped at upload, so `invertY` has no effect: the file's first row\n * lands at the top of the GPU texture, which is what a PNG gets with `invertY: false`. Lite marks\n * the handle `invertY` and documents that materials flip V for it (`index.d.ts` 14966), but in\n * 1.34 no material reads the flag, and a props-built PBR material ignores `setTextureTransform`\n * too (its UV-transform variant is enabled only by the glTF builder). Measured in\n * `test/assets/ktx2.browser.test.ts`: a top-row-first `.ktx2` draws upside down next to the same\n * PNG loaded with the default `invertY: true`, and a `.ktx2` encoded from the vertically flipped\n * image draws the same. So a `.ktx2` meant to replace a PNG under the default sidecar is encoded\n * flipped (Basis `setYFlip(true)`); `mipMaps` and `premultiplyAlpha` do not apply either.\n *\n * @param engine - The engine that owns the GPU texture.\n * @param url - Where to fetch the file from.\n * @param options - Colour space and sampler.\n * @returns The texture, transcoded to the device's best compressed format. Its reference count\n * starts at one, like `loadTexture2D`'s.\n *\n * @internal\n */\nexport async function loadKtx2TextureWithOptions(\n engine: EngineContext,\n url: string,\n options: Texture2DOptions,\n): Promise<Texture2D> {\n const texture = await loadKtx2Texture2D(engine, url, options.srgb ?? false);\n const hasMips = texture.texture.mipLevelCount > 1;\n const minFilter = options.minFilter ?? \"linear\";\n const magFilter = options.magFilter ?? \"linear\";\n const mipmapFilter: GPUMipmapFilterMode = hasMips ? \"linear\" : \"nearest\";\n // WebGPU accepts anisotropy only when every filter is linear; this is Lite's own rule for\n // `loadTexture2D`.\n const allLinear = minFilter === \"linear\" && magFilter === \"linear\" && mipmapFilter === \"linear\";\n texture.sampler = getOrCreateSampler(engine, {\n addressModeU: options.addressModeU ?? \"repeat\",\n addressModeV: options.addressModeV ?? \"repeat\",\n minFilter,\n magFilter,\n mipmapFilter,\n maxAnisotropy: allLinear ? 4 : 1,\n });\n return texture;\n}\n\n/**\n * Loads a `.basis` texture through Lite's Basis Universal loader.\n *\n * @remarks\n * Sampler and sRGB options apply; `mipMaps` and `invertY` are ignored by Lite. The transcoder always\n * comes from the Babylon CDN (see the module comment).\n *\n * @param engine - The engine that owns the GPU texture.\n * @param url - Where to fetch the file from.\n * @param options - Colour space and sampler.\n * @returns The texture.\n *\n * @internal\n */\nexport function loadBasisTextureWithOptions(\n engine: EngineContext,\n url: string,\n options: Texture2DOptions,\n): Promise<Texture2D> {\n return loadBasisTexture2D(engine, url, options);\n}\n"],"mappings":";;;;;;;;;AA0EA,SAAgB,qBAAqB,MAA6B;CAChE,IAAI,KAAK,gBAAgB,MAAM;EAE7B,MAAM,cAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,KAAK,eAAe,GAClE,YAAY,QAAQ,EAAE,GAAG,WAAW;EAEtC,kBAAkB,KAAK,aAAa,WAAW;CACjD;CACA,IAAI,KAAK,mBAAmB,MAC1B,kBAAkB,KAAK,cAAc;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,eAAsB,2BACpB,QACA,KACA,SACoB;CACpB,MAAM,UAAU,MAAM,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ,KAAK;CAC1E,MAAM,UAAU,QAAQ,QAAQ,gBAAgB;CAChD,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,eAAoC,UAAU,WAAW;CAG/D,MAAM,YAAY,cAAc,YAAY,cAAc,YAAY,iBAAiB;CACvF,QAAQ,UAAU,mBAAmB,QAAQ;EAC3C,cAAc,QAAQ,gBAAgB;EACtC,cAAc,QAAQ,gBAAgB;EACtC;EACA;EACA;EACA,eAAe,YAAY,IAAI;CACjC,CAAC;CACD,OAAO;AACT;;;;;;;;;;;;;;;AAgBA,SAAgB,4BACd,QACA,KACA,SACoB;CACpB,OAAO,mBAAmB,QAAQ,KAAK,OAAO;AAChD"}
|