|
@@ -31474,11 +31474,17 @@ var BABYLON;
|
|
|
MaterialDefines.prototype.reset = function () {
|
|
|
for (var index = 0; index < this._keys.length; index++) {
|
|
|
var prop = this._keys[index];
|
|
|
- if (typeof (this[prop]) === "number") {
|
|
|
- this[prop] = 0;
|
|
|
- }
|
|
|
- else {
|
|
|
- this[prop] = false;
|
|
|
+ var type = typeof this[prop];
|
|
|
+ switch (type) {
|
|
|
+ case "number":
|
|
|
+ this[prop] = 0;
|
|
|
+ break;
|
|
|
+ case "string":
|
|
|
+ this[prop] = "";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ this[prop] = false;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -31491,11 +31497,17 @@ var BABYLON;
|
|
|
for (var index = 0; index < this._keys.length; index++) {
|
|
|
var prop = this._keys[index];
|
|
|
var value = this[prop];
|
|
|
- if (typeof (value) === "number") {
|
|
|
- result += "#define " + prop + " " + this[prop] + "\n";
|
|
|
- }
|
|
|
- else if (value) {
|
|
|
- result += "#define " + prop + "\n";
|
|
|
+ var type = typeof value;
|
|
|
+ switch (type) {
|
|
|
+ case "number":
|
|
|
+ case "string":
|
|
|
+ result += "#define " + prop + " " + value + "\n";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (value) {
|
|
|
+ result += "#define " + prop + "\n";
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
@@ -41124,7 +41136,7 @@ var BABYLON;
|
|
|
_this.DEPTHPREPASS = false;
|
|
|
_this.ALPHABLEND = false;
|
|
|
_this.ALPHAFROMALBEDO = false;
|
|
|
- _this.ALPHATESTVALUE = 0.5;
|
|
|
+ _this.ALPHATESTVALUE = "0.5";
|
|
|
_this.SPECULAROVERALPHA = false;
|
|
|
_this.RADIANCEOVERALPHA = false;
|
|
|
_this.ALPHAFRESNEL = false;
|
|
@@ -41223,7 +41235,7 @@ var BABYLON;
|
|
|
*/
|
|
|
PBRMaterialDefines.prototype.reset = function () {
|
|
|
_super.prototype.reset.call(this);
|
|
|
- this.ALPHATESTVALUE = 0.5;
|
|
|
+ this.ALPHATESTVALUE = "0.5";
|
|
|
this.PBR = true;
|
|
|
};
|
|
|
return PBRMaterialDefines;
|
|
@@ -42057,7 +42069,7 @@ var BABYLON;
|
|
|
else {
|
|
|
defines.TWOSIDEDLIGHTING = false;
|
|
|
}
|
|
|
- defines.ALPHATESTVALUE = this._alphaCutOff;
|
|
|
+ defines.ALPHATESTVALUE = "" + this._alphaCutOff + (this._alphaCutOff % 1 === 0 ? "." : "");
|
|
|
defines.PREMULTIPLYALPHA = (this.alphaMode === BABYLON.Engine.ALPHA_PREMULTIPLIED || this.alphaMode === BABYLON.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF);
|
|
|
defines.ALPHABLEND = this.needAlphaBlendingForMesh(mesh);
|
|
|
defines.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel;
|
|
@@ -108246,6 +108258,9 @@ var BABYLON;
|
|
|
* @param rootUrl
|
|
|
*/
|
|
|
MTLFileLoader.prototype.parseMTL = function (scene, data, rootUrl) {
|
|
|
+ if (data instanceof ArrayBuffer) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
//Split the lines from the file
|
|
|
var lines = data.split('\n');
|
|
|
//Space char
|
|
@@ -109615,6 +109630,9 @@ var BABYLON;
|
|
|
var Tokenizer = /** @class */ (function () {
|
|
|
function Tokenizer(toParse) {
|
|
|
this._pos = 0;
|
|
|
+ this.currentToken = ETokenType.UNKNOWN;
|
|
|
+ this.currentIdentifier = "";
|
|
|
+ this.currentString = "";
|
|
|
this.isLetterOrDigitPattern = /^[a-zA-Z0-9]+$/;
|
|
|
this._toParse = toParse;
|
|
|
this._maxPos = toParse.length;
|
|
@@ -110727,11 +110745,13 @@ var BABYLON;
|
|
|
var shader = gltfRuntime.shaders[id];
|
|
|
if (BABYLON.Tools.IsBase64(shader.uri)) {
|
|
|
var shaderString = atob(shader.uri.split(",")[1]);
|
|
|
- onSuccess(shaderString);
|
|
|
+ if (onSuccess) {
|
|
|
+ onSuccess(shaderString);
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
BABYLON.Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false, function (request) {
|
|
|
- if (request) {
|
|
|
+ if (request && onError) {
|
|
|
onError(request.status + " " + request.statusText);
|
|
|
}
|
|
|
});
|
|
@@ -111005,6 +111025,9 @@ var BABYLON;
|
|
|
var hasShaders = false;
|
|
|
var processShader = function (sha, shader) {
|
|
|
GLTF1.GLTFLoaderExtension.LoadShaderStringAsync(gltfRuntime, sha, function (shaderString) {
|
|
|
+ if (shaderString instanceof ArrayBuffer) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
gltfRuntime.loadedShaderCount++;
|
|
|
if (shaderString) {
|
|
|
BABYLON.Effect.ShadersStore[sha + (shader.type === GLTF1.EShaderType.VERTEX ? "VertexShader" : "PixelShader")] = shaderString;
|
|
@@ -111402,6 +111425,9 @@ var BABYLON;
|
|
|
return loaderExtension.loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError);
|
|
|
}, function () {
|
|
|
setTimeout(function () {
|
|
|
+ if (!onSuccess) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
onSuccess(GLTF1.GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
|
|
|
});
|
|
|
});
|
|
@@ -111423,7 +111449,11 @@ var BABYLON;
|
|
|
});
|
|
|
};
|
|
|
GLTFLoaderExtension.LoadTextureAsync = function (gltfRuntime, id, onSuccess, onError) {
|
|
|
- GLTFLoaderExtension.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) { return GLTFLoaderExtension.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError); }, onError);
|
|
|
+ GLTFLoaderExtension.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) {
|
|
|
+ if (buffer) {
|
|
|
+ GLTFLoaderExtension.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);
|
|
|
+ }
|
|
|
+ }, onError);
|
|
|
};
|
|
|
GLTFLoaderExtension.LoadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {
|
|
|
GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {
|