We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I try to write my own custom loader like this.https://galacean.antgroup.com/engine/docs/assets/custom/ ,but I cannot use my own custom loader.Here is my loader.
export class ZipLoader extends Loader<GLTFResource>{ load( item: LoadItem, resourceManager: ResourceManager ): AssetPromise<GLTFResource> { // 读取zip压缩文件,然后传回GLTFResource if (item.url) { fs.readFile(item.url!, (err, data) => { if (err) throw err; // 使用JSZip解压文件 JSZip.loadAsync(data).then((zip) => { zip.forEach((relativePath,zipEntry)=>{ if (/\.(gltf|glb)$/i.test(zipEntry.name)) { zipEntry.async("base64").then((file)=>{ return resourceManager.load<GLTFResource>(file); }) } }) }); }); } return new AssetPromise<GLTFResource>((resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) => {}) } }
const baseUrl = "assets/Building/output" // 加载ZIP文件 let self = this; this.engine.resourceManager.load<GALACEAN.GLTFResource>({ type:"ZIP", url:baseUrl+index+".zip" }).then((asset) => { console.log(asset) }) }
The text was updated successfully, but these errors were encountered:
You need to call resourceLoader before use to tell the engine that your loader is required to load this file.
resourceLoader
your loader
Sorry, something went wrong.
You can write like this:
@resourceLoader("ZIP", ["zip"]) export class ZipLoader extends Loader<GLTFResource>{
No branches or pull requests
I try to write my own custom loader like this.https://galacean.antgroup.com/engine/docs/assets/custom/ ,but I cannot use my own custom loader.Here is my loader.
The text was updated successfully, but these errors were encountered: