Request to expose 2 Babylon KTX functions

Hi all!

Related to the earlier post, could the Babylon functions initializeWebWorker()and workerFunction()be exposed on the global BABYLONobject?

I use the CDN babylon.js file instead of importing the npm package. However, to use the 2 functions above, we have to use the npm package like:

import { initializeWebWorker } from '@babylonjs/core/Misc/khronosTextureContainer2Worker.js';

// ...

import { workerFunction } from '@babylonjs/core/Misc/khronosTextureContainer2Worker.js';

since these functions are not exposed on the global BABYLONobject. If possible, I’d like to avoid importing the npm package just to use these 2 functions.

Thank you for your help! :smiley:

do you want to make a PR for it ?

@sebavan I’d be happy to! Though I’m unsure how to go about this

I see that the 2 functions are already exported, but I’m unsure how to make sure that they’re exported on the global BABYLONobject if you could please help advise

The module would need to be exported here: Babylon.js/packages/dev/core/src/Misc/index.ts at master · BabylonJS/Babylon.js · GitHub

I would advise to also rename workerFunction to smthg like KTX2workerFunction and similar for the other one.

1 Like

Ah, thank you so much for guiding me in the right direction!

I’ve just created a PR for your review. Thank you :smiling_face:

1 Like