@galacean/engine-toolkit-custom-gltf-parser
v1.3.9
Published
use custom glTF parser
Downloads
116
Maintainers
Keywords
Readme
glTF custom parser
use custom glTF parser
Usage
import { enableCustomGLTFParser } from "@galacean/engine-toolkit-custom-gltf-parser";
enableCustomGLTFParser();
// custom parser
class CustomMaterialParser extends GLTFMaterialParser {
override parse(context: GLTFParserContext, index: number): Promise<Material> {
console.log("custom material parser");
let materialPromise = super.parse(context, index);
// ...
return materialPromise;
}
}
class CustomTextureParser extends GLTFTextureParser {
override parse(context: GLTFParserContext, index: number): Promise<Texture> {
console.log("custom texture parser");
let texturePromise = super.parse(context, index);
// ...
return texturePromise;
}
}
// load
engine.resourceManager.load({
type: AssetType.GLTF,
url: "",
params: {
customParser: {
[GLTFParserType.Material]: new CustomMaterialParser(),
[GLTFParserType.Texture]: new CustomTextureParser()
}
}
});
Links
License
The engine is released under the MIT license. See LICENSE file.