You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
🆙 the latest updates to Renderer
This commit is contained in:
@@ -74,6 +74,33 @@ export class AssetManager implements IAssetManager
|
||||
return collection;
|
||||
}
|
||||
|
||||
public async loadTextureFromUrl(url: string, name: string = null): Promise<Texture>
|
||||
{
|
||||
if(!url || !url.length) return null;
|
||||
|
||||
let texture = this.getTexture(name);
|
||||
|
||||
if(!texture) texture = this.getTexture(url);
|
||||
|
||||
if(texture) return texture;
|
||||
|
||||
try
|
||||
{
|
||||
texture = await Assets.load<Texture>(url);
|
||||
|
||||
if(!texture) return null;
|
||||
|
||||
this.setTexture(name ?? url, texture);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
catch (err)
|
||||
{
|
||||
NitroLogger.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
public async downloadAssets(urls: string[]): Promise<boolean>
|
||||
{
|
||||
if(!urls || !urls.length) return Promise.resolve(true);
|
||||
|
||||
Reference in New Issue
Block a user