|
@@ -291,7 +291,7 @@ var BABYLON;
|
|
mag: magFilter
|
|
mag: magFilter
|
|
};
|
|
};
|
|
};
|
|
};
|
|
- var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {
|
|
|
|
|
|
+ var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction, onLoad, samplingMode) {
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
var engine = scene.getEngine();
|
|
var engine = scene.getEngine();
|
|
var potWidth = BABYLON.Tools.GetExponentOfTwo(width, engine.getCaps().maxTextureSize);
|
|
var potWidth = BABYLON.Tools.GetExponentOfTwo(width, engine.getCaps().maxTextureSize);
|
|
@@ -313,6 +313,9 @@ var BABYLON;
|
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
engine.resetTextureCache();
|
|
engine.resetTextureCache();
|
|
scene._removePendingData(texture);
|
|
scene._removePendingData(texture);
|
|
|
|
+ if (onLoad) {
|
|
|
|
+ onLoad();
|
|
|
|
+ }
|
|
};
|
|
};
|
|
var partialLoad = function (url, index, loadedImages, scene, onfinish) {
|
|
var partialLoad = function (url, index, loadedImages, scene, onfinish) {
|
|
var img;
|
|
var img;
|
|
@@ -1420,10 +1423,7 @@ var BABYLON;
|
|
var header = BABYLON.Internals.TGATools.GetTGAHeader(data);
|
|
var header = BABYLON.Internals.TGATools.GetTGAHeader(data);
|
|
prepareWebGLTexture(texture, _this._gl, scene, header.width, header.height, invertY, noMipmap, false, function () {
|
|
prepareWebGLTexture(texture, _this._gl, scene, header.width, header.height, invertY, noMipmap, false, function () {
|
|
BABYLON.Internals.TGATools.UploadContent(_this._gl, data);
|
|
BABYLON.Internals.TGATools.UploadContent(_this._gl, data);
|
|
- if (onLoad) {
|
|
|
|
- onLoad();
|
|
|
|
- }
|
|
|
|
- }, samplingMode);
|
|
|
|
|
|
+ }, onLoad, samplingMode);
|
|
};
|
|
};
|
|
if (!(fromData instanceof Array))
|
|
if (!(fromData instanceof Array))
|
|
BABYLON.Tools.LoadFile(url, function (arrayBuffer) {
|
|
BABYLON.Tools.LoadFile(url, function (arrayBuffer) {
|
|
@@ -1438,10 +1438,7 @@ var BABYLON;
|
|
var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap && ((info.width >> (info.mipmapCount - 1)) === 1);
|
|
var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap && ((info.width >> (info.mipmapCount - 1)) === 1);
|
|
prepareWebGLTexture(texture, _this._gl, scene, info.width, info.height, invertY, !loadMipmap, info.isFourCC, function () {
|
|
prepareWebGLTexture(texture, _this._gl, scene, info.width, info.height, invertY, !loadMipmap, info.isFourCC, function () {
|
|
BABYLON.Internals.DDSTools.UploadDDSLevels(_this._gl, _this.getCaps().s3tc, data, info, loadMipmap, 1);
|
|
BABYLON.Internals.DDSTools.UploadDDSLevels(_this._gl, _this.getCaps().s3tc, data, info, loadMipmap, 1);
|
|
- if (onLoad) {
|
|
|
|
- onLoad();
|
|
|
|
- }
|
|
|
|
- }, samplingMode);
|
|
|
|
|
|
+ }, onLoad, samplingMode);
|
|
};
|
|
};
|
|
if (!(fromData instanceof Array))
|
|
if (!(fromData instanceof Array))
|
|
BABYLON.Tools.LoadFile(url, function (data) {
|
|
BABYLON.Tools.LoadFile(url, function (data) {
|
|
@@ -1475,10 +1472,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
_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);
|
|
- if (onLoad) {
|
|
|
|
- onLoad();
|
|
|
|
- }
|
|
|
|
- }, samplingMode);
|
|
|
|
|
|
+ }, onLoad, samplingMode);
|
|
};
|
|
};
|
|
if (!(fromData instanceof Array))
|
|
if (!(fromData instanceof Array))
|
|
BABYLON.Tools.LoadImage(url, onload, onerror, scene.database);
|
|
BABYLON.Tools.LoadImage(url, onload, onerror, scene.database);
|