|
@@ -2406,6 +2406,90 @@ var __extends = this.__extends || function (d, b) {
|
|
return Path2;
|
|
return Path2;
|
|
})();
|
|
})();
|
|
BABYLON.Path2 = Path2;
|
|
BABYLON.Path2 = Path2;
|
|
|
|
+ var Path3D = (function () {
|
|
|
|
+ function Path3D(path) {
|
|
|
|
+ this.path = path;
|
|
|
|
+ this._curve = [];
|
|
|
|
+ this._distances = [];
|
|
|
|
+ this._tangents = [];
|
|
|
|
+ this._normals = [];
|
|
|
|
+ this._binormals = [];
|
|
|
|
+ this._curve = path.slice(); // copy array
|
|
|
|
+ var l = this._curve.length;
|
|
|
|
+ // first and last tangents
|
|
|
|
+ this._tangents[0] = this._curve[1].subtract(this._curve[0]);
|
|
|
|
+ this._tangents[0].normalize();
|
|
|
|
+ this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);
|
|
|
|
+ this._tangents[l - 1].normalize();
|
|
|
|
+ // normals and binormals at first point : arbitrary vector with _normalVector()
|
|
|
|
+ var tg0 = this._tangents[0];
|
|
|
|
+ var pp0 = this._normalVector(this._curve[0], tg0);
|
|
|
|
+ this._normals[0] = pp0;
|
|
|
|
+ this._normals[0].normalize();
|
|
|
|
+ this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);
|
|
|
|
+ this._normals[0].normalize();
|
|
|
|
+ this._distances[0] = 0;
|
|
|
|
+ // normals and binormals : next points
|
|
|
|
+ var prev; // previous vector (segment)
|
|
|
|
+ var cur; // current vector (segment)
|
|
|
|
+ var curTang; // current tangent
|
|
|
|
+ var prevNorm; // previous normal
|
|
|
|
+ var prevBinor; // previous binormal
|
|
|
|
+ for (var i = 1; i < l; i++) {
|
|
|
|
+ // tangents
|
|
|
|
+ prev = this._curve[i].subtract(this._curve[i - 1]);
|
|
|
|
+ if (i < l - 1) {
|
|
|
|
+ cur = this._curve[i + 1].subtract(this._curve[i]);
|
|
|
|
+ this._tangents[i] = prev.add(cur);
|
|
|
|
+ this._tangents[i].normalize();
|
|
|
|
+ }
|
|
|
|
+ this._distances[i] = this._distances[i - 1] + prev.length();
|
|
|
|
+ // normals and binormals
|
|
|
|
+ // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html
|
|
|
|
+ curTang = this._tangents[i];
|
|
|
|
+ prevNorm = this._normals[i - 1];
|
|
|
|
+ prevBinor = this._binormals[i - 1];
|
|
|
|
+ this._normals[i] = Vector3.Cross(prevBinor, curTang);
|
|
|
|
+ this._normals[i].normalize();
|
|
|
|
+ this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);
|
|
|
|
+ this._binormals[i].normalize();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Path3D.prototype.getCurve = function () {
|
|
|
|
+ return this._curve;
|
|
|
|
+ };
|
|
|
|
+ Path3D.prototype.getTangents = function () {
|
|
|
|
+ return this._tangents;
|
|
|
|
+ };
|
|
|
|
+ Path3D.prototype.getNormals = function () {
|
|
|
|
+ return this._normals;
|
|
|
|
+ };
|
|
|
|
+ Path3D.prototype.getBinormals = function () {
|
|
|
|
+ return this._binormals;
|
|
|
|
+ };
|
|
|
|
+ Path3D.prototype.getDistances = function () {
|
|
|
|
+ return this._distances;
|
|
|
|
+ };
|
|
|
|
+ // private function normalVector(v0, vt) :
|
|
|
|
+ // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane
|
|
|
|
+ Path3D.prototype._normalVector = function (v0, vt) {
|
|
|
|
+ var point;
|
|
|
|
+ if (vt.x !== 1) {
|
|
|
|
+ point = new Vector3(1, 0, 0);
|
|
|
|
+ }
|
|
|
|
+ else if (vt.y !== 1) {
|
|
|
|
+ point = new Vector3(0, 1, 0);
|
|
|
|
+ }
|
|
|
|
+ else if (vt.z !== 1) {
|
|
|
|
+ point = new Vector3(0, 0, 1);
|
|
|
|
+ }
|
|
|
|
+ var normal0 = Vector3.Cross(vt, point);
|
|
|
|
+ normal0.normalize();
|
|
|
|
+ return normal0;
|
|
|
|
+ };
|
|
|
|
+ return Path3D;
|
|
|
|
+ })();
|
|
|
|
+ BABYLON.Path3D = Path3D;
|
|
})(BABYLON || (BABYLON = {}));
|
|
})(BABYLON || (BABYLON = {}));
|
|
//# sourceMappingURL=babylon.math.js.mapvar BABYLON;
|
|
//# sourceMappingURL=babylon.math.js.mapvar BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
@@ -8676,7 +8760,7 @@ var BABYLON;
|
|
this._lastFrameDuration = BABYLON.Tools.Now - startDate;
|
|
this._lastFrameDuration = BABYLON.Tools.Now - startDate;
|
|
};
|
|
};
|
|
Scene.prototype._updateAudioParameters = function () {
|
|
Scene.prototype._updateAudioParameters = function () {
|
|
- if (this.mainSoundTrack.soundCollection.length === 0 || this.soundTracks.length === 0) {
|
|
|
|
|
|
+ if (this.mainSoundTrack.soundCollection.length === 0 && this.soundTracks.length === 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
var listeningCamera;
|
|
var listeningCamera;
|
|
@@ -11025,6 +11109,36 @@ var BABYLON;
|
|
}, scene.database);
|
|
}, scene.database);
|
|
return ground;
|
|
return ground;
|
|
};
|
|
};
|
|
|
|
+ Mesh.CreateTube = function (name, path, radius, tesselation, radiusFunction, scene, updatable, sideOrientation) {
|
|
|
|
+ if (sideOrientation === void 0) { sideOrientation = Mesh.DEFAULTSIDE; }
|
|
|
|
+ var path3D = new BABYLON.Path3D(path);
|
|
|
|
+ var tangents = path3D.getTangents();
|
|
|
|
+ var normals = path3D.getNormals();
|
|
|
|
+ var distances = path3D.getDistances();
|
|
|
|
+ var pi2 = Math.PI * 2;
|
|
|
|
+ var step = pi2 / tesselation;
|
|
|
|
+ var returnRadius = function (i, distance) { return radius; };
|
|
|
|
+ var radiusFunctionFinal = radiusFunction || returnRadius;
|
|
|
|
+ var circlePaths = [];
|
|
|
|
+ var circlePath;
|
|
|
|
+ var rad;
|
|
|
|
+ var normal;
|
|
|
|
+ var rotated;
|
|
|
|
+ var rotationMatrix;
|
|
|
|
+ for (var i = 0; i < path.length; i++) {
|
|
|
|
+ rad = radiusFunctionFinal(i, distances[i]); // current radius
|
|
|
|
+ circlePath = []; // current circle array
|
|
|
|
+ normal = normals[i]; // current normal
|
|
|
|
+ for (var ang = 0; ang < pi2; ang += step) {
|
|
|
|
+ rotationMatrix = BABYLON.Matrix.RotationAxis(tangents[i], ang);
|
|
|
|
+ rotated = BABYLON.Vector3.TransformCoordinates(normal, rotationMatrix).scaleInPlace(rad).add(path[i]);
|
|
|
|
+ circlePath.push(rotated);
|
|
|
|
+ }
|
|
|
|
+ circlePaths.push(circlePath);
|
|
|
|
+ }
|
|
|
|
+ var tube = Mesh.CreateRibbon(name, circlePaths, false, true, 0, scene, updatable, sideOrientation);
|
|
|
|
+ return tube;
|
|
|
|
+ };
|
|
// Tools
|
|
// Tools
|
|
Mesh.MinMax = function (meshes) {
|
|
Mesh.MinMax = function (meshes) {
|
|
var minVector = null;
|
|
var minVector = null;
|
|
@@ -11939,7 +12053,7 @@ var BABYLON;
|
|
this._textureMatrix = BABYLON.Matrix.Identity();
|
|
this._textureMatrix = BABYLON.Matrix.Identity();
|
|
}
|
|
}
|
|
CubeTexture.prototype.clone = function () {
|
|
CubeTexture.prototype.clone = function () {
|
|
- var newTexture = new BABYLON.CubeTexture(this.url, this.getScene(), this._extensions, this._noMipmap);
|
|
|
|
|
|
+ var newTexture = new CubeTexture(this.url, this.getScene(), this._extensions, this._noMipmap);
|
|
// Base texture
|
|
// Base texture
|
|
newTexture.level = this.level;
|
|
newTexture.level = this.level;
|
|
newTexture.wrapU = this.wrapU;
|
|
newTexture.wrapU = this.wrapU;
|
|
@@ -11950,7 +12064,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
// Methods
|
|
// Methods
|
|
CubeTexture.prototype.delayLoad = function () {
|
|
CubeTexture.prototype.delayLoad = function () {
|
|
- if (this.delayLoadState != BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
|
|
|
|
|
|
+ if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
|
|
this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
|
|
@@ -18975,6 +19089,8 @@ var BABYLON;
|
|
};
|
|
};
|
|
// traverse graph per trigger
|
|
// traverse graph per trigger
|
|
var traverse = function (parsedAction, trigger, condition, action) {
|
|
var traverse = function (parsedAction, trigger, condition, action) {
|
|
|
|
+ if (parsedAction.detached)
|
|
|
|
+ return;
|
|
var parameters = new Array();
|
|
var parameters = new Array();
|
|
var target = null;
|
|
var target = null;
|
|
var propertyPath = null;
|
|
var propertyPath = null;
|
|
@@ -24334,6 +24450,26 @@ var BABYLON;
|
|
return _Primitive;
|
|
return _Primitive;
|
|
})(Geometry);
|
|
})(Geometry);
|
|
Primitives._Primitive = _Primitive;
|
|
Primitives._Primitive = _Primitive;
|
|
|
|
+ var Ribbon = (function (_super) {
|
|
|
|
+ __extends(Ribbon, _super);
|
|
|
|
+ function Ribbon(id, scene, pathArray, closeArray, closePath, offset, canBeRegenerated, mesh, side) {
|
|
|
|
+ if (side === void 0) { side = BABYLON.Mesh.DEFAULTSIDE; }
|
|
|
|
+ this.pathArray = pathArray;
|
|
|
|
+ this.closeArray = closeArray;
|
|
|
|
+ this.closePath = closePath;
|
|
|
|
+ this.offset = offset;
|
|
|
|
+ this.side = side;
|
|
|
|
+ _super.call(this, id, scene, this._regenerateVertexData(), canBeRegenerated, mesh);
|
|
|
|
+ }
|
|
|
|
+ Ribbon.prototype._regenerateVertexData = function () {
|
|
|
|
+ return BABYLON.VertexData.CreateRibbon(this.pathArray, this.closeArray, this.closePath, this.offset, this.side);
|
|
|
|
+ };
|
|
|
|
+ Ribbon.prototype.copy = function (id) {
|
|
|
|
+ return new Ribbon(id, this.getScene(), this.pathArray, this.closeArray, this.closePath, this.offset, this.canBeRegenerated(), null, this.side);
|
|
|
|
+ };
|
|
|
|
+ return Ribbon;
|
|
|
|
+ })(_Primitive);
|
|
|
|
+ Primitives.Ribbon = Ribbon;
|
|
var Box = (function (_super) {
|
|
var Box = (function (_super) {
|
|
__extends(Box, _super);
|
|
__extends(Box, _super);
|
|
function Box(id, scene, size, canBeRegenerated, mesh, side) {
|
|
function Box(id, scene, size, canBeRegenerated, mesh, side) {
|
|
@@ -26038,15 +26174,19 @@ var BABYLON;
|
|
else {
|
|
else {
|
|
this._scene.soundTracks[this.soundTrackId].RemoveSound(this);
|
|
this._scene.soundTracks[this.soundTrackId].RemoveSound(this);
|
|
}
|
|
}
|
|
- this._soundGain.disconnect();
|
|
|
|
- this._soundSource.disconnect();
|
|
|
|
|
|
+ if (this._soundGain) {
|
|
|
|
+ this._soundGain.disconnect();
|
|
|
|
+ this._soundGain = null;
|
|
|
|
+ }
|
|
if (this._soundPanner) {
|
|
if (this._soundPanner) {
|
|
this._soundPanner.disconnect();
|
|
this._soundPanner.disconnect();
|
|
this._soundPanner = null;
|
|
this._soundPanner = null;
|
|
}
|
|
}
|
|
|
|
+ if (this._soundSource) {
|
|
|
|
+ this._soundSource.disconnect();
|
|
|
|
+ this._soundSource = null;
|
|
|
|
+ }
|
|
this._audioBuffer = null;
|
|
this._audioBuffer = null;
|
|
- this._soundGain = null;
|
|
|
|
- this._soundSource = null;
|
|
|
|
if (this._connectedMesh) {
|
|
if (this._connectedMesh) {
|
|
this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc);
|
|
this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc);
|
|
this._connectedMesh = null;
|
|
this._connectedMesh = null;
|