Skip to content

Instantly share code, notes, and snippets.

@madclaws
Created November 19, 2018 06:33
Show Gist options
  • Save madclaws/1d0faab86095df1cf66c89106b9374fa to your computer and use it in GitHub Desktop.
Save madclaws/1d0faab86095df1cf66c89106b9374fa to your computer and use it in GitHub Desktop.
assetLoader
private loadAssets(){
console.log("loading assets");
this._assetManager=new AssetsManager(this._Scene);
let meshTask=this._assetManager.addMeshTask("gemTask","Skull","Assets/","Skull.obj");
meshTask.onSuccess=(task:MeshAssetTask)=>{
console.log("load success");
console.log(task);
task.loadedMeshes[0].position=Vector3.Zero();
}
meshTask.onError=(task,message,exception)=>{
console.log(message,exception);
}
this._assetManager.onFinish=(tasks)=>{
console.log("loading finished");
this.runEngine();
}
this._assetManager.onProgress = (remainingCount, totalCount, lastFinishedTask)=>{
this._Engine.loadingUIText = 'We are loading the scene. ' + remainingCount + ' out of ' + totalCount + ' items still need to be loaded.';
};
this._assetManager.load();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment