Skip to content

Commit

Permalink
Merge pull request #11079 from BabylonJS/master
Browse files Browse the repository at this point in the history
Deploy Nightly
  • Loading branch information
mergify[bot] committed Sep 15, 2021
2 parents 552d081 + b0e1deb commit 4daa6f4
Show file tree
Hide file tree
Showing 135 changed files with 2,870 additions and 2,195 deletions.
7 changes: 7 additions & 0 deletions dist/preview release/babylon.d.ts
Expand Up @@ -1146,6 +1146,8 @@ declare module BABYLON {
static readonly TEXTUREFORMAT_DEPTH32_FLOAT: number;
/** Depth 16 bits */
static readonly TEXTUREFORMAT_DEPTH16: number;
/** Depth 24 bits */
static readonly TEXTUREFORMAT_DEPTH24: number;
/** Compressed BC7 */
static readonly TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM: number;
/** Compressed BC6 unsigned float */
Expand Down Expand Up @@ -17950,6 +17952,10 @@ declare module BABYLON {
* Define if a depth texture is required instead of a depth buffer
*/
generateDepthTexture?: boolean;
/**
* Define depth texture format to use
*/
depthTextureFormat?: number;
/**
* Define the number of desired draw buffers
*/
Expand Down Expand Up @@ -51459,6 +51465,7 @@ declare module BABYLON {
private static _GetPluginForDirectLoad;
private static _GetPluginForFilename;
private static _GetDirectLoad;
private static _FormatErrorMessage;
private static _LoadData;
private static _GetFileInfo;
/**
Expand Down
2 changes: 1 addition & 1 deletion dist/preview release/babylon.js

Large diffs are not rendered by default.

100 changes: 79 additions & 21 deletions dist/preview release/babylon.max.js
Expand Up @@ -37415,6 +37415,7 @@ _thinEngine__WEBPACK_IMPORTED_MODULE_3__["ThinEngine"].prototype.createMultipleR
var generateDepthBuffer = true;
var generateStencilBuffer = false;
var generateDepthTexture = false;
var depthTextureFormat = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH16;
var textureCount = 1;
var defaultType = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_INT;
var defaultSamplingMode = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURE_TRILINEAR_SAMPLINGMODE;
Expand All @@ -37433,6 +37434,12 @@ _thinEngine__WEBPACK_IMPORTED_MODULE_3__["ThinEngine"].prototype.createMultipleR
if (options.samplingModes) {
samplingModes = options.samplingModes;
}
if (this.webGLVersion > 1 &&
(options.depthTextureFormat === _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH24_STENCIL8 ||
options.depthTextureFormat === _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH24 ||
options.depthTextureFormat === _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH32_FLOAT)) {
depthTextureFormat = options.depthTextureFormat;
}
}
var gl = this._gl;
// Create the framebuffer
Expand All @@ -37442,11 +37449,12 @@ _thinEngine__WEBPACK_IMPORTED_MODULE_3__["ThinEngine"].prototype.createMultipleR
var height = size.height || size;
var textures = [];
var attachments = [];
var depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);
var useStencilTexture = this.webGLVersion > 1 && generateDepthTexture && options.depthTextureFormat === _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH24_STENCIL8;
var depthStencilBuffer = this._setupFramebufferDepthAttachments(!useStencilTexture && generateStencilBuffer, !generateDepthTexture && generateDepthBuffer, width, height);
rtWrapper._framebuffer = framebuffer;
rtWrapper._depthStencilBuffer = depthStencilBuffer;
rtWrapper._generateDepthBuffer = generateDepthBuffer;
rtWrapper._generateStencilBuffer = generateStencilBuffer;
rtWrapper._generateDepthBuffer = !generateDepthTexture && generateDepthBuffer;
rtWrapper._generateStencilBuffer = !useStencilTexture && generateStencilBuffer;
rtWrapper._attachments = attachments;
for (var i = 0; i < textureCount; i++) {
var samplingMode = samplingModes[i] || defaultSamplingMode;
Expand Down Expand Up @@ -37495,14 +37503,42 @@ _thinEngine__WEBPACK_IMPORTED_MODULE_3__["ThinEngine"].prototype.createMultipleR
if (generateDepthTexture && this._caps.depthTextureExtension) {
// Depth texture
var depthTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_0__["InternalTexture"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_0__["InternalTextureSource"].Depth);
var depthTextureType = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_SHORT;
var glDepthTextureInternalFormat = gl.DEPTH_COMPONENT16;
var glDepthTextureFormat = gl.DEPTH_COMPONENT;
var glDepthTextureType = gl.UNSIGNED_SHORT;
var glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;
if (this.webGLVersion < 2) {
glDepthTextureInternalFormat = gl.DEPTH_COMPONENT;
}
else {
if (depthTextureFormat === _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH32_FLOAT) {
depthTextureType = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_FLOAT;
glDepthTextureType = gl.FLOAT;
glDepthTextureInternalFormat = gl.DEPTH_COMPONENT32F;
}
else if (depthTextureFormat === _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH24) {
depthTextureType = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_INT;
glDepthTextureType = gl.UNSIGNED_INT;
glDepthTextureInternalFormat = gl.DEPTH_COMPONENT24;
glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;
}
else if (depthTextureFormat === _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH24_STENCIL8) {
depthTextureType = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_INT_24_8;
glDepthTextureType = gl.UNSIGNED_INT_24_8;
glDepthTextureInternalFormat = gl.DEPTH24_STENCIL8;
glDepthTextureFormat = gl.DEPTH_STENCIL;
glDepthTextureAttachment = gl.DEPTH_STENCIL_ATTACHMENT;
}
}
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, depthTexture._hardwareTexture.underlyingResource);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texImage2D(gl.TEXTURE_2D, 0, this.webGLVersion < 2 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, width, height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._hardwareTexture.underlyingResource, 0);
gl.texImage2D(gl.TEXTURE_2D, 0, glDepthTextureInternalFormat, width, height, 0, glDepthTextureFormat, glDepthTextureType, null);
gl.framebufferTexture2D(gl.FRAMEBUFFER, glDepthTextureAttachment, gl.TEXTURE_2D, depthTexture._hardwareTexture.underlyingResource, 0);
depthTexture.baseWidth = width;
depthTexture.baseHeight = height;
depthTexture.width = width;
Expand All @@ -37511,8 +37547,8 @@ _thinEngine__WEBPACK_IMPORTED_MODULE_3__["ThinEngine"].prototype.createMultipleR
depthTexture.samples = 1;
depthTexture.generateMipMaps = generateMipMaps;
depthTexture.samplingMode = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURE_NEAREST_SAMPLINGMODE;
depthTexture.format = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTUREFORMAT_DEPTH16;
depthTexture.type = _constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_SHORT;
depthTexture.format = depthTextureFormat;
depthTexture.type = depthTextureType;
textures.push(depthTexture);
this._internalTexturesCache.push(depthTexture);
}
Expand Down Expand Up @@ -48679,6 +48715,8 @@ var Constants = /** @class */ (function () {
Constants.TEXTUREFORMAT_DEPTH32_FLOAT = 14;
/** Depth 16 bits */
Constants.TEXTUREFORMAT_DEPTH16 = 15;
/** Depth 24 bits */
Constants.TEXTUREFORMAT_DEPTH24 = 16;
/** Compressed BC7 */
Constants.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM = 36492;
/** Compressed BC6 unsigned float */
Expand Down Expand Up @@ -83878,6 +83916,16 @@ var SceneLoader = /** @class */ (function () {
}
return null;
};
SceneLoader._FormatErrorMessage = function (fileInfo, message, exception) {
var errorMessage = "Unable to load from " + fileInfo.url;
if (message) {
errorMessage += ": " + message;
}
else if (exception) {
errorMessage += ": " + exception;
}
return errorMessage;
};
SceneLoader._LoadData = function (fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension) {
var directLoad = SceneLoader._GetDirectLoad(fileInfo.url);
var registeredPlugin = pluginExtension ? SceneLoader._GetPluginForExtension(pluginExtension) : (directLoad ? SceneLoader._GetPluginForDirectLoad(fileInfo.url) : SceneLoader._GetPluginForFilename(fileInfo.url));
Expand Down Expand Up @@ -83939,7 +83987,7 @@ var SceneLoader = /** @class */ (function () {
return;
}
var errorCallback = function (request, exception) {
onError((request === null || request === void 0 ? void 0 : request.statusText) || (exception === null || exception === void 0 ? void 0 : exception.message) || "Unknown error", exception);
onError(request === null || request === void 0 ? void 0 : request.statusText, exception);
};
var fileOrUrl = fileInfo.file || fileInfo.url;
request = plugin.loadFile
Expand Down Expand Up @@ -84076,9 +84124,9 @@ var SceneLoader = /** @class */ (function () {
scene._removePendingData(loadingToken);
};
var errorHandler = function (message, exception) {
var errorMessage = "Unable to import meshes from " + fileInfo.url + ": " + message;
var errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);
if (onError) {
onError(scene, errorMessage, exception);
onError(scene, errorMessage, new Error(errorMessage));
}
else {
_Misc_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].Error(errorMessage);
Expand Down Expand Up @@ -84250,9 +84298,9 @@ var SceneLoader = /** @class */ (function () {
scene._removePendingData(loadingToken);
};
var errorHandler = function (message, exception) {
var errorMessage = "Unable to load from " + fileInfo.url + (message ? ": " + message : "");
var errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);
if (onError) {
onError(scene, errorMessage, exception);
onError(scene, errorMessage, new Error(errorMessage));
}
else {
_Misc_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].Error(errorMessage);
Expand Down Expand Up @@ -84353,12 +84401,9 @@ var SceneLoader = /** @class */ (function () {
scene._removePendingData(loadingToken);
};
var errorHandler = function (message, exception) {
var errorMessage = "Unable to load assets from " + fileInfo.url + (message ? ": " + message : "");
if (exception && exception.message) {
errorMessage += " (" + exception.message + ")";
}
var errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);
if (onError) {
onError(scene, errorMessage, exception);
onError(scene, errorMessage, new Error(errorMessage));
}
else {
_Misc_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].Error(errorMessage);
Expand Down Expand Up @@ -115547,6 +115592,7 @@ var MultiRenderTarget = /** @class */ (function (_super) {
var _this = this;
var generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;
var generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;
var depthTextureFormat = options && options.depthTextureFormat ? options.depthTextureFormat : _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTUREFORMAT_DEPTH16;
var doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;
var drawOnlyOnFirstAttachmentByDefault = options && options.drawOnlyOnFirstAttachmentByDefault ? options.drawOnlyOnFirstAttachmentByDefault : false;
_this = _super.call(this, name, size, scene, generateMipMaps, doNotChangeAspectRatio, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true) || this;
Expand All @@ -115566,6 +115612,7 @@ var MultiRenderTarget = /** @class */ (function (_super) {
generateDepthBuffer: generateDepthBuffer,
generateStencilBuffer: generateStencilBuffer,
generateDepthTexture: generateDepthTexture,
depthTextureFormat: depthTextureFormat,
types: types,
textureCount: count
};
Expand Down Expand Up @@ -150472,9 +150519,12 @@ _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__["Mesh"].prototype._processInstancedBuf
if (value.toArray) {
value.toArray(data, offset);
}
else {
else if (value.copyToArray) {
value.copyToArray(data, offset);
}
else {
data[offset] = value;
}
offset += stride;
}
for (var instanceIndex = 0; instanceIndex < instanceCount; instanceIndex++) {
Expand All @@ -150483,9 +150533,12 @@ _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__["Mesh"].prototype._processInstancedBuf
if (value.toArray) {
value.toArray(data, offset);
}
else {
else if (value.copyToArray) {
value.copyToArray(data, offset);
}
else {
data[offset] = value;
}
offset += stride;
}
// Update vertex buffer
Expand Down Expand Up @@ -159773,7 +159826,7 @@ var TransformNode = /** @class */ (function (_super) {
* Returns a Vector3.
*/
get: function () {
return this._absolutePosition;
return this.getAbsolutePosition();
},
enumerable: false,
configurable: true
Expand Down Expand Up @@ -175078,6 +175131,9 @@ var Tools = /** @class */ (function () {
* @returns whether or not the current user agent is safari
*/
Tools.IsSafari = function () {
if (!_domManagement__WEBPACK_IMPORTED_MODULE_2__["DomManagement"].IsNavigatorAvailable()) {
return false;
}
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
};
/**
Expand Down Expand Up @@ -192475,9 +192531,11 @@ var CannonJSPlugin = /** @class */ (function () {
oldPivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Identity();
}
//calculate the new center using a pivot (since this.BJSCANNON.js doesn't center height maps)
var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Translation(-boundingInfo.boundingBox.extendSizeWorld.x, 0, -boundingInfo.boundingBox.extendSizeWorld.z);
var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Translation(boundingInfo.boundingBox.extendSizeWorld.x, 0, -boundingInfo.boundingBox.extendSizeWorld.z);
mesh.setPreTransformMatrix(p);
mesh.computeWorldMatrix(true);
// force bounding box recomputation
boundingInfo = mesh.getBoundingInfo();
//calculate the translation
var translation = boundingInfo.boundingBox.centerWorld.subtract(center).subtract(mesh.position).negate();
this._tmpPosition.copyFromFloats(translation.x, translation.y - boundingInfo.boundingBox.extendSizeWorld.y, translation.z);
Expand Down
2 changes: 1 addition & 1 deletion dist/preview release/babylon.max.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions dist/preview release/babylon.module.d.ts
Expand Up @@ -1152,6 +1152,8 @@ declare module "babylonjs/Engines/constants" {
static readonly TEXTUREFORMAT_DEPTH32_FLOAT: number;
/** Depth 16 bits */
static readonly TEXTUREFORMAT_DEPTH16: number;
/** Depth 24 bits */
static readonly TEXTUREFORMAT_DEPTH24: number;
/** Compressed BC7 */
static readonly TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM: number;
/** Compressed BC6 unsigned float */
Expand Down Expand Up @@ -18594,6 +18596,10 @@ declare module "babylonjs/Materials/Textures/multiRenderTarget" {
* Define if a depth texture is required instead of a depth buffer
*/
generateDepthTexture?: boolean;
/**
* Define depth texture format to use
*/
depthTextureFormat?: number;
/**
* Define the number of desired draw buffers
*/
Expand Down Expand Up @@ -53290,6 +53296,7 @@ declare module "babylonjs/Loading/sceneLoader" {
private static _GetPluginForDirectLoad;
private static _GetPluginForFilename;
private static _GetDirectLoad;
private static _FormatErrorMessage;
private static _LoadData;
private static _GetFileInfo;
/**
Expand Down Expand Up @@ -93467,6 +93474,8 @@ declare module BABYLON {
static readonly TEXTUREFORMAT_DEPTH32_FLOAT: number;
/** Depth 16 bits */
static readonly TEXTUREFORMAT_DEPTH16: number;
/** Depth 24 bits */
static readonly TEXTUREFORMAT_DEPTH24: number;
/** Compressed BC7 */
static readonly TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM: number;
/** Compressed BC6 unsigned float */
Expand Down Expand Up @@ -110271,6 +110280,10 @@ declare module BABYLON {
* Define if a depth texture is required instead of a depth buffer
*/
generateDepthTexture?: boolean;
/**
* Define depth texture format to use
*/
depthTextureFormat?: number;
/**
* Define the number of desired draw buffers
*/
Expand Down Expand Up @@ -143780,6 +143793,7 @@ declare module BABYLON {
private static _GetPluginForDirectLoad;
private static _GetPluginForFilename;
private static _GetDirectLoad;
private static _FormatErrorMessage;
private static _LoadData;
private static _GetFileInfo;
/**
Expand Down
7 changes: 7 additions & 0 deletions dist/preview release/documentation.d.ts
Expand Up @@ -1146,6 +1146,8 @@ declare module BABYLON {
static readonly TEXTUREFORMAT_DEPTH32_FLOAT: number;
/** Depth 16 bits */
static readonly TEXTUREFORMAT_DEPTH16: number;
/** Depth 24 bits */
static readonly TEXTUREFORMAT_DEPTH24: number;
/** Compressed BC7 */
static readonly TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM: number;
/** Compressed BC6 unsigned float */
Expand Down Expand Up @@ -17950,6 +17952,10 @@ declare module BABYLON {
* Define if a depth texture is required instead of a depth buffer
*/
generateDepthTexture?: boolean;
/**
* Define depth texture format to use
*/
depthTextureFormat?: number;
/**
* Define the number of desired draw buffers
*/
Expand Down Expand Up @@ -51459,6 +51465,7 @@ declare module BABYLON {
private static _GetPluginForDirectLoad;
private static _GetPluginForFilename;
private static _GetDirectLoad;
private static _FormatErrorMessage;
private static _LoadData;
private static _GetFileInfo;
/**
Expand Down

0 comments on commit 4daa6f4

Please sign in to comment.