|
@@ -6668,13 +6668,14 @@ var BABYLON;
|
|
}
|
|
}
|
|
return name;
|
|
return name;
|
|
};
|
|
};
|
|
- Tools.first = function (array, predicate) {
|
|
|
|
|
|
+ Tools.First = function (array, predicate) {
|
|
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
|
|
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
|
|
var el = array_1[_i];
|
|
var el = array_1[_i];
|
|
if (predicate(el)) {
|
|
if (predicate(el)) {
|
|
return el;
|
|
return el;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* This method will return the name of the full name of the class, including its owning module (if any).
|
|
* This method will return the name of the full name of the class, including its owning module (if any).
|
|
@@ -11682,7 +11683,7 @@ var BABYLON;
|
|
Node.prototype.addBehavior = function (behavior) {
|
|
Node.prototype.addBehavior = function (behavior) {
|
|
var index = this._behaviors.indexOf(behavior);
|
|
var index = this._behaviors.indexOf(behavior);
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
behavior.attach(this);
|
|
behavior.attach(this);
|
|
this._behaviors.push(behavior);
|
|
this._behaviors.push(behavior);
|
|
@@ -11691,7 +11692,7 @@ var BABYLON;
|
|
Node.prototype.removeBehavior = function (behavior) {
|
|
Node.prototype.removeBehavior = function (behavior) {
|
|
var index = this._behaviors.indexOf(behavior);
|
|
var index = this._behaviors.indexOf(behavior);
|
|
if (index === -1) {
|
|
if (index === -1) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
this._behaviors[index].detach();
|
|
this._behaviors[index].detach();
|
|
this._behaviors.splice(index, 1);
|
|
this._behaviors.splice(index, 1);
|
|
@@ -13268,14 +13269,14 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
AbstractMesh.prototype.setAbsolutePosition = function (absolutePosition) {
|
|
AbstractMesh.prototype.setAbsolutePosition = function (absolutePosition) {
|
|
if (!absolutePosition) {
|
|
if (!absolutePosition) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
var absolutePositionX;
|
|
var absolutePositionX;
|
|
var absolutePositionY;
|
|
var absolutePositionY;
|
|
var absolutePositionZ;
|
|
var absolutePositionZ;
|
|
if (absolutePosition.x === undefined) {
|
|
if (absolutePosition.x === undefined) {
|
|
if (arguments.length < 3) {
|
|
if (arguments.length < 3) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
absolutePositionX = arguments[0];
|
|
absolutePositionX = arguments[0];
|
|
absolutePositionY = arguments[1];
|
|
absolutePositionY = arguments[1];
|
|
@@ -13473,7 +13474,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {
|
|
AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {
|
|
if (!this.subMeshes) {
|
|
if (!this.subMeshes) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {
|
|
for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {
|
|
var subMesh = this.subMeshes[subIndex];
|
|
var subMesh = this.subMeshes[subIndex];
|
|
@@ -13776,14 +13777,14 @@ var BABYLON;
|
|
};
|
|
};
|
|
AbstractMesh.prototype.applyImpulse = function (force, contactPoint) {
|
|
AbstractMesh.prototype.applyImpulse = function (force, contactPoint) {
|
|
if (!this.physicsImpostor) {
|
|
if (!this.physicsImpostor) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
this.physicsImpostor.applyImpulse(force, contactPoint);
|
|
this.physicsImpostor.applyImpulse(force, contactPoint);
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
AbstractMesh.prototype.setPhysicsLinkWith = function (otherMesh, pivot1, pivot2, options) {
|
|
AbstractMesh.prototype.setPhysicsLinkWith = function (otherMesh, pivot1, pivot2, options) {
|
|
if (!this.physicsImpostor || !otherMesh.physicsImpostor) {
|
|
if (!this.physicsImpostor || !otherMesh.physicsImpostor) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
this.physicsImpostor.createJoint(otherMesh.physicsImpostor, BABYLON.PhysicsJoint.HingeJoint, {
|
|
this.physicsImpostor.createJoint(otherMesh.physicsImpostor, BABYLON.PhysicsJoint.HingeJoint, {
|
|
mainPivot: pivot1,
|
|
mainPivot: pivot1,
|
|
@@ -14989,6 +14990,7 @@ var BABYLON;
|
|
case 3:
|
|
case 3:
|
|
return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
|
|
return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
|
|
* Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
|
|
@@ -20103,7 +20105,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
if (!this.environmentTexture) {
|
|
if (!this.environmentTexture) {
|
|
BABYLON.Tools.Warn("Can not create default skybox without environment texture.");
|
|
BABYLON.Tools.Warn("Can not create default skybox without environment texture.");
|
|
- return;
|
|
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
// Skybox
|
|
// Skybox
|
|
var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", scale, this);
|
|
var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", scale, this);
|
|
@@ -22121,7 +22123,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
Mesh.prototype.refreshBoundingInfo = function () {
|
|
Mesh.prototype.refreshBoundingInfo = function () {
|
|
if (this._boundingInfo.isLocked) {
|
|
if (this._boundingInfo.isLocked) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
|
|
var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
|
|
if (data) {
|
|
if (data) {
|
|
@@ -22162,7 +22164,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!needToRecreate) {
|
|
if (!needToRecreate) {
|
|
- return;
|
|
|
|
|
|
+ return this.subMeshes[0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.releaseSubMeshes();
|
|
this.releaseSubMeshes();
|
|
@@ -22271,7 +22273,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {
|
|
Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {
|
|
if (!this._geometry) {
|
|
if (!this._geometry) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
if (!makeItUnique) {
|
|
if (!makeItUnique) {
|
|
this._geometry.updateVerticesData(kind, data, updateExtends);
|
|
this._geometry.updateVerticesData(kind, data, updateExtends);
|
|
@@ -22308,7 +22310,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
Mesh.prototype.makeGeometryUnique = function () {
|
|
Mesh.prototype.makeGeometryUnique = function () {
|
|
if (!this._geometry) {
|
|
if (!this._geometry) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
var oldGeometry = this._geometry;
|
|
var oldGeometry = this._geometry;
|
|
var geometry = this._geometry.copy(BABYLON.Geometry.RandomId());
|
|
var geometry = this._geometry.copy(BABYLON.Geometry.RandomId());
|
|
@@ -22342,7 +22344,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
Mesh.prototype.updateIndices = function (indices, offset) {
|
|
Mesh.prototype.updateIndices = function (indices, offset) {
|
|
if (!this._geometry) {
|
|
if (!this._geometry) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
this._geometry.updateIndices(indices, offset);
|
|
this._geometry.updateIndices(indices, offset);
|
|
return this;
|
|
return this;
|
|
@@ -22353,7 +22355,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
Mesh.prototype.toLeftHanded = function () {
|
|
Mesh.prototype.toLeftHanded = function () {
|
|
if (!this._geometry) {
|
|
if (!this._geometry) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
this._geometry.toLeftHanded();
|
|
this._geometry.toLeftHanded();
|
|
return this;
|
|
return this;
|
|
@@ -22574,7 +22576,7 @@ var BABYLON;
|
|
Mesh.prototype.render = function (subMesh, enableAlphaMode) {
|
|
Mesh.prototype.render = function (subMesh, enableAlphaMode) {
|
|
this.checkOcclusionQuery();
|
|
this.checkOcclusionQuery();
|
|
if (this._isOccluded) {
|
|
if (this._isOccluded) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
var scene = this.getScene();
|
|
var scene = this.getScene();
|
|
// Managing instances
|
|
// Managing instances
|
|
@@ -24461,12 +24463,12 @@ var BABYLON;
|
|
SubMesh.prototype.refreshBoundingInfo = function () {
|
|
SubMesh.prototype.refreshBoundingInfo = function () {
|
|
this._lastColliderWorldVertices = null;
|
|
this._lastColliderWorldVertices = null;
|
|
if (this.IsGlobal) {
|
|
if (this.IsGlobal) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
var data = this._renderingMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
|
|
var data = this._renderingMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
|
|
if (!data) {
|
|
if (!data) {
|
|
this._boundingInfo = this._mesh._boundingInfo;
|
|
this._boundingInfo = this._mesh._boundingInfo;
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
var indices = this._renderingMesh.getIndices();
|
|
var indices = this._renderingMesh.getIndices();
|
|
var extend;
|
|
var extend;
|
|
@@ -25309,7 +25311,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
Effect.prototype.setMatrices = function (uniformName, matrices) {
|
|
Effect.prototype.setMatrices = function (uniformName, matrices) {
|
|
if (!matrices) {
|
|
if (!matrices) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
this._engine.setMatrices(this.getUniform(uniformName), matrices);
|
|
this._engine.setMatrices(this.getUniform(uniformName), matrices);
|
|
@@ -36604,6 +36606,7 @@ var BABYLON;
|
|
var mouse = this.inputs.attached["mouse"];
|
|
var mouse = this.inputs.attached["mouse"];
|
|
if (mouse)
|
|
if (mouse)
|
|
return mouse.angularSensibility;
|
|
return mouse.angularSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var mouse = this.inputs.attached["mouse"];
|
|
var mouse = this.inputs.attached["mouse"];
|
|
@@ -36618,6 +36621,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysUp;
|
|
return keyboard.keysUp;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -36632,6 +36636,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysDown;
|
|
return keyboard.keysDown;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -36646,6 +36651,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysLeft;
|
|
return keyboard.keysLeft;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -36660,6 +36666,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysRight;
|
|
return keyboard.keysRight;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -37397,6 +37404,7 @@ var BABYLON;
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
if (pointers)
|
|
if (pointers)
|
|
return pointers.angularSensibilityX;
|
|
return pointers.angularSensibilityX;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
@@ -37412,6 +37420,7 @@ var BABYLON;
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
if (pointers)
|
|
if (pointers)
|
|
return pointers.angularSensibilityY;
|
|
return pointers.angularSensibilityY;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
@@ -37427,6 +37436,7 @@ var BABYLON;
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
if (pointers)
|
|
if (pointers)
|
|
return pointers.pinchPrecision;
|
|
return pointers.pinchPrecision;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
@@ -37442,6 +37452,7 @@ var BABYLON;
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
if (pointers)
|
|
if (pointers)
|
|
return pointers.pinchDeltaPercentage;
|
|
return pointers.pinchDeltaPercentage;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
@@ -37457,6 +37468,7 @@ var BABYLON;
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
if (pointers)
|
|
if (pointers)
|
|
return pointers.panningSensibility;
|
|
return pointers.panningSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var pointers = this.inputs.attached["pointers"];
|
|
var pointers = this.inputs.attached["pointers"];
|
|
@@ -37472,6 +37484,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysUp;
|
|
return keyboard.keysUp;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -37486,6 +37499,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysDown;
|
|
return keyboard.keysDown;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -37500,6 +37514,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysLeft;
|
|
return keyboard.keysLeft;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -37514,6 +37529,7 @@ var BABYLON;
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
if (keyboard)
|
|
if (keyboard)
|
|
return keyboard.keysRight;
|
|
return keyboard.keysRight;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
var keyboard = this.inputs.attached["keyboard"];
|
|
@@ -37528,6 +37544,7 @@ var BABYLON;
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
if (mousewheel)
|
|
if (mousewheel)
|
|
return mousewheel.wheelPrecision;
|
|
return mousewheel.wheelPrecision;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
@@ -37542,6 +37559,7 @@ var BABYLON;
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
if (mousewheel)
|
|
if (mousewheel)
|
|
return mousewheel.wheelDeltaPercentage;
|
|
return mousewheel.wheelDeltaPercentage;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
@@ -38981,7 +38999,7 @@ var BABYLON;
|
|
if (onAnimationEnd) {
|
|
if (onAnimationEnd) {
|
|
onAnimationEnd();
|
|
onAnimationEnd();
|
|
}
|
|
}
|
|
- return;
|
|
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
var endFrame = frameRate * (duration / 1000);
|
|
var endFrame = frameRate * (duration / 1000);
|
|
transition.setKeys([{
|
|
transition.setKeys([{
|
|
@@ -44042,7 +44060,7 @@ var BABYLON;
|
|
if (end === void 0) { end = this.nbParticles - 1; }
|
|
if (end === void 0) { end = this.nbParticles - 1; }
|
|
if (update === void 0) { update = true; }
|
|
if (update === void 0) { update = true; }
|
|
if (!this._updatable) {
|
|
if (!this._updatable) {
|
|
- return;
|
|
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
// custom beforeUpdate
|
|
// custom beforeUpdate
|
|
this.beforeUpdateParticles(start, end, update);
|
|
this.beforeUpdateParticles(start, end, update);
|
|
@@ -51029,6 +51047,7 @@ var BABYLON;
|
|
BABYLON.Tools.Log(logOperation("importMesh", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
|
|
BABYLON.Tools.Log(logOperation("importMesh", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return false;
|
|
},
|
|
},
|
|
load: function (scene, data, rootUrl, onError) {
|
|
load: function (scene, data, rootUrl, onError) {
|
|
// Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
|
|
// Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
|
|
@@ -51375,6 +51394,7 @@ var BABYLON;
|
|
BABYLON.Tools.Log(logOperation("importScene", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
|
|
BABYLON.Tools.Log(logOperation("importScene", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
})(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
|
|
})(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
|
|
@@ -52805,6 +52825,7 @@ var BABYLON;
|
|
var touch = this.inputs.attached["touch"];
|
|
var touch = this.inputs.attached["touch"];
|
|
if (touch)
|
|
if (touch)
|
|
return touch.touchAngularSensibility;
|
|
return touch.touchAngularSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var touch = this.inputs.attached["touch"];
|
|
var touch = this.inputs.attached["touch"];
|
|
@@ -52819,6 +52840,7 @@ var BABYLON;
|
|
var touch = this.inputs.attached["touch"];
|
|
var touch = this.inputs.attached["touch"];
|
|
if (touch)
|
|
if (touch)
|
|
return touch.touchMoveSensibility;
|
|
return touch.touchMoveSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var touch = this.inputs.attached["touch"];
|
|
var touch = this.inputs.attached["touch"];
|
|
@@ -55038,6 +55060,7 @@ var BABYLON;
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
if (gamepad)
|
|
if (gamepad)
|
|
return gamepad.gamepadAngularSensibility;
|
|
return gamepad.gamepadAngularSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
@@ -55052,6 +55075,7 @@ var BABYLON;
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
if (gamepad)
|
|
if (gamepad)
|
|
return gamepad.gamepadMoveSensibility;
|
|
return gamepad.gamepadMoveSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
@@ -55088,6 +55112,7 @@ var BABYLON;
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
if (gamepad)
|
|
if (gamepad)
|
|
return gamepad.gamepadAngularSensibility;
|
|
return gamepad.gamepadAngularSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
@@ -55102,6 +55127,7 @@ var BABYLON;
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
if (gamepad)
|
|
if (gamepad)
|
|
return gamepad.gamepadMoveSensibility;
|
|
return gamepad.gamepadMoveSensibility;
|
|
|
|
+ return null;
|
|
},
|
|
},
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
var gamepad = this.inputs.attached["gamepad"];
|
|
@@ -55303,6 +55329,7 @@ var BABYLON;
|
|
return this._renderPasses[passName];
|
|
return this._renderPasses[passName];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
PostProcessRenderEffect.prototype.emptyPasses = function () {
|
|
PostProcessRenderEffect.prototype.emptyPasses = function () {
|
|
this._renderPasses = {};
|
|
this._renderPasses = {};
|
|
@@ -63877,7 +63904,7 @@ var BABYLON;
|
|
var parentMesh = this.object.parent;
|
|
var parentMesh = this.object.parent;
|
|
return parentMesh.physicsImpostor;
|
|
return parentMesh.physicsImpostor;
|
|
}
|
|
}
|
|
- return;
|
|
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Should a new body be generated.
|
|
* Should a new body be generated.
|
|
@@ -64370,6 +64397,7 @@ var BABYLON;
|
|
return this._impostors[i];
|
|
return this._impostors[i];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
|
|
PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
|
|
for (var i = 0; i < this._impostors.length; ++i) {
|
|
for (var i = 0; i < this._impostors.length; ++i) {
|
|
@@ -64377,6 +64405,7 @@ var BABYLON;
|
|
return this._impostors[i];
|
|
return this._impostors[i];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
// Statics
|
|
// Statics
|
|
PhysicsEngine.Epsilon = 0.001;
|
|
PhysicsEngine.Epsilon = 0.001;
|
|
@@ -73747,24 +73776,13 @@ var BABYLON;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
GLTFFileLoader._parseVersion = function (version) {
|
|
GLTFFileLoader._parseVersion = function (version) {
|
|
- if (!version) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- var parts = version.split(".");
|
|
|
|
- if (parts.length != 2) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- var major = +parts[0];
|
|
|
|
- if (isNaN(major)) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- var minor = +parts[1];
|
|
|
|
- if (isNaN(minor)) {
|
|
|
|
|
|
+ var match = (version + "").match(/^(\d+)\.(\d+)$/);
|
|
|
|
+ if (!match) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
- major: major,
|
|
|
|
- minor: minor
|
|
|
|
|
|
+ major: parseInt(match[1]),
|
|
|
|
+ minor: parseInt(match[2])
|
|
};
|
|
};
|
|
};
|
|
};
|
|
GLTFFileLoader._compareVersion = function (a, b) {
|
|
GLTFFileLoader._compareVersion = function (a, b) {
|
|
@@ -73778,11 +73796,11 @@ var BABYLON;
|
|
return -1;
|
|
return -1;
|
|
return 0;
|
|
return 0;
|
|
};
|
|
};
|
|
- GLTFFileLoader._decodeBufferToText = function (view) {
|
|
|
|
|
|
+ GLTFFileLoader._decodeBufferToText = function (buffer) {
|
|
var result = "";
|
|
var result = "";
|
|
- var length = view.byteLength;
|
|
|
|
|
|
+ var length = buffer.byteLength;
|
|
for (var i = 0; i < length; ++i) {
|
|
for (var i = 0; i < length; ++i) {
|
|
- result += String.fromCharCode(view[i]);
|
|
|
|
|
|
+ result += String.fromCharCode(buffer[i]);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
};
|
|
};
|
|
@@ -74041,6 +74059,7 @@ var BABYLON;
|
|
var channel = Number(attributeParameter.semantic.split("_")[1]);
|
|
var channel = Number(attributeParameter.semantic.split("_")[1]);
|
|
return "uv" + (channel === 0 ? "" : channel + 1);
|
|
return "uv" + (channel === 0 ? "" : channel + 1);
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Returns the animation path (glTF -> Babylon)
|
|
* Returns the animation path (glTF -> Babylon)
|
|
@@ -76218,7 +76237,7 @@ var BABYLON;
|
|
if (!scene) {
|
|
if (!scene) {
|
|
throw new Error("Failed to find scene " + (this._gltf.scene || 0));
|
|
throw new Error("Failed to find scene " + (this._gltf.scene || 0));
|
|
}
|
|
}
|
|
- this._loadScene("scenes[" + scene.index + "]", scene, nodeNames);
|
|
|
|
|
|
+ this._loadScene("#/scenes/" + scene.index, scene, nodeNames);
|
|
};
|
|
};
|
|
GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
|
|
GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
|
|
this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
|
|
this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
|
|
@@ -76263,7 +76282,7 @@ var BABYLON;
|
|
if (!node) {
|
|
if (!node) {
|
|
throw new Error(context + ": Failed to find node " + nodeIndices[i]);
|
|
throw new Error(context + ": Failed to find node " + nodeIndices[i]);
|
|
}
|
|
}
|
|
- this._loadNode("nodes[" + nodeIndices[i] + "]", node);
|
|
|
|
|
|
+ this._loadNode("#/nodes/" + nodeIndices[i], node);
|
|
}
|
|
}
|
|
// Disable the root mesh until the asset is ready to render.
|
|
// Disable the root mesh until the asset is ready to render.
|
|
this._rootNode.babylonMesh.setEnabled(false);
|
|
this._rootNode.babylonMesh.setEnabled(false);
|
|
@@ -76279,7 +76298,7 @@ var BABYLON;
|
|
if (!mesh) {
|
|
if (!mesh) {
|
|
throw new Error(context + ": Failed to find mesh " + node.mesh);
|
|
throw new Error(context + ": Failed to find mesh " + node.mesh);
|
|
}
|
|
}
|
|
- this._loadMesh("meshes[" + node.mesh + "]", node, mesh);
|
|
|
|
|
|
+ this._loadMesh("#/meshes/" + node.mesh, node, mesh);
|
|
}
|
|
}
|
|
node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
|
|
node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
|
|
node.babylonAnimationTargets = node.babylonAnimationTargets || [];
|
|
node.babylonAnimationTargets = node.babylonAnimationTargets || [];
|
|
@@ -76289,7 +76308,7 @@ var BABYLON;
|
|
if (!skin) {
|
|
if (!skin) {
|
|
throw new Error(context + ": Failed to find skin " + node.skin);
|
|
throw new Error(context + ": Failed to find skin " + node.skin);
|
|
}
|
|
}
|
|
- node.babylonMesh.skeleton = this._loadSkin("skins[" + node.skin + "]", skin);
|
|
|
|
|
|
+ node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
|
|
}
|
|
}
|
|
if (node.camera != null) {
|
|
if (node.camera != null) {
|
|
// TODO: handle cameras
|
|
// TODO: handle cameras
|
|
@@ -76300,7 +76319,7 @@ var BABYLON;
|
|
if (!childNode) {
|
|
if (!childNode) {
|
|
throw new Error(context + ": Failed to find child node " + node.children[i]);
|
|
throw new Error(context + ": Failed to find child node " + node.children[i]);
|
|
}
|
|
}
|
|
- this._loadNode("nodes[" + node.children[i] + "]", childNode);
|
|
|
|
|
|
+ this._loadNode("#/nodes/" + node.children[i], childNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -76316,7 +76335,7 @@ var BABYLON;
|
|
var numRemainingPrimitives = mesh.primitives.length;
|
|
var numRemainingPrimitives = mesh.primitives.length;
|
|
for (var index = 0; index < mesh.primitives.length; index++) {
|
|
for (var index = 0; index < mesh.primitives.length; index++) {
|
|
var primitive = mesh.primitives[index];
|
|
var primitive = mesh.primitives[index];
|
|
- this._loadPrimitive(context + "/primitives[" + index + "]", node, mesh, primitive, function (subVertexData, loadMaterial) {
|
|
|
|
|
|
+ this._loadPrimitive(context + "/primitives/" + index, node, mesh, primitive, function (subVertexData, loadMaterial) {
|
|
subMeshInfos.push({
|
|
subMeshInfos.push({
|
|
verticesStart: vertexData.positions.length,
|
|
verticesStart: vertexData.positions.length,
|
|
verticesCount: subVertexData.positions.length,
|
|
verticesCount: subVertexData.positions.length,
|
|
@@ -76358,7 +76377,7 @@ var BABYLON;
|
|
if (!material) {
|
|
if (!material) {
|
|
throw new Error(context + ": Failed to find material " + primitive.material);
|
|
throw new Error(context + ": Failed to find material " + primitive.material);
|
|
}
|
|
}
|
|
- _this._loadMaterial("materials[" + material.index + "]", material, function (babylonMaterial, isNew) {
|
|
|
|
|
|
+ _this._loadMaterial("#/materials/" + material.index, material, function (babylonMaterial, isNew) {
|
|
if (isNew && _this._parent.onMaterialLoaded) {
|
|
if (isNew && _this._parent.onMaterialLoaded) {
|
|
_this._parent.onMaterialLoaded(babylonMaterial);
|
|
_this._parent.onMaterialLoaded(babylonMaterial);
|
|
}
|
|
}
|
|
@@ -76391,7 +76410,7 @@ var BABYLON;
|
|
if (!accessor) {
|
|
if (!accessor) {
|
|
throw new Error(context + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
|
|
throw new Error(context + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
|
|
}
|
|
}
|
|
- this_1._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
|
|
|
|
|
|
+ this_1._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
|
|
switch (attribute) {
|
|
switch (attribute) {
|
|
case "NORMAL":
|
|
case "NORMAL":
|
|
vertexData.normals = data;
|
|
vertexData.normals = data;
|
|
@@ -76432,7 +76451,7 @@ var BABYLON;
|
|
if (!indicesAccessor) {
|
|
if (!indicesAccessor) {
|
|
throw new Error(context + ": Failed to find indices accessor " + primitive.indices);
|
|
throw new Error(context + ": Failed to find indices accessor " + primitive.indices);
|
|
}
|
|
}
|
|
- _this._loadAccessorAsync("accessors[" + indicesAccessor.index + "]", indicesAccessor, function (data) {
|
|
|
|
|
|
+ _this._loadAccessorAsync("#/accessors/" + indicesAccessor.index, indicesAccessor, function (data) {
|
|
vertexData.indices = data;
|
|
vertexData.indices = data;
|
|
onSuccess(vertexData);
|
|
onSuccess(vertexData);
|
|
});
|
|
});
|
|
@@ -76469,9 +76488,9 @@ var BABYLON;
|
|
var _loop_3 = function (attribute) {
|
|
var _loop_3 = function (attribute) {
|
|
accessor = GLTF2.GLTFUtils.GetArrayItem(this_2._gltf.accessors, attributes[attribute]);
|
|
accessor = GLTF2.GLTFUtils.GetArrayItem(this_2._gltf.accessors, attributes[attribute]);
|
|
if (!accessor) {
|
|
if (!accessor) {
|
|
- throw new Error(context + "/targets[" + index + "]: Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
|
|
|
|
|
|
+ throw new Error(context + "/targets/" + index + ": Failed to find attribute '" + attribute + "' accessor " + attributes[attribute]);
|
|
}
|
|
}
|
|
- this_2._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
|
|
|
|
|
|
+ this_2._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
|
|
if (accessor.name) {
|
|
if (accessor.name) {
|
|
babylonMorphTarget.name = accessor.name;
|
|
babylonMorphTarget.name = accessor.name;
|
|
}
|
|
}
|
|
@@ -76546,7 +76565,7 @@ var BABYLON;
|
|
if (!accessor) {
|
|
if (!accessor) {
|
|
throw new Error(context + ": Failed to find inverse bind matrices attribute " + skin.inverseBindMatrices);
|
|
throw new Error(context + ": Failed to find inverse bind matrices attribute " + skin.inverseBindMatrices);
|
|
}
|
|
}
|
|
- this._loadAccessorAsync("accessors[" + accessor.index + "]", accessor, function (data) {
|
|
|
|
|
|
+ this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
|
|
_this._loadBones(context, skin, data);
|
|
_this._loadBones(context, skin, data);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -76624,7 +76643,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
for (var animationIndex = 0; animationIndex < animations.length; animationIndex++) {
|
|
for (var animationIndex = 0; animationIndex < animations.length; animationIndex++) {
|
|
var animation = animations[animationIndex];
|
|
var animation = animations[animationIndex];
|
|
- var context = "animations[" + animationIndex + "]";
|
|
|
|
|
|
+ var context = "#/animations/" + animationIndex;
|
|
for (var channelIndex = 0; channelIndex < animation.channels.length; channelIndex++) {
|
|
for (var channelIndex = 0; channelIndex < animation.channels.length; channelIndex++) {
|
|
var channel = GLTF2.GLTFUtils.GetArrayItem(animation.channels, channelIndex);
|
|
var channel = GLTF2.GLTFUtils.GetArrayItem(animation.channels, channelIndex);
|
|
if (!channel) {
|
|
if (!channel) {
|
|
@@ -76634,7 +76653,7 @@ var BABYLON;
|
|
if (!sampler) {
|
|
if (!sampler) {
|
|
throw new Error(context + ": Failed to find sampler " + channel.sampler);
|
|
throw new Error(context + ": Failed to find sampler " + channel.sampler);
|
|
}
|
|
}
|
|
- this._loadAnimationChannel(animation, context + "/channels[" + channelIndex + "]", channel, context + "/samplers[" + channel.sampler + "]", sampler);
|
|
|
|
|
|
+ this._loadAnimationChannel(animation, context + "/channels/" + channelIndex, channel, context + "/samplers/" + channel.sampler, sampler);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -76643,23 +76662,28 @@ var BABYLON;
|
|
if (!targetNode) {
|
|
if (!targetNode) {
|
|
throw new Error(channelContext + ": Failed to find target node " + channel.target.node);
|
|
throw new Error(channelContext + ": Failed to find target node " + channel.target.node);
|
|
}
|
|
}
|
|
- var conversion = {
|
|
|
|
- "translation": "position",
|
|
|
|
- "rotation": "rotationQuaternion",
|
|
|
|
- "scale": "scaling",
|
|
|
|
- "weights": "influence"
|
|
|
|
- };
|
|
|
|
- var targetPath = conversion[channel.target.path];
|
|
|
|
- if (!targetPath) {
|
|
|
|
- throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
|
|
|
|
- }
|
|
|
|
- var animationConvertion = {
|
|
|
|
- "position": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
|
|
|
|
- "rotationQuaternion": BABYLON.Animation.ANIMATIONTYPE_QUATERNION,
|
|
|
|
- "scaling": BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
|
|
|
|
- "influence": BABYLON.Animation.ANIMATIONTYPE_FLOAT,
|
|
|
|
- };
|
|
|
|
- var animationType = animationConvertion[targetPath];
|
|
|
|
|
|
+ var targetPath;
|
|
|
|
+ var animationType;
|
|
|
|
+ switch (channel.target.path) {
|
|
|
|
+ case "translation":
|
|
|
|
+ targetPath = "position";
|
|
|
|
+ animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
|
|
|
|
+ break;
|
|
|
|
+ case "rotation":
|
|
|
|
+ targetPath = "rotationQuaternion";
|
|
|
|
+ animationType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
|
|
|
|
+ break;
|
|
|
|
+ case "scale":
|
|
|
|
+ targetPath = "scaling";
|
|
|
|
+ animationType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
|
|
|
|
+ break;
|
|
|
|
+ case "weights":
|
|
|
|
+ targetPath = "influence";
|
|
|
|
+ animationType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ throw new Error(channelContext + ": Invalid target path '" + channel.target.path + "'");
|
|
|
|
+ }
|
|
var inputData;
|
|
var inputData;
|
|
var outputData;
|
|
var outputData;
|
|
var checkSuccess = function () {
|
|
var checkSuccess = function () {
|
|
@@ -76667,48 +76691,60 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
var outputBufferOffset = 0;
|
|
var outputBufferOffset = 0;
|
|
- var nextOutputConversion = {
|
|
|
|
- "position": function () {
|
|
|
|
- var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
|
|
|
|
- outputBufferOffset += 3;
|
|
|
|
- return value;
|
|
|
|
- },
|
|
|
|
- "rotationQuaternion": function () {
|
|
|
|
- var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
|
|
|
|
- outputBufferOffset += 4;
|
|
|
|
- return value;
|
|
|
|
- },
|
|
|
|
- "scaling": function () {
|
|
|
|
- var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
|
|
|
|
- outputBufferOffset += 3;
|
|
|
|
- return value;
|
|
|
|
- },
|
|
|
|
- "influence": function () {
|
|
|
|
- var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
|
|
|
|
- var value = new Array(numTargets);
|
|
|
|
- for (var i = 0; i < numTargets; i++) {
|
|
|
|
- value[i] = outputData[outputBufferOffset++];
|
|
|
|
- }
|
|
|
|
- return value;
|
|
|
|
- },
|
|
|
|
- };
|
|
|
|
- var getNextOutputValue = nextOutputConversion[targetPath];
|
|
|
|
- var nextKeyConversion = {
|
|
|
|
- "LINEAR": function (frameIndex) { return ({
|
|
|
|
- frame: inputData[frameIndex],
|
|
|
|
- value: getNextOutputValue()
|
|
|
|
- }); },
|
|
|
|
- "CUBICSPLINE": function (frameIndex) { return ({
|
|
|
|
- frame: inputData[frameIndex],
|
|
|
|
- inTangent: getNextOutputValue(),
|
|
|
|
- value: getNextOutputValue(),
|
|
|
|
- outTangent: getNextOutputValue()
|
|
|
|
- }); },
|
|
|
|
- };
|
|
|
|
- var getNextKey = nextKeyConversion[sampler.interpolation];
|
|
|
|
- if (!getNextKey) {
|
|
|
|
- throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
|
|
|
|
|
|
+ var getNextOutputValue;
|
|
|
|
+ switch (targetPath) {
|
|
|
|
+ case "position":
|
|
|
|
+ getNextOutputValue = function () {
|
|
|
|
+ var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
|
|
|
|
+ outputBufferOffset += 3;
|
|
|
|
+ return value;
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ case "rotationQuaternion":
|
|
|
|
+ getNextOutputValue = function () {
|
|
|
|
+ var value = BABYLON.Quaternion.FromArray(outputData, outputBufferOffset);
|
|
|
|
+ outputBufferOffset += 4;
|
|
|
|
+ return value;
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ case "scaling":
|
|
|
|
+ getNextOutputValue = function () {
|
|
|
|
+ var value = BABYLON.Vector3.FromArray(outputData, outputBufferOffset);
|
|
|
|
+ outputBufferOffset += 3;
|
|
|
|
+ return value;
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ case "influence":
|
|
|
|
+ getNextOutputValue = function () {
|
|
|
|
+ var numTargets = targetNode.babylonMesh.morphTargetManager.numTargets;
|
|
|
|
+ var value = new Array(numTargets);
|
|
|
|
+ for (var i = 0; i < numTargets; i++) {
|
|
|
|
+ value[i] = outputData[outputBufferOffset++];
|
|
|
|
+ }
|
|
|
|
+ return value;
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ var getNextKey;
|
|
|
|
+ switch (sampler.interpolation) {
|
|
|
|
+ case "LINEAR":
|
|
|
|
+ getNextKey = function (frameIndex) { return ({
|
|
|
|
+ frame: inputData[frameIndex],
|
|
|
|
+ value: getNextOutputValue()
|
|
|
|
+ }); };
|
|
|
|
+ break;
|
|
|
|
+ case "CUBICSPLINE":
|
|
|
|
+ getNextKey = function (frameIndex) { return ({
|
|
|
|
+ frame: inputData[frameIndex],
|
|
|
|
+ inTangent: getNextOutputValue(),
|
|
|
|
+ value: getNextOutputValue(),
|
|
|
|
+ outTangent: getNextOutputValue()
|
|
|
|
+ }); };
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ throw new Error(samplerContext + ": Invalid interpolation '" + sampler.interpolation + "'");
|
|
}
|
|
}
|
|
|
|
+ ;
|
|
var keys = new Array(inputData.length);
|
|
var keys = new Array(inputData.length);
|
|
for (var frameIndex = 0; frameIndex < inputData.length; frameIndex++) {
|
|
for (var frameIndex = 0; frameIndex < inputData.length; frameIndex++) {
|
|
keys[frameIndex] = getNextKey(frameIndex);
|
|
keys[frameIndex] = getNextKey(frameIndex);
|
|
@@ -76745,7 +76781,7 @@ var BABYLON;
|
|
if (!inputAccessor) {
|
|
if (!inputAccessor) {
|
|
throw new Error(samplerContext + ": Failed to find input accessor " + sampler.input);
|
|
throw new Error(samplerContext + ": Failed to find input accessor " + sampler.input);
|
|
}
|
|
}
|
|
- this._loadAccessorAsync("accessors[" + inputAccessor.index + "]", inputAccessor, function (data) {
|
|
|
|
|
|
+ this._loadAccessorAsync("#/accessors/" + inputAccessor.index, inputAccessor, function (data) {
|
|
inputData = data;
|
|
inputData = data;
|
|
checkSuccess();
|
|
checkSuccess();
|
|
});
|
|
});
|
|
@@ -76753,7 +76789,7 @@ var BABYLON;
|
|
if (!outputAccessor) {
|
|
if (!outputAccessor) {
|
|
throw new Error(samplerContext + ": Failed to find output accessor " + sampler.output);
|
|
throw new Error(samplerContext + ": Failed to find output accessor " + sampler.output);
|
|
}
|
|
}
|
|
- this._loadAccessorAsync("accessors[" + outputAccessor.index + "]", outputAccessor, function (data) {
|
|
|
|
|
|
+ this._loadAccessorAsync("#/accessors/" + outputAccessor.index, outputAccessor, function (data) {
|
|
outputData = data;
|
|
outputData = data;
|
|
checkSuccess();
|
|
checkSuccess();
|
|
});
|
|
});
|
|
@@ -76814,7 +76850,7 @@ var BABYLON;
|
|
if (!buffer) {
|
|
if (!buffer) {
|
|
throw new Error(context + ": Failed to find buffer " + bufferView.buffer);
|
|
throw new Error(context + ": Failed to find buffer " + bufferView.buffer);
|
|
}
|
|
}
|
|
- this._loadBufferAsync("buffers[" + buffer.index + "]", buffer, function (bufferData) {
|
|
|
|
|
|
+ this._loadBufferAsync("#/buffers/" + buffer.index, buffer, function (bufferData) {
|
|
if (_this._disposed) {
|
|
if (_this._disposed) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -76839,7 +76875,7 @@ var BABYLON;
|
|
if (!bufferView) {
|
|
if (!bufferView) {
|
|
throw new Error(context + ": Failed to find buffer view " + accessor.bufferView);
|
|
throw new Error(context + ": Failed to find buffer view " + accessor.bufferView);
|
|
}
|
|
}
|
|
- this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, function (bufferViewData) {
|
|
|
|
|
|
+ this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, function (bufferViewData) {
|
|
var numComponents = _this._getNumComponentsOfType(accessor.type);
|
|
var numComponents = _this._getNumComponentsOfType(accessor.type);
|
|
if (numComponents === 0) {
|
|
if (numComponents === 0) {
|
|
throw new Error(context + ": Invalid type (" + accessor.type + ")");
|
|
throw new Error(context + ": Invalid type (" + accessor.type + ")");
|
|
@@ -76974,14 +77010,14 @@ var BABYLON;
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
|
|
throw new Error(context + ": Failed to find base color texture " + properties.baseColorTexture.index);
|
|
}
|
|
}
|
|
- babylonMaterial.albedoTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.baseColorTexture.texCoord);
|
|
|
|
|
|
+ babylonMaterial.albedoTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.baseColorTexture.texCoord);
|
|
}
|
|
}
|
|
if (properties.metallicRoughnessTexture) {
|
|
if (properties.metallicRoughnessTexture) {
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
|
|
var texture = GLTF2.GLTFUtils.GetArrayItem(this._gltf.textures, properties.metallicRoughnessTexture.index);
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
|
|
throw new Error(context + ": Failed to find metallic roughness texture " + properties.metallicRoughnessTexture.index);
|
|
}
|
|
}
|
|
- babylonMaterial.metallicTexture = this._loadTexture("textures[" + texture.index + "]", texture, properties.metallicRoughnessTexture.texCoord);
|
|
|
|
|
|
+ babylonMaterial.metallicTexture = this._loadTexture("#/textures/" + texture.index, texture, properties.metallicRoughnessTexture.texCoord);
|
|
babylonMaterial.useMetallnessFromMetallicTextureBlue = true;
|
|
babylonMaterial.useMetallnessFromMetallicTextureBlue = true;
|
|
babylonMaterial.useRoughnessFromMetallicTextureGreen = true;
|
|
babylonMaterial.useRoughnessFromMetallicTextureGreen = true;
|
|
babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;
|
|
babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;
|
|
@@ -77018,7 +77054,7 @@ var BABYLON;
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
|
|
throw new Error(context + ": Failed to find normal texture " + material.normalTexture.index);
|
|
}
|
|
}
|
|
- babylonMaterial.bumpTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.normalTexture.texCoord);
|
|
|
|
|
|
+ babylonMaterial.bumpTexture = this._loadTexture("#/textures/" + texture.index, texture, material.normalTexture.texCoord);
|
|
babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;
|
|
babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;
|
|
babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;
|
|
babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;
|
|
if (material.normalTexture.scale != null) {
|
|
if (material.normalTexture.scale != null) {
|
|
@@ -77030,7 +77066,7 @@ var BABYLON;
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
|
|
throw new Error(context + ": Failed to find occlusion texture " + material.occlusionTexture.index);
|
|
}
|
|
}
|
|
- babylonMaterial.ambientTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.occlusionTexture.texCoord);
|
|
|
|
|
|
+ babylonMaterial.ambientTexture = this._loadTexture("#/textures/" + texture.index, texture, material.occlusionTexture.texCoord);
|
|
babylonMaterial.useAmbientInGrayScale = true;
|
|
babylonMaterial.useAmbientInGrayScale = true;
|
|
if (material.occlusionTexture.strength != null) {
|
|
if (material.occlusionTexture.strength != null) {
|
|
babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
|
|
babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;
|
|
@@ -77041,7 +77077,7 @@ var BABYLON;
|
|
if (!texture) {
|
|
if (!texture) {
|
|
throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
|
|
throw new Error(context + ": Failed to find emissive texture " + material.emissiveTexture.index);
|
|
}
|
|
}
|
|
- babylonMaterial.emissiveTexture = this._loadTexture("textures[" + texture.index + "]", texture, material.emissiveTexture.texCoord);
|
|
|
|
|
|
+ babylonMaterial.emissiveTexture = this._loadTexture("#/textures/" + texture.index, texture, material.emissiveTexture.texCoord);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, colorFactor) {
|
|
GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, colorFactor) {
|
|
@@ -77113,7 +77149,7 @@ var BABYLON;
|
|
if (!image) {
|
|
if (!image) {
|
|
throw new Error(context + ": Failed to find source " + texture.source);
|
|
throw new Error(context + ": Failed to find source " + texture.source);
|
|
}
|
|
}
|
|
- this._loadImage("images[" + image.index + "]", image, function (data) {
|
|
|
|
|
|
+ this._loadImage("#/images/" + image.index, image, function (data) {
|
|
texture.url = URL.createObjectURL(new Blob([data], { type: image.mimeType }));
|
|
texture.url = URL.createObjectURL(new Blob([data], { type: image.mimeType }));
|
|
texture.dataReadyObservable.notifyObservers(texture);
|
|
texture.dataReadyObservable.notifyObservers(texture);
|
|
});
|
|
});
|
|
@@ -77157,7 +77193,7 @@ var BABYLON;
|
|
if (!bufferView) {
|
|
if (!bufferView) {
|
|
throw new Error(context + ": Failed to find buffer view " + image.bufferView);
|
|
throw new Error(context + ": Failed to find buffer view " + image.bufferView);
|
|
}
|
|
}
|
|
- this._loadBufferViewAsync("bufferViews[" + bufferView.index + "]", bufferView, onSuccess);
|
|
|
|
|
|
+ this._loadBufferViewAsync("#/bufferViews/" + bufferView.index, bufferView, onSuccess);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
GLTFLoader.prototype._tryCatchOnError = function (handler) {
|
|
GLTFLoader.prototype._tryCatchOnError = function (handler) {
|
|
@@ -77276,18 +77312,6 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- /**
|
|
|
|
- * Decodes a buffer view into a string
|
|
|
|
- * @param view: the buffer view
|
|
|
|
- */
|
|
|
|
- GLTFUtils.DecodeBufferToText = function (view) {
|
|
|
|
- var result = "";
|
|
|
|
- var length = view.byteLength;
|
|
|
|
- for (var i = 0; i < length; ++i) {
|
|
|
|
- result += String.fromCharCode(view[i]);
|
|
|
|
- }
|
|
|
|
- return result;
|
|
|
|
- };
|
|
|
|
return GLTFUtils;
|
|
return GLTFUtils;
|
|
}());
|
|
}());
|
|
GLTF2.GLTFUtils = GLTFUtils;
|
|
GLTF2.GLTFUtils = GLTFUtils;
|
|
@@ -77337,7 +77361,7 @@ var BABYLON;
|
|
GLTFLoaderExtension._ApplyExtensions = function (action) {
|
|
GLTFLoaderExtension._ApplyExtensions = function (action) {
|
|
var extensions = GLTFLoaderExtension._Extensions;
|
|
var extensions = GLTFLoaderExtension._Extensions;
|
|
if (!extensions) {
|
|
if (!extensions) {
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
for (var i = 0; i < extensions.length; i++) {
|
|
for (var i = 0; i < extensions.length; i++) {
|
|
var extension = extensions[i];
|
|
var extension = extensions[i];
|