|
@@ -58,7 +58,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
var prepareWebGLTexture = (texture: WebGLTexture, gl: WebGLRenderingContext, scene: Scene, width: number, height: number, invertY: boolean, noMipmap: boolean, isCompressed: boolean,
|
|
var prepareWebGLTexture = (texture: WebGLTexture, gl: WebGLRenderingContext, scene: Scene, width: number, height: number, invertY: boolean, noMipmap: boolean, isCompressed: boolean,
|
|
- processFunction: (width: number, height: number) => void, onLoad: () => void, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) => {
|
|
|
|
|
|
+ processFunction: (width: number, height: number) => void, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) => {
|
|
var engine = scene.getEngine();
|
|
var engine = scene.getEngine();
|
|
var potWidth = Tools.GetExponentOfTwo(width, engine.getCaps().maxTextureSize);
|
|
var potWidth = Tools.GetExponentOfTwo(width, engine.getCaps().maxTextureSize);
|
|
var potHeight = Tools.GetExponentOfTwo(height, engine.getCaps().maxTextureSize);
|
|
var potHeight = Tools.GetExponentOfTwo(height, engine.getCaps().maxTextureSize);
|
|
@@ -88,9 +88,9 @@
|
|
engine.resetTextureCache();
|
|
engine.resetTextureCache();
|
|
scene._removePendingData(texture);
|
|
scene._removePendingData(texture);
|
|
|
|
|
|
- if (onLoad) {
|
|
|
|
- onLoad();
|
|
|
|
- }
|
|
|
|
|
|
+ texture.onLoadedCallbacks.forEach(function (callback) {
|
|
|
|
+ callback();
|
|
|
|
+ });
|
|
};
|
|
};
|
|
|
|
|
|
var partialLoad = (url: string, index: number, loadedImages: any, scene,
|
|
var partialLoad = (url: string, index: number, loadedImages: any, scene,
|
|
@@ -1853,6 +1853,7 @@
|
|
texture.noMipmap = noMipmap;
|
|
texture.noMipmap = noMipmap;
|
|
texture.references = 1;
|
|
texture.references = 1;
|
|
texture.samplingMode = samplingMode;
|
|
texture.samplingMode = samplingMode;
|
|
|
|
+ texture.onLoadedCallbacks = [onLoad];
|
|
this._loadedTexturesCache.push(texture);
|
|
this._loadedTexturesCache.push(texture);
|
|
|
|
|
|
var onerror = () => {
|
|
var onerror = () => {
|
|
@@ -1871,7 +1872,7 @@
|
|
|
|
|
|
prepareWebGLTexture(texture, this._gl, scene, header.width, header.height, invertY, noMipmap, false, () => {
|
|
prepareWebGLTexture(texture, this._gl, scene, header.width, header.height, invertY, noMipmap, false, () => {
|
|
Internals.TGATools.UploadContent(this._gl, data);
|
|
Internals.TGATools.UploadContent(this._gl, data);
|
|
- }, onLoad, samplingMode);
|
|
|
|
|
|
+ }, samplingMode);
|
|
};
|
|
};
|
|
if (!(fromData instanceof Array))
|
|
if (!(fromData instanceof Array))
|
|
Tools.LoadFile(url, arrayBuffer => {
|
|
Tools.LoadFile(url, arrayBuffer => {
|
|
@@ -1888,7 +1889,7 @@
|
|
prepareWebGLTexture(texture, this._gl, scene, info.width, info.height, invertY, !loadMipmap, info.isFourCC, () => {
|
|
prepareWebGLTexture(texture, this._gl, scene, info.width, info.height, invertY, !loadMipmap, info.isFourCC, () => {
|
|
|
|
|
|
Internals.DDSTools.UploadDDSLevels(this._gl, this.getCaps().s3tc, data, info, loadMipmap, 1);
|
|
Internals.DDSTools.UploadDDSLevels(this._gl, this.getCaps().s3tc, data, info, loadMipmap, 1);
|
|
- }, onLoad, samplingMode);
|
|
|
|
|
|
+ }, samplingMode);
|
|
};
|
|
};
|
|
|
|
|
|
if (!(fromData instanceof Array))
|
|
if (!(fromData instanceof Array))
|
|
@@ -1927,7 +1928,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, isPot ? img : this._workingCanvas);
|
|
this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, isPot ? img : this._workingCanvas);
|
|
- }, onLoad, samplingMode);
|
|
|
|
|
|
+ }, samplingMode);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|