Custom Model Loader

Hi

I need to implement the customized model type loader like

class CustomFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
    public createPlugin() : ISceneLoaderPlugin | ISceneLoaderPluginAsync {
        return new CustomFileLoader();
    }

But I am not sure how to register it in system.
I want to use

viewer.initModel(modelConfig, true);

viewer is DefaultViewer and modelConfig is IModelConfiguration .
in the modelConfig.loader can be only string.
How can get the string from CustomFileLoader class?

Thanks for your reply.

A custom file loader registers itself with the scene loader (BABYLON.SceneLoader if you are using the UMD version). You need to register the extension using RegisterPlugin, passing the file type it should be used on. You can check the babylonFileLoader to see how it is done there.

3 Likes

Nice, Thanks for your answer!

1 Like