|
@@ -6288,7 +6288,8 @@ var BABYLON;
|
|
});
|
|
});
|
|
texture.onLoadedCallbacks = [];
|
|
texture.onLoadedCallbacks = [];
|
|
};
|
|
};
|
|
- var partialLoad = function (url, index, loadedImages, scene, onfinish) {
|
|
|
|
|
|
+ var partialLoad = function (url, index, loadedImages, scene, onfinish, onErrorCallBack) {
|
|
|
|
+ if (onErrorCallBack === void 0) { onErrorCallBack = null; }
|
|
var img;
|
|
var img;
|
|
var onload = function () {
|
|
var onload = function () {
|
|
loadedImages[index] = img;
|
|
loadedImages[index] = img;
|
|
@@ -6300,15 +6301,19 @@ var BABYLON;
|
|
};
|
|
};
|
|
var onerror = function () {
|
|
var onerror = function () {
|
|
scene._removePendingData(img);
|
|
scene._removePendingData(img);
|
|
|
|
+ if (onErrorCallBack) {
|
|
|
|
+ onErrorCallBack();
|
|
|
|
+ }
|
|
};
|
|
};
|
|
img = BABYLON.Tools.LoadImage(url, onload, onerror, scene.database);
|
|
img = BABYLON.Tools.LoadImage(url, onload, onerror, scene.database);
|
|
scene._addPendingData(img);
|
|
scene._addPendingData(img);
|
|
};
|
|
};
|
|
- var cascadeLoad = function (rootUrl, scene, onfinish, files) {
|
|
|
|
|
|
+ var cascadeLoad = function (rootUrl, scene, onfinish, files, onError) {
|
|
|
|
+ if (onError === void 0) { onError = null; }
|
|
var loadedImages = [];
|
|
var loadedImages = [];
|
|
loadedImages._internalCount = 0;
|
|
loadedImages._internalCount = 0;
|
|
for (var index = 0; index < 6; index++) {
|
|
for (var index = 0; index < 6; index++) {
|
|
- partialLoad(files[index], index, loadedImages, scene, onfinish);
|
|
|
|
|
|
+ partialLoad(files[index], index, loadedImages, scene, onfinish, onError);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
var InstancingAttributeInfo = (function () {
|
|
var InstancingAttributeInfo = (function () {
|
|
@@ -8226,8 +8231,10 @@ var BABYLON;
|
|
this._loadedTexturesCache.push(texture);
|
|
this._loadedTexturesCache.push(texture);
|
|
return texture;
|
|
return texture;
|
|
};
|
|
};
|
|
- Engine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap) {
|
|
|
|
|
|
+ Engine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad, onError) {
|
|
var _this = this;
|
|
var _this = this;
|
|
|
|
+ if (onLoad === void 0) { onLoad = null; }
|
|
|
|
+ if (onError === void 0) { onError = null; }
|
|
var gl = this._gl;
|
|
var gl = this._gl;
|
|
var texture = gl.createTexture();
|
|
var texture = gl.createTexture();
|
|
texture.isCube = true;
|
|
texture.isCube = true;
|
|
@@ -8254,7 +8261,7 @@ var BABYLON;
|
|
texture._width = info.width;
|
|
texture._width = info.width;
|
|
texture._height = info.height;
|
|
texture._height = info.height;
|
|
texture.isReady = true;
|
|
texture.isReady = true;
|
|
- }, null, null, true);
|
|
|
|
|
|
+ }, null, null, true, onError);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
cascadeLoad(rootUrl, scene, function (imgs) {
|
|
cascadeLoad(rootUrl, scene, function (imgs) {
|
|
@@ -8285,7 +8292,10 @@ var BABYLON;
|
|
texture._width = width;
|
|
texture._width = width;
|
|
texture._height = height;
|
|
texture._height = height;
|
|
texture.isReady = true;
|
|
texture.isReady = true;
|
|
- }, files);
|
|
|
|
|
|
+ if (onLoad) {
|
|
|
|
+ onLoad();
|
|
|
|
+ }
|
|
|
|
+ }, files, onError);
|
|
}
|
|
}
|
|
this._loadedTexturesCache.push(texture);
|
|
this._loadedTexturesCache.push(texture);
|
|
return texture;
|
|
return texture;
|
|
@@ -23166,7 +23176,9 @@ var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
var CubeTexture = (function (_super) {
|
|
var CubeTexture = (function (_super) {
|
|
__extends(CubeTexture, _super);
|
|
__extends(CubeTexture, _super);
|
|
- function CubeTexture(rootUrl, scene, extensions, noMipmap, files) {
|
|
|
|
|
|
+ function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError) {
|
|
|
|
+ if (onLoad === void 0) { onLoad = null; }
|
|
|
|
+ if (onError === void 0) { onError = null; }
|
|
_super.call(this, scene);
|
|
_super.call(this, scene);
|
|
this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
|
|
this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
|
|
this.name = rootUrl;
|
|
this.name = rootUrl;
|
|
@@ -23190,12 +23202,20 @@ var BABYLON;
|
|
this._files = files;
|
|
this._files = files;
|
|
if (!this._texture) {
|
|
if (!this._texture) {
|
|
if (!scene.useDelayedTextureLoading) {
|
|
if (!scene.useDelayedTextureLoading) {
|
|
- this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap);
|
|
|
|
|
|
+ this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
|
|
this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else {
|
|
|
|
+ if (this._texture.isReady) {
|
|
|
|
+ BABYLON.Tools.SetImmediate(function () { return onLoad(); });
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._texture.onLoadedCallbacks.push(onLoad);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
this.isCube = true;
|
|
this.isCube = true;
|
|
this._textureMatrix = BABYLON.Matrix.Identity();
|
|
this._textureMatrix = BABYLON.Matrix.Identity();
|
|
}
|
|
}
|
|
@@ -48744,7 +48764,7 @@ var BABYLON;
|
|
// Why before rendering the canvas? because some primitives may move and get away/under the mouse cursor (which is not moving). So we need to update at both location in order to always have an accurate list, which is needed for the hover state change.
|
|
// Why before rendering the canvas? because some primitives may move and get away/under the mouse cursor (which is not moving). So we need to update at both location in order to always have an accurate list, which is needed for the hover state change.
|
|
this._updateIntersectionList(this._primPointerInfo.canvasPointerPos, capturedPrim !== null, true);
|
|
this._updateIntersectionList(this._primPointerInfo.canvasPointerPos, capturedPrim !== null, true);
|
|
// Update the over status, same as above, it's could be done here or during rendering, but will be performed only once per render frame
|
|
// Update the over status, same as above, it's could be done here or during rendering, but will be performed only once per render frame
|
|
- this._updateOverStatus();
|
|
|
|
|
|
+ this._updateOverStatus(true);
|
|
// Check if we have nothing to raise
|
|
// Check if we have nothing to raise
|
|
if (!this._actualOverPrimitive && !capturedPrim) {
|
|
if (!this._actualOverPrimitive && !capturedPrim) {
|
|
return;
|
|
return;
|
|
@@ -48847,11 +48867,14 @@ var BABYLON;
|
|
this._actualIntersectionList = ii.intersectedPrimitives;
|
|
this._actualIntersectionList = ii.intersectedPrimitives;
|
|
this._previousOverPrimitive = this._actualOverPrimitive;
|
|
this._previousOverPrimitive = this._actualOverPrimitive;
|
|
this._actualOverPrimitive = ii.topMostIntersectedPrimitive;
|
|
this._actualOverPrimitive = ii.topMostIntersectedPrimitive;
|
|
|
|
+ if (this._previousOverPrimitive && this._actualOverPrimitive && this._previousOverPrimitive.prim !== this._actualOverPrimitive.prim) {
|
|
|
|
+ console.log("changed");
|
|
|
|
+ }
|
|
this._intersectionRenderId = this.scene.getRenderId();
|
|
this._intersectionRenderId = this.scene.getRenderId();
|
|
};
|
|
};
|
|
// Based on the previousIntersectionList and the actualInstersectionList we can determined which primitives are being hover state or loosing it
|
|
// Based on the previousIntersectionList and the actualInstersectionList we can determined which primitives are being hover state or loosing it
|
|
- Canvas2D.prototype._updateOverStatus = function () {
|
|
|
|
- if ((this.scene.getRenderId() === this._hoverStatusRenderId) || !this._previousIntersectionList || !this._actualIntersectionList) {
|
|
|
|
|
|
+ Canvas2D.prototype._updateOverStatus = function (force) {
|
|
|
|
+ if ((!force && (this.scene.getRenderId() === this._hoverStatusRenderId)) || !this._previousIntersectionList || !this._actualIntersectionList) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// Detect a change of over
|
|
// Detect a change of over
|
|
@@ -48981,6 +49004,7 @@ var BABYLON;
|
|
var ppi = _this._primPointerInfo;
|
|
var ppi = _this._primPointerInfo;
|
|
var capturedPrim = _this.getCapturedPrimitive(ppi.pointerId);
|
|
var capturedPrim = _this.getCapturedPrimitive(ppi.pointerId);
|
|
_this._updateIntersectionList(ppi.canvasPointerPos, capturedPrim !== null, true);
|
|
_this._updateIntersectionList(ppi.canvasPointerPos, capturedPrim !== null, true);
|
|
|
|
+ _this._updateOverStatus(false);
|
|
var ii = new BABYLON.IntersectInfo2D();
|
|
var ii = new BABYLON.IntersectInfo2D();
|
|
ii.pickPosition = ppi.canvasPointerPos.clone();
|
|
ii.pickPosition = ppi.canvasPointerPos.clone();
|
|
ii.findFirstOnly = false;
|
|
ii.findFirstOnly = false;
|
|
@@ -49497,7 +49521,7 @@ var BABYLON;
|
|
this._updateCanvasState(false);
|
|
this._updateCanvasState(false);
|
|
if (this._primPointerInfo.canvasPointerPos) {
|
|
if (this._primPointerInfo.canvasPointerPos) {
|
|
this._updateIntersectionList(this._primPointerInfo.canvasPointerPos, false, false);
|
|
this._updateIntersectionList(this._primPointerInfo.canvasPointerPos, false, false);
|
|
- this._updateOverStatus(); // TODO this._primPointerInfo may not be up to date!
|
|
|
|
|
|
+ this._updateOverStatus(false); // TODO this._primPointerInfo may not be up to date!
|
|
}
|
|
}
|
|
this.engine.setState(false);
|
|
this.engine.setState(false);
|
|
this._groupRender();
|
|
this._groupRender();
|
|
@@ -54017,6 +54041,35 @@ var BABYLON;
|
|
return TextureAssetTask;
|
|
return TextureAssetTask;
|
|
}());
|
|
}());
|
|
BABYLON.TextureAssetTask = TextureAssetTask;
|
|
BABYLON.TextureAssetTask = TextureAssetTask;
|
|
|
|
+ var CubeTextureAssetTask = (function () {
|
|
|
|
+ function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
|
|
|
|
+ this.name = name;
|
|
|
|
+ this.url = url;
|
|
|
|
+ this.extensions = extensions;
|
|
|
|
+ this.noMipmap = noMipmap;
|
|
|
|
+ this.files = files;
|
|
|
|
+ this.isCompleted = false;
|
|
|
|
+ }
|
|
|
|
+ CubeTextureAssetTask.prototype.run = function (scene, onSuccess, onError) {
|
|
|
|
+ var _this = this;
|
|
|
|
+ var onload = function () {
|
|
|
|
+ _this.isCompleted = true;
|
|
|
|
+ if (_this.onSuccess) {
|
|
|
|
+ _this.onSuccess(_this);
|
|
|
|
+ }
|
|
|
|
+ onSuccess();
|
|
|
|
+ };
|
|
|
|
+ var onerror = function () {
|
|
|
|
+ if (_this.onError) {
|
|
|
|
+ _this.onError(_this);
|
|
|
|
+ }
|
|
|
|
+ onError();
|
|
|
|
+ };
|
|
|
|
+ this.texture = new BABYLON.CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror);
|
|
|
|
+ };
|
|
|
|
+ return CubeTextureAssetTask;
|
|
|
|
+ }());
|
|
|
|
+ BABYLON.CubeTextureAssetTask = CubeTextureAssetTask;
|
|
var AssetsManager = (function () {
|
|
var AssetsManager = (function () {
|
|
function AssetsManager(scene) {
|
|
function AssetsManager(scene) {
|
|
this.tasks = new Array();
|
|
this.tasks = new Array();
|