|
@@ -37085,9 +37085,14 @@ var NativeEngine = /** @class */ (function (_super) {
|
|
|
var buffer = new NativeDataBuffer();
|
|
|
buffer.references = 1;
|
|
|
buffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);
|
|
|
- buffer.nativeIndexBuffer = this._native.createIndexBuffer(data, updateable !== null && updateable !== void 0 ? updateable : false);
|
|
|
- if (buffer.nativeVertexBuffer === this.INVALID_HANDLE) {
|
|
|
- throw new Error("Could not create a native index buffer.");
|
|
|
+ if (data.length) {
|
|
|
+ buffer.nativeIndexBuffer = this._native.createIndexBuffer(data, updateable !== null && updateable !== void 0 ? updateable : false);
|
|
|
+ if (buffer.nativeVertexBuffer === this.INVALID_HANDLE) {
|
|
|
+ throw new Error("Could not create a native index buffer.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ buffer.nativeVertexBuffer = this.INVALID_HANDLE;
|
|
|
}
|
|
|
return buffer;
|
|
|
};
|
|
@@ -37100,6 +37105,23 @@ var NativeEngine = /** @class */ (function (_super) {
|
|
|
}
|
|
|
return buffer;
|
|
|
};
|
|
|
+ NativeEngine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {
|
|
|
+ // TODO : support index buffer
|
|
|
+ var attributes = effect.getAttributesNames();
|
|
|
+ for (var index = 0; index < attributes.length; index++) {
|
|
|
+ var location_1 = effect.getAttributeLocation(index);
|
|
|
+ if (location_1 >= 0) {
|
|
|
+ var kind = attributes[index];
|
|
|
+ var vertexBuffer = vertexBuffers[kind];
|
|
|
+ if (vertexBuffer) {
|
|
|
+ var buffer = vertexBuffer.getBuffer();
|
|
|
+ if (buffer) {
|
|
|
+ this._native.bindBuffer(buffer.nativeVertexBuffer, location_1, vertexBuffer.byteOffset, vertexBuffer.byteStride, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
NativeEngine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {
|
|
|
var vertexArray = this._native.createVertexArray();
|
|
|
if (indexBuffer) {
|
|
@@ -37107,14 +37129,14 @@ var NativeEngine = /** @class */ (function (_super) {
|
|
|
}
|
|
|
var attributes = effect.getAttributesNames();
|
|
|
for (var index = 0; index < attributes.length; index++) {
|
|
|
- var location_1 = effect.getAttributeLocation(index);
|
|
|
- if (location_1 >= 0) {
|
|
|
+ var location_2 = effect.getAttributeLocation(index);
|
|
|
+ if (location_2 >= 0) {
|
|
|
var kind = attributes[index];
|
|
|
var vertexBuffer = vertexBuffers[kind];
|
|
|
if (vertexBuffer) {
|
|
|
var buffer = vertexBuffer.getBuffer();
|
|
|
if (buffer) {
|
|
|
- this._native.recordVertexBuffer(vertexArray, buffer.nativeVertexBuffer, location_1, vertexBuffer.byteOffset, vertexBuffer.byteStride, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized);
|
|
|
+ this._native.recordVertexBuffer(vertexArray, buffer.nativeVertexBuffer, location_2, vertexBuffer.byteOffset, vertexBuffer.byteStride, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -39079,9 +39101,9 @@ var ThinEngine = /** @class */ (function () {
|
|
|
var capture = exception.capture;
|
|
|
var constraint = exception.captureConstraint;
|
|
|
var regex = new RegExp(capture);
|
|
|
- var matches = regex.exec(ua);
|
|
|
- if (matches && matches.length > 0) {
|
|
|
- var capturedValue = parseInt(matches[matches.length - 1]);
|
|
|
+ var matches_1 = regex.exec(ua);
|
|
|
+ if (matches_1 && matches_1.length > 0) {
|
|
|
+ var capturedValue = parseInt(matches_1[matches_1.length - 1]);
|
|
|
if (capturedValue >= constraint) {
|
|
|
continue;
|
|
|
}
|
|
@@ -39195,6 +39217,13 @@ var ThinEngine = /** @class */ (function () {
|
|
|
}
|
|
|
// Detect if we are running on a faulty buggy OS.
|
|
|
this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);
|
|
|
+ // Starting with iOS 14, we can trust the browser
|
|
|
+ var matches = navigator.userAgent.match(/Version\/(\d+)/);
|
|
|
+ if (matches && matches.length === 2) {
|
|
|
+ if (parseInt(matches[1]) >= 14) {
|
|
|
+ this._badOS = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
// Detect if we are running on a faulty buggy desktop OS.
|
|
|
this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
|
this._creationOptions = options;
|
|
@@ -47544,7 +47573,9 @@ var Gizmo = /** @class */ (function () {
|
|
|
*/
|
|
|
this.updateScale = true;
|
|
|
this._interactionsEnabled = true;
|
|
|
+ this._tempQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Quaternion"](0, 0, 0, 1);
|
|
|
this._tempVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
|
+ this._tempVector2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
|
this._rootMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__["Mesh"]("gizmoRootNode", gizmoLayer.utilityLayerScene);
|
|
|
this._rootMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].Identity();
|
|
|
this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function () {
|
|
@@ -47653,22 +47684,48 @@ var Gizmo = /** @class */ (function () {
|
|
|
if (!this._attachedNode) {
|
|
|
return;
|
|
|
}
|
|
|
- if (this._attachedNode.getClassName() === "Mesh" || this._attachedNode.getClassName() === "AbstractMesh" || this._attachedNode.getClassName() === "TransformNode") {
|
|
|
+ if (this._attachedNode._isCamera) {
|
|
|
+ var camera = this._attachedNode;
|
|
|
+ if (camera.parent) {
|
|
|
+ var parentInv = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"]();
|
|
|
+ var localMat = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"]();
|
|
|
+ camera.parent.getWorldMatrix().invertToRef(parentInv);
|
|
|
+ this._attachedNode.getWorldMatrix().multiplyToRef(parentInv, localMat);
|
|
|
+ localMat.decompose(this._tempVector2, this._tempQuaternion, this._tempVector);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._attachedNode.getWorldMatrix().decompose(this._tempVector2, this._tempQuaternion, this._tempVector);
|
|
|
+ }
|
|
|
+ var inheritsTargetCamera = this._attachedNode.getClassName() === "FreeCamera"
|
|
|
+ || this._attachedNode.getClassName() === "FlyCamera"
|
|
|
+ || this._attachedNode.getClassName() === "ArcFollowCamera"
|
|
|
+ || this._attachedNode.getClassName() === "TargetCamera"
|
|
|
+ || this._attachedNode.getClassName() === "TouchCamera"
|
|
|
+ || this._attachedNode.getClassName() === "UniversalCamera";
|
|
|
+ if (inheritsTargetCamera) {
|
|
|
+ var targetCamera = this._attachedNode;
|
|
|
+ targetCamera.rotation = this._tempQuaternion.toEulerAngles();
|
|
|
+ if (targetCamera.rotationQuaternion) {
|
|
|
+ targetCamera.rotationQuaternion.copyFrom(this._tempQuaternion);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ camera.position.copyFrom(this._tempVector);
|
|
|
+ }
|
|
|
+ else if (this._attachedNode.getClassName() === "Mesh" || this._attachedNode.getClassName() === "AbstractMesh" || this._attachedNode.getClassName() === "TransformNode") {
|
|
|
var transform = this._attachedNode;
|
|
|
- var transformQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Quaternion"](0, 0, 0, 1);
|
|
|
if (transform.parent) {
|
|
|
var parentInv = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"]();
|
|
|
var localMat = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__["Matrix"]();
|
|
|
transform.parent.getWorldMatrix().invertToRef(parentInv);
|
|
|
this._attachedNode._worldMatrix.multiplyToRef(parentInv, localMat);
|
|
|
- localMat.decompose(transform.scaling, transformQuaternion, transform.position);
|
|
|
+ localMat.decompose(transform.scaling, this._tempQuaternion, transform.position);
|
|
|
}
|
|
|
else {
|
|
|
- this._attachedNode._worldMatrix.decompose(transform.scaling, transformQuaternion, transform.position);
|
|
|
+ this._attachedNode._worldMatrix.decompose(transform.scaling, this._tempQuaternion, transform.position);
|
|
|
}
|
|
|
- transform.rotation = transformQuaternion.toEulerAngles();
|
|
|
+ transform.rotation = this._tempQuaternion.toEulerAngles();
|
|
|
if (transform.rotationQuaternion) {
|
|
|
- transform.rotationQuaternion = transformQuaternion;
|
|
|
+ transform.rotationQuaternion.copyFrom(this._tempQuaternion);
|
|
|
}
|
|
|
}
|
|
|
else if (this._attachedNode.getClassName() === "Bone") {
|