|
@@ -153,28 +153,31 @@ var __extends = (this && this.__extends) || (function () {
|
|
else {
|
|
else {
|
|
fragmentSource = baseName.fragment || baseName;
|
|
fragmentSource = baseName.fragment || baseName;
|
|
}
|
|
}
|
|
- this._loadVertexShader(vertexSource, function (vertexCode) {
|
|
|
|
- _this._processIncludes(vertexCode, function (vertexCodeWithIncludes) {
|
|
|
|
- _this._processShaderConversion(vertexCodeWithIncludes, false, function (migratedVertexCode) {
|
|
|
|
- _this._loadFragmentShader(fragmentSource, function (fragmentCode) {
|
|
|
|
- _this._processIncludes(fragmentCode, function (fragmentCodeWithIncludes) {
|
|
|
|
- _this._processShaderConversion(fragmentCodeWithIncludes, true, function (migratedFragmentCode) {
|
|
|
|
- if (baseName) {
|
|
|
|
- var vertex = baseName.vertexElement || baseName.vertex || baseName;
|
|
|
|
- var fragment = baseName.fragmentElement || baseName.fragment || baseName;
|
|
|
|
- _this._vertexSourceCode = "#define SHADER_NAME vertex:" + vertex + "\n" + migratedVertexCode;
|
|
|
|
- _this._fragmentSourceCode = "#define SHADER_NAME fragment:" + fragment + "\n" + migratedFragmentCode;
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- _this._vertexSourceCode = migratedVertexCode;
|
|
|
|
- _this._fragmentSourceCode = migratedFragmentCode;
|
|
|
|
- }
|
|
|
|
- _this._prepareEffect();
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ var finalVertexCode;
|
|
|
|
+ this._loadVertexShaderAsync(vertexSource)
|
|
|
|
+ .then(function (vertexCode) {
|
|
|
|
+ return _this._processIncludesAsync(vertexCode);
|
|
|
|
+ })
|
|
|
|
+ .then(function (vertexCodeWithIncludes) {
|
|
|
|
+ finalVertexCode = _this._processShaderConversion(vertexCodeWithIncludes, false);
|
|
|
|
+ return _this._loadFragmentShaderAsync(fragmentSource);
|
|
|
|
+ })
|
|
|
|
+ .then(function (fragmentCode) {
|
|
|
|
+ return _this._processIncludesAsync(fragmentCode);
|
|
|
|
+ })
|
|
|
|
+ .then(function (fragmentCodeWithIncludes) {
|
|
|
|
+ var migratedFragmentCode = _this._processShaderConversion(fragmentCodeWithIncludes, true);
|
|
|
|
+ if (baseName) {
|
|
|
|
+ var vertex = baseName.vertexElement || baseName.vertex || baseName;
|
|
|
|
+ var fragment = baseName.fragmentElement || baseName.fragment || baseName;
|
|
|
|
+ _this._vertexSourceCode = "#define SHADER_NAME vertex:" + vertex + "\n" + finalVertexCode;
|
|
|
|
+ _this._fragmentSourceCode = "#define SHADER_NAME fragment:" + fragment + "\n" + migratedFragmentCode;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ _this._vertexSourceCode = finalVertexCode;
|
|
|
|
+ _this._fragmentSourceCode = migratedFragmentCode;
|
|
|
|
+ }
|
|
|
|
+ _this._prepareEffect();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
Object.defineProperty(Effect.prototype, "key", {
|
|
Object.defineProperty(Effect.prototype, "key", {
|
|
@@ -229,25 +232,23 @@ var __extends = (this && this.__extends) || (function () {
|
|
func(effect);
|
|
func(effect);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
- Effect.prototype._loadVertexShader = function (vertex, callback) {
|
|
|
|
|
|
+ /** @ignore */
|
|
|
|
+ Effect.prototype._loadVertexShaderAsync = function (vertex) {
|
|
if (BABYLON.Tools.IsWindowObjectExist()) {
|
|
if (BABYLON.Tools.IsWindowObjectExist()) {
|
|
// DOM element ?
|
|
// DOM element ?
|
|
if (vertex instanceof HTMLElement) {
|
|
if (vertex instanceof HTMLElement) {
|
|
var vertexCode = BABYLON.Tools.GetDOMTextContent(vertex);
|
|
var vertexCode = BABYLON.Tools.GetDOMTextContent(vertex);
|
|
- callback(vertexCode);
|
|
|
|
- return;
|
|
|
|
|
|
+ return Promise.resolve(vertexCode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Base64 encoded ?
|
|
// Base64 encoded ?
|
|
if (vertex.substr(0, 7) === "base64:") {
|
|
if (vertex.substr(0, 7) === "base64:") {
|
|
var vertexBinary = window.atob(vertex.substr(7));
|
|
var vertexBinary = window.atob(vertex.substr(7));
|
|
- callback(vertexBinary);
|
|
|
|
- return;
|
|
|
|
|
|
+ return Promise.resolve(vertexBinary);
|
|
}
|
|
}
|
|
// Is in local store ?
|
|
// Is in local store ?
|
|
if (Effect.ShadersStore[vertex + "VertexShader"]) {
|
|
if (Effect.ShadersStore[vertex + "VertexShader"]) {
|
|
- callback(Effect.ShadersStore[vertex + "VertexShader"]);
|
|
|
|
- return;
|
|
|
|
|
|
+ return Promise.resolve(Effect.ShadersStore[vertex + "VertexShader"]);
|
|
}
|
|
}
|
|
var vertexShaderUrl;
|
|
var vertexShaderUrl;
|
|
if (vertex[0] === "." || vertex[0] === "/" || vertex.indexOf("http") > -1) {
|
|
if (vertex[0] === "." || vertex[0] === "/" || vertex.indexOf("http") > -1) {
|
|
@@ -257,31 +258,28 @@ var __extends = (this && this.__extends) || (function () {
|
|
vertexShaderUrl = BABYLON.Engine.ShadersRepository + vertex;
|
|
vertexShaderUrl = BABYLON.Engine.ShadersRepository + vertex;
|
|
}
|
|
}
|
|
// Vertex shader
|
|
// Vertex shader
|
|
- this._engine._loadFile(vertexShaderUrl + ".vertex.fx", callback);
|
|
|
|
|
|
+ return this._engine._loadFileAsync(vertexShaderUrl + ".vertex.fx");
|
|
};
|
|
};
|
|
- Effect.prototype._loadFragmentShader = function (fragment, callback) {
|
|
|
|
|
|
+ /** @ignore */
|
|
|
|
+ Effect.prototype._loadFragmentShaderAsync = function (fragment) {
|
|
if (BABYLON.Tools.IsWindowObjectExist()) {
|
|
if (BABYLON.Tools.IsWindowObjectExist()) {
|
|
// DOM element ?
|
|
// DOM element ?
|
|
if (fragment instanceof HTMLElement) {
|
|
if (fragment instanceof HTMLElement) {
|
|
var fragmentCode = BABYLON.Tools.GetDOMTextContent(fragment);
|
|
var fragmentCode = BABYLON.Tools.GetDOMTextContent(fragment);
|
|
- callback(fragmentCode);
|
|
|
|
- return;
|
|
|
|
|
|
+ return Promise.resolve(fragmentCode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Base64 encoded ?
|
|
// Base64 encoded ?
|
|
if (fragment.substr(0, 7) === "base64:") {
|
|
if (fragment.substr(0, 7) === "base64:") {
|
|
var fragmentBinary = window.atob(fragment.substr(7));
|
|
var fragmentBinary = window.atob(fragment.substr(7));
|
|
- callback(fragmentBinary);
|
|
|
|
- return;
|
|
|
|
|
|
+ return Promise.resolve(fragmentBinary);
|
|
}
|
|
}
|
|
// Is in local store ?
|
|
// Is in local store ?
|
|
if (Effect.ShadersStore[fragment + "PixelShader"]) {
|
|
if (Effect.ShadersStore[fragment + "PixelShader"]) {
|
|
- callback(Effect.ShadersStore[fragment + "PixelShader"]);
|
|
|
|
- return;
|
|
|
|
|
|
+ return Promise.resolve(Effect.ShadersStore[fragment + "PixelShader"]);
|
|
}
|
|
}
|
|
if (Effect.ShadersStore[fragment + "FragmentShader"]) {
|
|
if (Effect.ShadersStore[fragment + "FragmentShader"]) {
|
|
- callback(Effect.ShadersStore[fragment + "FragmentShader"]);
|
|
|
|
- return;
|
|
|
|
|
|
+ return Promise.resolve(Effect.ShadersStore[fragment + "FragmentShader"]);
|
|
}
|
|
}
|
|
var fragmentShaderUrl;
|
|
var fragmentShaderUrl;
|
|
if (fragment[0] === "." || fragment[0] === "/" || fragment.indexOf("http") > -1) {
|
|
if (fragment[0] === "." || fragment[0] === "/" || fragment.indexOf("http") > -1) {
|
|
@@ -291,7 +289,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
fragmentShaderUrl = BABYLON.Engine.ShadersRepository + fragment;
|
|
fragmentShaderUrl = BABYLON.Engine.ShadersRepository + fragment;
|
|
}
|
|
}
|
|
// Fragment shader
|
|
// Fragment shader
|
|
- this._engine._loadFile(fragmentShaderUrl + ".fragment.fx", callback);
|
|
|
|
|
|
+ return this._engine._loadFileAsync(fragmentShaderUrl + ".fragment.fx");
|
|
};
|
|
};
|
|
Effect.prototype._dumpShadersSource = function (vertexCode, fragmentCode, defines) {
|
|
Effect.prototype._dumpShadersSource = function (vertexCode, fragmentCode, defines) {
|
|
// Rebuild shaders source code
|
|
// Rebuild shaders source code
|
|
@@ -320,16 +318,14 @@ var __extends = (this && this.__extends) || (function () {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
;
|
|
;
|
|
- Effect.prototype._processShaderConversion = function (sourceCode, isFragment, callback) {
|
|
|
|
|
|
+ Effect.prototype._processShaderConversion = function (sourceCode, isFragment) {
|
|
var preparedSourceCode = this._processPrecision(sourceCode);
|
|
var preparedSourceCode = this._processPrecision(sourceCode);
|
|
if (this._engine.webGLVersion == 1) {
|
|
if (this._engine.webGLVersion == 1) {
|
|
- callback(preparedSourceCode);
|
|
|
|
- return;
|
|
|
|
|
|
+ return preparedSourceCode;
|
|
}
|
|
}
|
|
// Already converted
|
|
// Already converted
|
|
if (preparedSourceCode.indexOf("#version 3") !== -1) {
|
|
if (preparedSourceCode.indexOf("#version 3") !== -1) {
|
|
- callback(preparedSourceCode.replace("#version 300 es", ""));
|
|
|
|
- return;
|
|
|
|
|
|
+ return preparedSourceCode.replace("#version 300 es", "");
|
|
}
|
|
}
|
|
var hasDrawBuffersExtension = preparedSourceCode.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;
|
|
var hasDrawBuffersExtension = preparedSourceCode.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;
|
|
// Remove extensions
|
|
// Remove extensions
|
|
@@ -353,80 +349,86 @@ var __extends = (this && this.__extends) || (function () {
|
|
result = result.replace(/gl_FragData/g, "glFragData");
|
|
result = result.replace(/gl_FragData/g, "glFragData");
|
|
result = result.replace(/void\s+?main\s*\(/g, (hasDrawBuffersExtension ? "" : "out vec4 glFragColor;\n") + "void main(");
|
|
result = result.replace(/void\s+?main\s*\(/g, (hasDrawBuffersExtension ? "" : "out vec4 glFragColor;\n") + "void main(");
|
|
}
|
|
}
|
|
- callback(result);
|
|
|
|
|
|
+ return result;
|
|
};
|
|
};
|
|
- Effect.prototype._processIncludes = function (sourceCode, callback) {
|
|
|
|
|
|
+ Effect.prototype._processIncludesAsync = function (sourceCode) {
|
|
var _this = this;
|
|
var _this = this;
|
|
- var regex = /#include<(.+)>(\((.*)\))*(\[(.*)\])*/g;
|
|
|
|
- var match = regex.exec(sourceCode);
|
|
|
|
- var returnValue = new String(sourceCode);
|
|
|
|
- while (match != null) {
|
|
|
|
- var includeFile = match[1];
|
|
|
|
- // Uniform declaration
|
|
|
|
- if (includeFile.indexOf("__decl__") !== -1) {
|
|
|
|
- includeFile = includeFile.replace(/__decl__/, "");
|
|
|
|
- if (this._engine.supportsUniformBuffers) {
|
|
|
|
- includeFile = includeFile.replace(/Vertex/, "Ubo");
|
|
|
|
- includeFile = includeFile.replace(/Fragment/, "Ubo");
|
|
|
|
- }
|
|
|
|
- includeFile = includeFile + "Declaration";
|
|
|
|
- }
|
|
|
|
- if (Effect.IncludesShadersStore[includeFile]) {
|
|
|
|
- // Substitution
|
|
|
|
- var includeContent = Effect.IncludesShadersStore[includeFile];
|
|
|
|
- if (match[2]) {
|
|
|
|
- var splits = match[3].split(",");
|
|
|
|
- for (var index = 0; index < splits.length; index += 2) {
|
|
|
|
- var source = new RegExp(splits[index], "g");
|
|
|
|
- var dest = splits[index + 1];
|
|
|
|
- includeContent = includeContent.replace(source, dest);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (match[4]) {
|
|
|
|
- var indexString = match[5];
|
|
|
|
- if (indexString.indexOf("..") !== -1) {
|
|
|
|
- var indexSplits = indexString.split("..");
|
|
|
|
- var minIndex = parseInt(indexSplits[0]);
|
|
|
|
- var maxIndex = parseInt(indexSplits[1]);
|
|
|
|
- var sourceIncludeContent = includeContent.slice(0);
|
|
|
|
- includeContent = "";
|
|
|
|
- if (isNaN(maxIndex)) {
|
|
|
|
- maxIndex = this._indexParameters[indexSplits[1]];
|
|
|
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
|
+ var regex = /#include<(.+)>(\((.*)\))*(\[(.*)\])*/g;
|
|
|
|
+ var match = regex.exec(sourceCode);
|
|
|
|
+ var returnValue = sourceCode;
|
|
|
|
+ while (match != null) {
|
|
|
|
+ var includeFile = match[1];
|
|
|
|
+ // Uniform declaration
|
|
|
|
+ if (includeFile.indexOf("__decl__") !== -1) {
|
|
|
|
+ includeFile = includeFile.replace(/__decl__/, "");
|
|
|
|
+ if (_this._engine.supportsUniformBuffers) {
|
|
|
|
+ includeFile = includeFile.replace(/Vertex/, "Ubo");
|
|
|
|
+ includeFile = includeFile.replace(/Fragment/, "Ubo");
|
|
|
|
+ }
|
|
|
|
+ includeFile = includeFile + "Declaration";
|
|
|
|
+ }
|
|
|
|
+ if (Effect.IncludesShadersStore[includeFile]) {
|
|
|
|
+ // Substitution
|
|
|
|
+ var includeContent = Effect.IncludesShadersStore[includeFile];
|
|
|
|
+ if (match[2]) {
|
|
|
|
+ var splits = match[3].split(",");
|
|
|
|
+ for (var index = 0; index < splits.length; index += 2) {
|
|
|
|
+ var source = new RegExp(splits[index], "g");
|
|
|
|
+ var dest = splits[index + 1];
|
|
|
|
+ includeContent = includeContent.replace(source, dest);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (match[4]) {
|
|
|
|
+ var indexString = match[5];
|
|
|
|
+ if (indexString.indexOf("..") !== -1) {
|
|
|
|
+ var indexSplits = indexString.split("..");
|
|
|
|
+ var minIndex = parseInt(indexSplits[0]);
|
|
|
|
+ var maxIndex = parseInt(indexSplits[1]);
|
|
|
|
+ var sourceIncludeContent = includeContent.slice(0);
|
|
|
|
+ includeContent = "";
|
|
|
|
+ if (isNaN(maxIndex)) {
|
|
|
|
+ maxIndex = _this._indexParameters[indexSplits[1]];
|
|
|
|
+ }
|
|
|
|
+ for (var i = minIndex; i < maxIndex; i++) {
|
|
|
|
+ if (!_this._engine.supportsUniformBuffers) {
|
|
|
|
+ // Ubo replacement
|
|
|
|
+ sourceIncludeContent = sourceIncludeContent.replace(/light\{X\}.(\w*)/g, function (str, p1) {
|
|
|
|
+ return p1 + "{X}";
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ includeContent += sourceIncludeContent.replace(/\{X\}/g, i.toString()) + "\n";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- for (var i = minIndex; i < maxIndex; i++) {
|
|
|
|
- if (!this._engine.supportsUniformBuffers) {
|
|
|
|
|
|
+ else {
|
|
|
|
+ if (!_this._engine.supportsUniformBuffers) {
|
|
// Ubo replacement
|
|
// Ubo replacement
|
|
- sourceIncludeContent = sourceIncludeContent.replace(/light\{X\}.(\w*)/g, function (str, p1) {
|
|
|
|
|
|
+ includeContent = includeContent.replace(/light\{X\}.(\w*)/g, function (str, p1) {
|
|
return p1 + "{X}";
|
|
return p1 + "{X}";
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- includeContent += sourceIncludeContent.replace(/\{X\}/g, i.toString()) + "\n";
|
|
|
|
|
|
+ includeContent = includeContent.replace(/\{X\}/g, indexString);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- if (!this._engine.supportsUniformBuffers) {
|
|
|
|
- // Ubo replacement
|
|
|
|
- includeContent = includeContent.replace(/light\{X\}.(\w*)/g, function (str, p1) {
|
|
|
|
- return p1 + "{X}";
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- includeContent = includeContent.replace(/\{X\}/g, indexString);
|
|
|
|
- }
|
|
|
|
|
|
+ // Replace
|
|
|
|
+ returnValue = returnValue.replace(match[0], includeContent);
|
|
}
|
|
}
|
|
- // Replace
|
|
|
|
- returnValue = returnValue.replace(match[0], includeContent);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- var includeShaderUrl = BABYLON.Engine.ShadersRepository + "ShadersInclude/" + includeFile + ".fx";
|
|
|
|
- this._engine._loadFile(includeShaderUrl, function (fileContent) {
|
|
|
|
- Effect.IncludesShadersStore[includeFile] = fileContent;
|
|
|
|
- _this._processIncludes(returnValue, callback);
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
|
|
+ else {
|
|
|
|
+ var includeShaderUrl = BABYLON.Engine.ShadersRepository + "ShadersInclude/" + includeFile + ".fx";
|
|
|
|
+ _this._engine._loadFileAsync(includeShaderUrl)
|
|
|
|
+ .then(function (fileContent) {
|
|
|
|
+ Effect.IncludesShadersStore[includeFile] = fileContent;
|
|
|
|
+ return _this._processIncludesAsync(returnValue);
|
|
|
|
+ })
|
|
|
|
+ .then(function (returnValue) {
|
|
|
|
+ resolve(returnValue);
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ match = regex.exec(sourceCode);
|
|
}
|
|
}
|
|
- match = regex.exec(sourceCode);
|
|
|
|
- }
|
|
|
|
- callback(returnValue);
|
|
|
|
|
|
+ resolve(returnValue);
|
|
|
|
+ });
|
|
};
|
|
};
|
|
Effect.prototype._processPrecision = function (source) {
|
|
Effect.prototype._processPrecision = function (source) {
|
|
if (source.indexOf("precision highp float") === -1) {
|
|
if (source.indexOf("precision highp float") === -1) {
|
|
@@ -8292,6 +8294,7 @@ var BABYLON;
|
|
function InternalPromise(resolver) {
|
|
function InternalPromise(resolver) {
|
|
var _this = this;
|
|
var _this = this;
|
|
this._state = PromiseStates.Pending;
|
|
this._state = PromiseStates.Pending;
|
|
|
|
+ this._children = new Array();
|
|
this._rejectWasConsumed = false;
|
|
this._rejectWasConsumed = false;
|
|
if (!resolver) {
|
|
if (!resolver) {
|
|
return;
|
|
return;
|
|
@@ -8314,23 +8317,35 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
- InternalPromise.prototype.isFulfilled = function () {
|
|
|
|
- return this._state === PromiseStates.Fulfilled;
|
|
|
|
- };
|
|
|
|
- InternalPromise.prototype.isRejected = function () {
|
|
|
|
- return this._state === PromiseStates.Rejected;
|
|
|
|
- };
|
|
|
|
- InternalPromise.prototype.isPending = function () {
|
|
|
|
- return this._state === PromiseStates.Pending;
|
|
|
|
- };
|
|
|
|
|
|
+ Object.defineProperty(InternalPromise.prototype, "isFulfilled", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._state === PromiseStates.Fulfilled;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(InternalPromise.prototype, "isRejected", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._state === PromiseStates.Rejected;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(InternalPromise.prototype, "isPending", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._state === PromiseStates.Pending;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
InternalPromise.prototype.value = function () {
|
|
InternalPromise.prototype.value = function () {
|
|
- if (!this.isFulfilled()) {
|
|
|
|
|
|
+ if (!this.isFulfilled) {
|
|
throw new Error("Promise is not fulfilled");
|
|
throw new Error("Promise is not fulfilled");
|
|
}
|
|
}
|
|
return this._result;
|
|
return this._result;
|
|
};
|
|
};
|
|
InternalPromise.prototype.reason = function () {
|
|
InternalPromise.prototype.reason = function () {
|
|
- if (!this.isRejected()) {
|
|
|
|
|
|
+ if (!this.isRejected) {
|
|
throw new Error("Promise is not rejected");
|
|
throw new Error("Promise is not rejected");
|
|
}
|
|
}
|
|
return this._reason;
|
|
return this._reason;
|
|
@@ -8343,14 +8358,14 @@ var BABYLON;
|
|
newPromise._onFulfilled = onFulfilled;
|
|
newPromise._onFulfilled = onFulfilled;
|
|
newPromise._onRejected = onRejected;
|
|
newPromise._onRejected = onRejected;
|
|
// Composition
|
|
// Composition
|
|
- this._child = newPromise;
|
|
|
|
|
|
+ this._children.push(newPromise);
|
|
if (this._state !== PromiseStates.Pending) {
|
|
if (this._state !== PromiseStates.Pending) {
|
|
if (this._state === PromiseStates.Fulfilled || this._rejectWasConsumed) {
|
|
if (this._state === PromiseStates.Fulfilled || this._rejectWasConsumed) {
|
|
var returnedValue = newPromise._resolve(this._result);
|
|
var returnedValue = newPromise._resolve(this._result);
|
|
if (returnedValue !== undefined && returnedValue !== null) {
|
|
if (returnedValue !== undefined && returnedValue !== null) {
|
|
if (returnedValue._state !== undefined) {
|
|
if (returnedValue._state !== undefined) {
|
|
var returnedPromise = returnedValue;
|
|
var returnedPromise = returnedValue;
|
|
- newPromise._child = returnedPromise;
|
|
|
|
|
|
+ newPromise._children.push(returnedPromise);
|
|
newPromise = returnedPromise;
|
|
newPromise = returnedPromise;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -8364,18 +8379,41 @@ var BABYLON;
|
|
}
|
|
}
|
|
return newPromise;
|
|
return newPromise;
|
|
};
|
|
};
|
|
|
|
+ InternalPromise.prototype._moveChildren = function (children) {
|
|
|
|
+ this._children = children.splice(0, children.length);
|
|
|
|
+ if (this.isFulfilled) {
|
|
|
|
+ for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
|
|
|
|
+ var child = _a[_i];
|
|
|
|
+ child._resolve(this._result);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (this.isRejected) {
|
|
|
|
+ for (var _b = 0, _c = this._children; _b < _c.length; _b++) {
|
|
|
|
+ var child = _c[_b];
|
|
|
|
+ child._reject(this._reason);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
InternalPromise.prototype._resolve = function (value) {
|
|
InternalPromise.prototype._resolve = function (value) {
|
|
try {
|
|
try {
|
|
this._state = PromiseStates.Fulfilled;
|
|
this._state = PromiseStates.Fulfilled;
|
|
this._result = value;
|
|
this._result = value;
|
|
- var returnedPromise = null;
|
|
|
|
|
|
+ var returnedValue = null;
|
|
if (this._onFulfilled) {
|
|
if (this._onFulfilled) {
|
|
- returnedPromise = this._onFulfilled(value);
|
|
|
|
|
|
+ returnedValue = this._onFulfilled(value);
|
|
}
|
|
}
|
|
- if (this._child) {
|
|
|
|
- this._child._resolve(value);
|
|
|
|
|
|
+ if (returnedValue !== undefined && returnedValue !== null) {
|
|
|
|
+ if (returnedValue._state !== undefined) {
|
|
|
|
+ // Transmit children
|
|
|
|
+ var returnedPromise = returnedValue;
|
|
|
|
+ returnedPromise._moveChildren(this._children);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- return returnedPromise;
|
|
|
|
|
|
+ for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
|
|
|
|
+ var child = _a[_i];
|
|
|
|
+ child._resolve(value);
|
|
|
|
+ }
|
|
|
|
+ return returnedValue;
|
|
}
|
|
}
|
|
catch (e) {
|
|
catch (e) {
|
|
this._reject(e.message);
|
|
this._reject(e.message);
|
|
@@ -8389,12 +8427,13 @@ var BABYLON;
|
|
this._onRejected(reason);
|
|
this._onRejected(reason);
|
|
this._rejectWasConsumed = true;
|
|
this._rejectWasConsumed = true;
|
|
}
|
|
}
|
|
- if (this._child) {
|
|
|
|
|
|
+ for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
|
|
|
|
+ var child = _a[_i];
|
|
if (this._rejectWasConsumed) {
|
|
if (this._rejectWasConsumed) {
|
|
- this._child._resolve(null);
|
|
|
|
|
|
+ child._resolve(null);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- this._child._reject(reason);
|
|
|
|
|
|
+ child._reject(reason);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -9846,7 +9885,7 @@ var BABYLON;
|
|
});
|
|
});
|
|
Object.defineProperty(Engine, "Version", {
|
|
Object.defineProperty(Engine, "Version", {
|
|
get: function () {
|
|
get: function () {
|
|
- return "3.2.0-alpha5";
|
|
|
|
|
|
+ return "3.2.0-alpha6";
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
@@ -11661,8 +11700,8 @@ var BABYLON;
|
|
// establish the file extension, if possible
|
|
// establish the file extension, if possible
|
|
var lastDot = url.lastIndexOf('.');
|
|
var lastDot = url.lastIndexOf('.');
|
|
var extension = (lastDot > 0) ? url.substring(lastDot).toLowerCase() : "";
|
|
var extension = (lastDot > 0) ? url.substring(lastDot).toLowerCase() : "";
|
|
- var isDDS = this.getCaps().s3tc && (extension === ".dds");
|
|
|
|
- var isTGA = (extension === ".tga");
|
|
|
|
|
|
+ var isDDS = this.getCaps().s3tc && (extension.indexOf(".dds") === 0);
|
|
|
|
+ var isTGA = (extension.indexOf(".tga") === 0);
|
|
// determine if a ktx file should be substituted
|
|
// determine if a ktx file should be substituted
|
|
var isKTX = false;
|
|
var isKTX = false;
|
|
if (this._textureFormatInUse && !isBase64 && !fallBack) {
|
|
if (this._textureFormatInUse && !isBase64 && !fallBack) {
|
|
@@ -13809,6 +13848,17 @@ var BABYLON;
|
|
});
|
|
});
|
|
return request;
|
|
return request;
|
|
};
|
|
};
|
|
|
|
+ /** @ignore */
|
|
|
|
+ Engine.prototype._loadFileAsync = function (url, database, useArrayBuffer) {
|
|
|
|
+ var _this = this;
|
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
|
+ _this._loadFile(url, function (data) {
|
|
|
|
+ resolve(data);
|
|
|
|
+ }, undefined, database, useArrayBuffer, function (request, exception) {
|
|
|
|
+ reject(exception);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ };
|
|
Engine.prototype._partialLoadFile = function (url, index, loadedFiles, scene, onfinish, onErrorCallBack) {
|
|
Engine.prototype._partialLoadFile = function (url, index, loadedFiles, scene, onfinish, onErrorCallBack) {
|
|
if (onErrorCallBack === void 0) { onErrorCallBack = null; }
|
|
if (onErrorCallBack === void 0) { onErrorCallBack = null; }
|
|
var onload = function (data) {
|
|
var onload = function (data) {
|
|
@@ -15638,7 +15688,7 @@ var BABYLON;
|
|
_this._occlusionInternalRetryCounter = 0;
|
|
_this._occlusionInternalRetryCounter = 0;
|
|
_this._isOccluded = false;
|
|
_this._isOccluded = false;
|
|
_this._isOcclusionQueryInProgress = false;
|
|
_this._isOcclusionQueryInProgress = false;
|
|
- _this.visibility = 1.0;
|
|
|
|
|
|
+ _this._visibility = 1.0;
|
|
_this.alphaIndex = Number.MAX_VALUE;
|
|
_this.alphaIndex = Number.MAX_VALUE;
|
|
_this.isVisible = true;
|
|
_this.isVisible = true;
|
|
_this.isPickable = true;
|
|
_this.isPickable = true;
|
|
@@ -15873,6 +15923,26 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(AbstractMesh.prototype, "visibility", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets mesh visibility between 0 and 1 (defult is 1)
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._visibility;
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * Gets or sets mesh visibility between 0 and 1 (defult is 1)
|
|
|
|
+ */
|
|
|
|
+ set: function (value) {
|
|
|
|
+ if (this._visibility === value) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this._visibility = value;
|
|
|
|
+ this._markSubMeshesAsMiscDirty();
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(AbstractMesh.prototype, "material", {
|
|
Object.defineProperty(AbstractMesh.prototype, "material", {
|
|
get: function () {
|
|
get: function () {
|
|
return this._material;
|
|
return this._material;
|
|
@@ -15920,6 +15990,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
this._hasVertexAlpha = value;
|
|
this._hasVertexAlpha = value;
|
|
this._markSubMeshesAsAttributesDirty();
|
|
this._markSubMeshesAsAttributesDirty();
|
|
|
|
+ this._markSubMeshesAsMiscDirty();
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
@@ -23547,6 +23618,17 @@ var BABYLON;
|
|
});
|
|
});
|
|
return request;
|
|
return request;
|
|
};
|
|
};
|
|
|
|
+ /** @ignore */
|
|
|
|
+ Scene.prototype._loadFileAsync = function (url, useDatabase, useArrayBuffer) {
|
|
|
|
+ var _this = this;
|
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
|
+ _this._loadFile(url, function (data) {
|
|
|
|
+ resolve(data);
|
|
|
|
+ }, undefined, useDatabase, useArrayBuffer, function (request, exception) {
|
|
|
|
+ reject(exception);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ };
|
|
// Statics
|
|
// Statics
|
|
Scene._FOGMODE_NONE = 0;
|
|
Scene._FOGMODE_NONE = 0;
|
|
Scene._FOGMODE_EXP = 1;
|
|
Scene._FOGMODE_EXP = 1;
|
|
@@ -24545,7 +24627,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
this._hasAlpha = value;
|
|
this._hasAlpha = value;
|
|
if (this._scene) {
|
|
if (this._scene) {
|
|
- this._scene.markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag);
|
|
|
|
|
|
+ this._scene.markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag | BABYLON.Material.MiscDirtyFlag);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
@@ -28872,7 +28954,7 @@ var BABYLON;
|
|
this.checkReadyOnEveryCall = false;
|
|
this.checkReadyOnEveryCall = false;
|
|
this.checkReadyOnlyOnce = false;
|
|
this.checkReadyOnlyOnce = false;
|
|
this.state = "";
|
|
this.state = "";
|
|
- this.alpha = 1.0;
|
|
|
|
|
|
+ this._alpha = 1.0;
|
|
this._backFaceCulling = true;
|
|
this._backFaceCulling = true;
|
|
this.doNotSerialize = false;
|
|
this.doNotSerialize = false;
|
|
this.storeEffectOnSubMeshes = false;
|
|
this.storeEffectOnSubMeshes = false;
|
|
@@ -29028,6 +29110,20 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(Material.prototype, "alpha", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._alpha;
|
|
|
|
+ },
|
|
|
|
+ set: function (value) {
|
|
|
|
+ if (this._alpha === value) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this._alpha = value;
|
|
|
|
+ this.markAsDirty(Material.MiscDirtyFlag);
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(Material.prototype, "backFaceCulling", {
|
|
Object.defineProperty(Material.prototype, "backFaceCulling", {
|
|
get: function () {
|
|
get: function () {
|
|
return this._backFaceCulling;
|
|
return this._backFaceCulling;
|
|
@@ -29366,6 +29462,12 @@ var BABYLON;
|
|
Material.prototype._markAllSubMeshesAsFresnelDirty = function () {
|
|
Material.prototype._markAllSubMeshesAsFresnelDirty = function () {
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsFresnelDirty(); });
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsFresnelDirty(); });
|
|
};
|
|
};
|
|
|
|
+ Material.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function () {
|
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) {
|
|
|
|
+ defines.markAsFresnelDirty();
|
|
|
|
+ defines.markAsMiscDirty();
|
|
|
|
+ });
|
|
|
|
+ };
|
|
Material.prototype._markAllSubMeshesAsLightsDirty = function () {
|
|
Material.prototype._markAllSubMeshesAsLightsDirty = function () {
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(); });
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(); });
|
|
};
|
|
};
|
|
@@ -29375,6 +29477,12 @@ var BABYLON;
|
|
Material.prototype._markAllSubMeshesAsMiscDirty = function () {
|
|
Material.prototype._markAllSubMeshesAsMiscDirty = function () {
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); });
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); });
|
|
};
|
|
};
|
|
|
|
+ Material.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function () {
|
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) {
|
|
|
|
+ defines.markAsTexturesDirty();
|
|
|
|
+ defines.markAsMiscDirty();
|
|
|
|
+ });
|
|
|
|
+ };
|
|
Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
|
|
Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
|
|
// Animations
|
|
// Animations
|
|
this.getScene().stopAnimation(this);
|
|
this.getScene().stopAnimation(this);
|
|
@@ -29488,8 +29596,8 @@ var BABYLON;
|
|
BABYLON.serialize()
|
|
BABYLON.serialize()
|
|
], Material.prototype, "state", void 0);
|
|
], Material.prototype, "state", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
- BABYLON.serialize()
|
|
|
|
- ], Material.prototype, "alpha", void 0);
|
|
|
|
|
|
+ BABYLON.serialize("alpha")
|
|
|
|
+ ], Material.prototype, "_alpha", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize("backFaceCulling")
|
|
BABYLON.serialize("backFaceCulling")
|
|
], Material.prototype, "_backFaceCulling", void 0);
|
|
], Material.prototype, "_backFaceCulling", void 0);
|
|
@@ -35825,32 +35933,39 @@ var BABYLON;
|
|
uniformBuffer.updateMatrix(key + "Matrix", matrix);
|
|
uniformBuffer.updateMatrix(key + "Matrix", matrix);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, defines) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Helper used to prepare the list of defines associated with misc. values for shader compilation
|
|
|
|
+ * @param mesh defines the current mesh
|
|
|
|
+ * @param scene defines the current scene
|
|
|
|
+ * @param useLogarithmicDepth defines if logarithmic depth has to be turned on
|
|
|
|
+ * @param pointsCloud defines if point cloud rendering has to be turned on
|
|
|
|
+ * @param fogEnabled defines if fog has to be turned on
|
|
|
|
+ * @param alphaTest defines if alpha testing has to be turned on
|
|
|
|
+ * @param defines defines the current list of defines
|
|
|
|
+ */
|
|
|
|
+ MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, alphaTest, defines) {
|
|
if (defines._areMiscDirty) {
|
|
if (defines._areMiscDirty) {
|
|
defines["LOGARITHMICDEPTH"] = useLogarithmicDepth;
|
|
defines["LOGARITHMICDEPTH"] = useLogarithmicDepth;
|
|
defines["POINTSIZE"] = (pointsCloud || scene.forcePointsCloud);
|
|
defines["POINTSIZE"] = (pointsCloud || scene.forcePointsCloud);
|
|
defines["FOG"] = (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && fogEnabled);
|
|
defines["FOG"] = (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && fogEnabled);
|
|
defines["NONUNIFORMSCALING"] = mesh.nonUniformScaling;
|
|
defines["NONUNIFORMSCALING"] = mesh.nonUniformScaling;
|
|
|
|
+ defines["ALPHATEST"] = alphaTest;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Helper used to prepare the list of defines for shader compilation
|
|
|
|
|
|
+ * Helper used to prepare the list of defines associated with frame values for shader compilation
|
|
* @param scene defines the current scene
|
|
* @param scene defines the current scene
|
|
* @param engine defines the current engine
|
|
* @param engine defines the current engine
|
|
* @param defines specifies the list of active defines
|
|
* @param defines specifies the list of active defines
|
|
* @param useInstances defines if instances have to be turned on
|
|
* @param useInstances defines if instances have to be turned on
|
|
* @param alphaTest defines if alpha testing has to be turned on
|
|
* @param alphaTest defines if alpha testing has to be turned on
|
|
*/
|
|
*/
|
|
- MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances, alphaTest) {
|
|
|
|
|
|
+ MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances) {
|
|
var changed = false;
|
|
var changed = false;
|
|
if (defines["CLIPPLANE"] !== (scene.clipPlane !== undefined && scene.clipPlane !== null)) {
|
|
if (defines["CLIPPLANE"] !== (scene.clipPlane !== undefined && scene.clipPlane !== null)) {
|
|
defines["CLIPPLANE"] = !defines["CLIPPLANE"];
|
|
defines["CLIPPLANE"] = !defines["CLIPPLANE"];
|
|
changed = true;
|
|
changed = true;
|
|
}
|
|
}
|
|
- if (defines["ALPHATEST"] !== alphaTest) {
|
|
|
|
- defines["ALPHATEST"] = !defines["ALPHATEST"];
|
|
|
|
- changed = true;
|
|
|
|
- }
|
|
|
|
if (defines["DEPTHPREPASS"] !== !engine.getColorWrite()) {
|
|
if (defines["DEPTHPREPASS"] !== !engine.getColorWrite()) {
|
|
defines["DEPTHPREPASS"] = !defines["DEPTHPREPASS"];
|
|
defines["DEPTHPREPASS"] = !defines["DEPTHPREPASS"];
|
|
changed = true;
|
|
changed = true;
|
|
@@ -36826,11 +36941,11 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Misc.
|
|
// Misc.
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, defines);
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
|
|
// Attribs
|
|
// Attribs
|
|
BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);
|
|
BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);
|
|
// Values that need to be evaluated on every frame
|
|
// Values that need to be evaluated on every frame
|
|
- BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances, this._shouldTurnAlphaTestOn(mesh));
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);
|
|
// Get correct effect
|
|
// Get correct effect
|
|
if (defines.isDirty) {
|
|
if (defines.isDirty) {
|
|
defines.markAsProcessed();
|
|
defines.markAsProcessed();
|
|
@@ -37482,7 +37597,7 @@ var BABYLON;
|
|
BABYLON.serializeAsTexture("diffuseTexture")
|
|
BABYLON.serializeAsTexture("diffuseTexture")
|
|
], StandardMaterial.prototype, "_diffuseTexture", void 0);
|
|
], StandardMaterial.prototype, "_diffuseTexture", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
], StandardMaterial.prototype, "diffuseTexture", void 0);
|
|
], StandardMaterial.prototype, "diffuseTexture", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serializeAsTexture("ambientTexture")
|
|
BABYLON.serializeAsTexture("ambientTexture")
|
|
@@ -37494,7 +37609,7 @@ var BABYLON;
|
|
BABYLON.serializeAsTexture("opacityTexture")
|
|
BABYLON.serializeAsTexture("opacityTexture")
|
|
], StandardMaterial.prototype, "_opacityTexture", void 0);
|
|
], StandardMaterial.prototype, "_opacityTexture", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
], StandardMaterial.prototype, "opacityTexture", void 0);
|
|
], StandardMaterial.prototype, "opacityTexture", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serializeAsTexture("reflectionTexture")
|
|
BABYLON.serializeAsTexture("reflectionTexture")
|
|
@@ -37626,7 +37741,7 @@ var BABYLON;
|
|
BABYLON.serializeAsFresnelParameters("opacityFresnelParameters")
|
|
BABYLON.serializeAsFresnelParameters("opacityFresnelParameters")
|
|
], StandardMaterial.prototype, "_opacityFresnelParameters", void 0);
|
|
], StandardMaterial.prototype, "_opacityFresnelParameters", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsFresnelDirty")
|
|
|
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsFresnelAndMiscDirty")
|
|
], StandardMaterial.prototype, "opacityFresnelParameters", void 0);
|
|
], StandardMaterial.prototype, "opacityFresnelParameters", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serializeAsFresnelParameters("reflectionFresnelParameters")
|
|
BABYLON.serializeAsFresnelParameters("reflectionFresnelParameters")
|
|
@@ -38096,7 +38211,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
this._transparencyMode = value;
|
|
this._transparencyMode = value;
|
|
this._forceAlphaTest = (value === BABYLON.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND);
|
|
this._forceAlphaTest = (value === BABYLON.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND);
|
|
- this._markAllSubMeshesAsTexturesDirty();
|
|
|
|
|
|
+ this._markAllSubMeshesAsTexturesAndMiscDirty();
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
@@ -38423,9 +38538,9 @@ var BABYLON;
|
|
defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;
|
|
defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;
|
|
defines.HORIZONOCCLUSION = this._useHorizonOcclusion;
|
|
defines.HORIZONOCCLUSION = this._useHorizonOcclusion;
|
|
// Misc.
|
|
// Misc.
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, defines);
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);
|
|
// Values that need to be evaluated on every frame
|
|
// Values that need to be evaluated on every frame
|
|
- BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest);
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
|
|
// Attribs
|
|
// Attribs
|
|
if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE) && mesh) {
|
|
if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE) && mesh) {
|
|
var bufferMesh = null;
|
|
var bufferMesh = null;
|
|
@@ -39658,7 +39773,7 @@ var BABYLON;
|
|
], PBRMaterial.prototype, "ambientTextureStrength", void 0);
|
|
], PBRMaterial.prototype, "ambientTextureStrength", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serializeAsTexture(),
|
|
BABYLON.serializeAsTexture(),
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
], PBRMaterial.prototype, "opacityTexture", void 0);
|
|
], PBRMaterial.prototype, "opacityTexture", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serializeAsTexture(),
|
|
BABYLON.serializeAsTexture(),
|
|
@@ -39742,15 +39857,15 @@ var BABYLON;
|
|
], PBRMaterial.prototype, "useLightmapAsShadowmap", void 0);
|
|
], PBRMaterial.prototype, "useLightmapAsShadowmap", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize(),
|
|
BABYLON.serialize(),
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
], PBRMaterial.prototype, "useAlphaFromAlbedoTexture", void 0);
|
|
], PBRMaterial.prototype, "useAlphaFromAlbedoTexture", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize(),
|
|
BABYLON.serialize(),
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
], PBRMaterial.prototype, "forceAlphaTest", void 0);
|
|
], PBRMaterial.prototype, "forceAlphaTest", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize(),
|
|
BABYLON.serialize(),
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
], PBRMaterial.prototype, "alphaCutOff", void 0);
|
|
], PBRMaterial.prototype, "alphaCutOff", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize(),
|
|
BABYLON.serialize(),
|
|
@@ -48565,6 +48680,15 @@ var BABYLON;
|
|
var randZ = BABYLON.Scalar.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
|
|
var randZ = BABYLON.Scalar.RandomRange(this.minEmitBox.z, this.maxEmitBox.z);
|
|
BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
|
|
BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Clones the current emitter and returns a copy of it
|
|
|
|
+ * @returns the new emitter
|
|
|
|
+ */
|
|
|
|
+ BoxParticleEmitter.prototype.clone = function () {
|
|
|
|
+ var newOne = new BoxParticleEmitter(this._particleSystem);
|
|
|
|
+ BABYLON.Tools.DeepCopy(this, newOne);
|
|
|
|
+ return newOne;
|
|
|
|
+ };
|
|
return BoxParticleEmitter;
|
|
return BoxParticleEmitter;
|
|
}());
|
|
}());
|
|
BABYLON.BoxParticleEmitter = BoxParticleEmitter;
|
|
BABYLON.BoxParticleEmitter = BoxParticleEmitter;
|
|
@@ -48664,6 +48788,15 @@ var BABYLON;
|
|
var randY = h;
|
|
var randY = h;
|
|
BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
|
|
BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Clones the current emitter and returns a copy of it
|
|
|
|
+ * @returns the new emitter
|
|
|
|
+ */
|
|
|
|
+ ConeParticleEmitter.prototype.clone = function () {
|
|
|
|
+ var newOne = new ConeParticleEmitter(this.radius, this.angle, this.directionRandomizer);
|
|
|
|
+ BABYLON.Tools.DeepCopy(this, newOne);
|
|
|
|
+ return newOne;
|
|
|
|
+ };
|
|
return ConeParticleEmitter;
|
|
return ConeParticleEmitter;
|
|
}());
|
|
}());
|
|
BABYLON.ConeParticleEmitter = ConeParticleEmitter;
|
|
BABYLON.ConeParticleEmitter = ConeParticleEmitter;
|
|
@@ -48729,6 +48862,15 @@ var BABYLON;
|
|
var randZ = this.radius * Math.sin(phi) * Math.sin(theta);
|
|
var randZ = this.radius * Math.sin(phi) * Math.sin(theta);
|
|
BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
|
|
BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Clones the current emitter and returns a copy of it
|
|
|
|
+ * @returns the new emitter
|
|
|
|
+ */
|
|
|
|
+ SphereParticleEmitter.prototype.clone = function () {
|
|
|
|
+ var newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);
|
|
|
|
+ BABYLON.Tools.DeepCopy(this, newOne);
|
|
|
|
+ return newOne;
|
|
|
|
+ };
|
|
return SphereParticleEmitter;
|
|
return SphereParticleEmitter;
|
|
}());
|
|
}());
|
|
BABYLON.SphereParticleEmitter = SphereParticleEmitter;
|
|
BABYLON.SphereParticleEmitter = SphereParticleEmitter;
|
|
@@ -48771,6 +48913,15 @@ var BABYLON;
|
|
var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
|
|
var randZ = BABYLON.Scalar.RandomRange(this.direction1.z, this.direction2.z);
|
|
BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
|
|
BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Clones the current emitter and returns a copy of it
|
|
|
|
+ * @returns the new emitter
|
|
|
|
+ */
|
|
|
|
+ SphereDirectedParticleEmitter.prototype.clone = function () {
|
|
|
|
+ var newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);
|
|
|
|
+ BABYLON.Tools.DeepCopy(this, newOne);
|
|
|
|
+ return newOne;
|
|
|
|
+ };
|
|
return SphereDirectedParticleEmitter;
|
|
return SphereDirectedParticleEmitter;
|
|
}(SphereParticleEmitter));
|
|
}(SphereParticleEmitter));
|
|
BABYLON.SphereDirectedParticleEmitter = SphereDirectedParticleEmitter;
|
|
BABYLON.SphereDirectedParticleEmitter = SphereDirectedParticleEmitter;
|
|
@@ -48780,7 +48931,7 @@ var BABYLON;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
|
|
|
|
|
|
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
@@ -54829,9 +54980,8 @@ var BABYLON;
|
|
_this._generateMipMaps = false;
|
|
_this._generateMipMaps = false;
|
|
}
|
|
}
|
|
_this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
|
|
_this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
|
|
- _this._texture.width;
|
|
|
|
- _this._updateInternalTexture();
|
|
|
|
_this._texture.isReady = true;
|
|
_this._texture.isReady = true;
|
|
|
|
+ _this._updateInternalTexture();
|
|
};
|
|
};
|
|
_this.reset = function () {
|
|
_this.reset = function () {
|
|
if (_this._texture == null) {
|
|
if (_this._texture == null) {
|
|
@@ -58787,7 +58937,7 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isEnabled = value;
|
|
this._isEnabled = value;
|
|
- BABYLON.Engine.MarkAllMaterialsAsDirty(BABYLON.Material.FresnelDirtyFlag);
|
|
|
|
|
|
+ BABYLON.Engine.MarkAllMaterialsAsDirty(BABYLON.Material.FresnelDirtyFlag | BABYLON.Material.MiscDirtyFlag);
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
@@ -77005,9 +77155,8 @@ var BABYLON;
|
|
if (this._teleportationInitialized && this._isTeleportationFloor(hit.pickedMesh) && hit.pickedPoint) {
|
|
if (this._teleportationInitialized && this._isTeleportationFloor(hit.pickedMesh) && hit.pickedPoint) {
|
|
// Moving the teleportation area to this targetted point
|
|
// Moving the teleportation area to this targetted point
|
|
//Raise onSelectedMeshUnselected observable if ray collided floor mesh/meshes and a non floor mesh was previously selected
|
|
//Raise onSelectedMeshUnselected observable if ray collided floor mesh/meshes and a non floor mesh was previously selected
|
|
- if (this._currentMeshSelected &&
|
|
|
|
- !this._isTeleportationFloor(this._currentMeshSelected)) {
|
|
|
|
- this.onSelectedMeshUnselected.notifyObservers(this._currentMeshSelected);
|
|
|
|
|
|
+ if (this._currentMeshSelected && !this._isTeleportationFloor(this._currentMeshSelected)) {
|
|
|
|
+ this._notifySelectedMeshUnselected();
|
|
}
|
|
}
|
|
this._currentMeshSelected = null;
|
|
this._currentMeshSelected = null;
|
|
this._moveTeleportationSelectorTo(hit);
|
|
this._moveTeleportationSelectorTo(hit);
|
|
@@ -77038,9 +77187,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- if (this._currentMeshSelected) {
|
|
|
|
- this.onSelectedMeshUnselected.notifyObservers(this._currentMeshSelected);
|
|
|
|
- }
|
|
|
|
|
|
+ this._notifySelectedMeshUnselected();
|
|
this._currentMeshSelected = null;
|
|
this._currentMeshSelected = null;
|
|
this.changeGazeColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
this.changeGazeColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
@@ -77049,6 +77196,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this._currentHit = null;
|
|
this._currentHit = null;
|
|
|
|
+ this._notifySelectedMeshUnselected();
|
|
this._currentMeshSelected = null;
|
|
this._currentMeshSelected = null;
|
|
this._teleportationAllowed = false;
|
|
this._teleportationAllowed = false;
|
|
this._hideTeleportationTarget();
|
|
this._hideTeleportationTarget();
|
|
@@ -77056,6 +77204,11 @@ var BABYLON;
|
|
this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ VRExperienceHelper.prototype._notifySelectedMeshUnselected = function () {
|
|
|
|
+ if (this._currentMeshSelected) {
|
|
|
|
+ this.onSelectedMeshUnselected.notifyObservers(this._currentMeshSelected);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
/**
|
|
/**
|
|
* Sets the color of the laser ray from the vr controllers.
|
|
* Sets the color of the laser ray from the vr controllers.
|
|
* @param color new color for the ray.
|
|
* @param color new color for the ray.
|
|
@@ -83573,9 +83726,9 @@ var BABYLON;
|
|
this._imageProcessingConfiguration.prepareDefines(defines);
|
|
this._imageProcessingConfiguration.prepareDefines(defines);
|
|
}
|
|
}
|
|
// Misc.
|
|
// Misc.
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, defines);
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
|
|
// Values that need to be evaluated on every frame
|
|
// Values that need to be evaluated on every frame
|
|
- BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances, this._shouldTurnAlphaTestOn(mesh));
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);
|
|
// Attribs
|
|
// Attribs
|
|
if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true, false)) {
|
|
if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true, false)) {
|
|
if (mesh) {
|
|
if (mesh) {
|
|
@@ -84568,7 +84721,7 @@ var BABYLON;
|
|
defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;
|
|
defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;
|
|
defines.markAsUnprocessed();
|
|
defines.markAsUnprocessed();
|
|
}
|
|
}
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, false, this.fogEnabled, defines);
|
|
|
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, false, this.fogEnabled, false, defines);
|
|
// Get correct effect
|
|
// Get correct effect
|
|
if (defines.isDirty) {
|
|
if (defines.isDirty) {
|
|
defines.markAsProcessed();
|
|
defines.markAsProcessed();
|