|
@@ -19,91 +19,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
BABYLON.ToGammaSpace = 1 / 2.2;
|
|
|
BABYLON.ToLinearSpace = 2.2;
|
|
|
BABYLON.Epsilon = 0.001;
|
|
|
- var MathTools = (function () {
|
|
|
- function MathTools() {
|
|
|
- }
|
|
|
- /**
|
|
|
- * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
|
|
|
- */
|
|
|
- MathTools.WithinEpsilon = function (a, b, epsilon) {
|
|
|
- if (epsilon === void 0) { epsilon = 1.401298E-45; }
|
|
|
- var num = a - b;
|
|
|
- return -epsilon <= num && num <= epsilon;
|
|
|
- };
|
|
|
- /**
|
|
|
- * Returns a string : the upper case translation of the number i to hexadecimal.
|
|
|
- */
|
|
|
- MathTools.ToHex = function (i) {
|
|
|
- var str = i.toString(16);
|
|
|
- if (i <= 15) {
|
|
|
- return ("0" + str).toUpperCase();
|
|
|
- }
|
|
|
- return str.toUpperCase();
|
|
|
- };
|
|
|
- /**
|
|
|
- * Returns -1 if value is negative and +1 is value is positive.
|
|
|
- * Returns the value itself if it's equal to zero.
|
|
|
- */
|
|
|
- MathTools.Sign = function (value) {
|
|
|
- value = +value; // convert to a number
|
|
|
- if (value === 0 || isNaN(value))
|
|
|
- return value;
|
|
|
- return value > 0 ? 1 : -1;
|
|
|
- };
|
|
|
- /**
|
|
|
- * Returns the value itself if it's between min and max.
|
|
|
- * Returns min if the value is lower than min.
|
|
|
- * Returns max if the value is greater than max.
|
|
|
- */
|
|
|
- MathTools.Clamp = function (value, min, max) {
|
|
|
- if (min === void 0) { min = 0; }
|
|
|
- if (max === void 0) { max = 1; }
|
|
|
- return Math.min(max, Math.max(min, value));
|
|
|
- };
|
|
|
- /**
|
|
|
- * Returns the log2 of value.
|
|
|
- */
|
|
|
- MathTools.Log2 = function (value) {
|
|
|
- return Math.log(value) * Math.LOG2E;
|
|
|
- };
|
|
|
- /**
|
|
|
- * Loops the value, so that it is never larger than length and never smaller than 0.
|
|
|
- *
|
|
|
- * This is similar to the modulo operator but it works with floating point numbers.
|
|
|
- * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
|
|
|
- * With t = 5 and length = 2.5, the result would be 0.0.
|
|
|
- * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
|
|
|
- */
|
|
|
- MathTools.Repeat = function (value, length) {
|
|
|
- return value - Math.floor(value / length) * length;
|
|
|
- };
|
|
|
- return MathTools;
|
|
|
- }());
|
|
|
- BABYLON.MathTools = MathTools;
|
|
|
- var Scalar = (function () {
|
|
|
- function Scalar() {
|
|
|
- }
|
|
|
- /**
|
|
|
- * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
|
|
|
- */
|
|
|
- Scalar.Lerp = function (start, end, amount) {
|
|
|
- return start + ((end - start) * amount);
|
|
|
- };
|
|
|
- /**
|
|
|
- * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
|
|
|
- */
|
|
|
- Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {
|
|
|
- var squared = amount * amount;
|
|
|
- var cubed = amount * squared;
|
|
|
- var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;
|
|
|
- var part2 = (-2.0 * cubed) + (3.0 * squared);
|
|
|
- var part3 = (cubed - (2.0 * squared)) + amount;
|
|
|
- var part4 = cubed - squared;
|
|
|
- return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);
|
|
|
- };
|
|
|
- return Scalar;
|
|
|
- }());
|
|
|
- BABYLON.Scalar = Scalar;
|
|
|
var Color3 = (function () {
|
|
|
/**
|
|
|
* Creates a new Color3 object from red, green, blue values, all between 0 and 1.
|
|
@@ -290,7 +205,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
var intR = (this.r * 255) | 0;
|
|
|
var intG = (this.g * 255) | 0;
|
|
|
var intB = (this.b * 255) | 0;
|
|
|
- return "#" + MathTools.ToHex(intR) + MathTools.ToHex(intG) + MathTools.ToHex(intB);
|
|
|
+ return "#" + BABYLON.Scalar.ToHex(intR) + BABYLON.Scalar.ToHex(intG) + BABYLON.Scalar.ToHex(intB);
|
|
|
};
|
|
|
/**
|
|
|
* Returns a new Color3 converted to linear space.
|
|
@@ -552,7 +467,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
var intG = (this.g * 255) | 0;
|
|
|
var intB = (this.b * 255) | 0;
|
|
|
var intA = (this.a * 255) | 0;
|
|
|
- return "#" + MathTools.ToHex(intR) + MathTools.ToHex(intG) + MathTools.ToHex(intB) + MathTools.ToHex(intA);
|
|
|
+ return "#" + BABYLON.Scalar.ToHex(intR) + BABYLON.Scalar.ToHex(intG) + BABYLON.Scalar.ToHex(intB) + BABYLON.Scalar.ToHex(intA);
|
|
|
};
|
|
|
/**
|
|
|
* Returns a new Color4 converted to linear space.
|
|
@@ -858,7 +773,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
*/
|
|
|
Vector2.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
|
|
|
if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
|
|
|
- return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon);
|
|
|
+ return otherVector && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);
|
|
|
};
|
|
|
// Properties
|
|
|
/**
|
|
@@ -1245,7 +1160,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
*/
|
|
|
Vector3.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
|
|
|
if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
|
|
|
- return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon) && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon);
|
|
|
+ return otherVector && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon) && BABYLON.Scalar.WithinEpsilon(this.z, otherVector.z, epsilon);
|
|
|
};
|
|
|
/**
|
|
|
* Boolean : True if the current Vector3 coordinate equal the passed floats.
|
|
@@ -1663,7 +1578,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
source.y = -(source.y / viewportHeight * 2 - 1);
|
|
|
var vector = Vector3.TransformCoordinates(source, matrix);
|
|
|
var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
|
|
|
- if (MathTools.WithinEpsilon(num, 1.0)) {
|
|
|
+ if (BABYLON.Scalar.WithinEpsilon(num, 1.0)) {
|
|
|
vector = vector.scale(1.0 / num);
|
|
|
}
|
|
|
return vector;
|
|
@@ -1676,7 +1591,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
var screenSource = new Vector3(source.x / viewportWidth * 2 - 1, -(source.y / viewportHeight * 2 - 1), 2 * source.z - 1.0);
|
|
|
var vector = Vector3.TransformCoordinates(screenSource, matrix);
|
|
|
var num = screenSource.x * matrix.m[3] + screenSource.y * matrix.m[7] + screenSource.z * matrix.m[11] + matrix.m[15];
|
|
|
- if (MathTools.WithinEpsilon(num, 1.0)) {
|
|
|
+ if (BABYLON.Scalar.WithinEpsilon(num, 1.0)) {
|
|
|
vector = vector.scale(1.0 / num);
|
|
|
}
|
|
|
return vector;
|
|
@@ -1912,10 +1827,10 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
Vector4.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
|
|
|
if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
|
|
|
return otherVector
|
|
|
- && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon)
|
|
|
- && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon)
|
|
|
- && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon)
|
|
|
- && MathTools.WithinEpsilon(this.w, otherVector.w, epsilon);
|
|
|
+ && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon)
|
|
|
+ && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon)
|
|
|
+ && BABYLON.Scalar.WithinEpsilon(this.z, otherVector.z, epsilon)
|
|
|
+ && BABYLON.Scalar.WithinEpsilon(this.w, otherVector.w, epsilon);
|
|
|
};
|
|
|
/**
|
|
|
* Boolean : True if the passed floats are strictly equal to the current Vector4 coordinates.
|
|
@@ -4542,13 +4457,13 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
}
|
|
|
if (va === undefined || va === null) {
|
|
|
var point;
|
|
|
- if (!MathTools.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, BABYLON.Epsilon)) {
|
|
|
+ if (!BABYLON.Scalar.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, BABYLON.Epsilon)) {
|
|
|
point = new Vector3(0.0, -1.0, 0.0);
|
|
|
}
|
|
|
- else if (!MathTools.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, BABYLON.Epsilon)) {
|
|
|
+ else if (!BABYLON.Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, BABYLON.Epsilon)) {
|
|
|
point = new Vector3(1.0, 0.0, 0.0);
|
|
|
}
|
|
|
- else if (!MathTools.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, BABYLON.Epsilon)) {
|
|
|
+ else if (!BABYLON.Scalar.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, BABYLON.Epsilon)) {
|
|
|
point = new Vector3(0.0, 0.0, 1.0);
|
|
|
}
|
|
|
normal0 = Vector3.Cross(vt, point);
|
|
@@ -4751,19 +4666,250 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
|
|
|
//# sourceMappingURL=babylon.math.js.map
|
|
|
|
|
|
+var BABYLON;
|
|
|
+(function (BABYLON) {
|
|
|
+ var Scalar = (function () {
|
|
|
+ function Scalar() {
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
|
|
|
+ */
|
|
|
+ Scalar.WithinEpsilon = function (a, b, epsilon) {
|
|
|
+ if (epsilon === void 0) { epsilon = 1.401298E-45; }
|
|
|
+ var num = a - b;
|
|
|
+ return -epsilon <= num && num <= epsilon;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Returns a string : the upper case translation of the number i to hexadecimal.
|
|
|
+ */
|
|
|
+ Scalar.ToHex = function (i) {
|
|
|
+ var str = i.toString(16);
|
|
|
+ if (i <= 15) {
|
|
|
+ return ("0" + str).toUpperCase();
|
|
|
+ }
|
|
|
+ return str.toUpperCase();
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Returns -1 if value is negative and +1 is value is positive.
|
|
|
+ * Returns the value itself if it's equal to zero.
|
|
|
+ */
|
|
|
+ Scalar.Sign = function (value) {
|
|
|
+ value = +value; // convert to a number
|
|
|
+ if (value === 0 || isNaN(value))
|
|
|
+ return value;
|
|
|
+ return value > 0 ? 1 : -1;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Returns the value itself if it's between min and max.
|
|
|
+ * Returns min if the value is lower than min.
|
|
|
+ * Returns max if the value is greater than max.
|
|
|
+ */
|
|
|
+ Scalar.Clamp = function (value, min, max) {
|
|
|
+ if (min === void 0) { min = 0; }
|
|
|
+ if (max === void 0) { max = 1; }
|
|
|
+ return Math.min(max, Math.max(min, value));
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Returns the log2 of value.
|
|
|
+ */
|
|
|
+ Scalar.Log2 = function (value) {
|
|
|
+ return Math.log(value) * Math.LOG2E;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Loops the value, so that it is never larger than length and never smaller than 0.
|
|
|
+ *
|
|
|
+ * This is similar to the modulo operator but it works with floating point numbers.
|
|
|
+ * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
|
|
|
+ * With t = 5 and length = 2.5, the result would be 0.0.
|
|
|
+ * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
|
|
|
+ */
|
|
|
+ Scalar.Repeat = function (value, length) {
|
|
|
+ return value - Math.floor(value / length) * length;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Normalize the value between 0.0 and 1.0 using min and max values
|
|
|
+ */
|
|
|
+ Scalar.Normalize = function (value, min, max) {
|
|
|
+ return (value - min) / (max - min);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Denormalize the value from 0.0 and 1.0 using min and max values
|
|
|
+ */
|
|
|
+ Scalar.Denormalize = function (normalized, min, max) {
|
|
|
+ return (normalized * (max - min) + min);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Calculates the shortest difference between two given angles given in degrees.
|
|
|
+ */
|
|
|
+ Scalar.DeltaAngle = function (current, target) {
|
|
|
+ var num = Scalar.Repeat(target - current, 360.0);
|
|
|
+ if (num > 180.0) {
|
|
|
+ num -= 360.0;
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * PingPongs the value t, so that it is never larger than length and never smaller than 0.
|
|
|
+ *
|
|
|
+ * The returned value will move back and forth between 0 and length
|
|
|
+ */
|
|
|
+ Scalar.PingPong = function (tx, length) {
|
|
|
+ var t = Scalar.Repeat(tx, length * 2.0);
|
|
|
+ return length - Math.abs(t - length);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Interpolates between min and max with smoothing at the limits.
|
|
|
+ *
|
|
|
+ * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
|
|
|
+ * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
|
|
|
+ */
|
|
|
+ Scalar.SmoothStep = function (from, to, tx) {
|
|
|
+ var t = Scalar.Clamp(tx);
|
|
|
+ t = -2.0 * t * t * t + 3.0 * t * t;
|
|
|
+ return to * t + from * (1.0 - t);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Moves a value current towards target.
|
|
|
+ *
|
|
|
+ * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.
|
|
|
+ * Negative values of maxDelta pushes the value away from target.
|
|
|
+ */
|
|
|
+ Scalar.MoveTowards = function (current, target, maxDelta) {
|
|
|
+ var result = 0;
|
|
|
+ if (Math.abs(target - current) <= maxDelta) {
|
|
|
+ result = target;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ result = current + Scalar.Sign(target - current) * maxDelta;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
|
|
|
+ *
|
|
|
+ * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
|
|
|
+ * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
|
|
|
+ */
|
|
|
+ Scalar.MoveTowardsAngle = function (current, target, maxDelta) {
|
|
|
+ var num = Scalar.DeltaAngle(current, target);
|
|
|
+ var result = 0;
|
|
|
+ if (-maxDelta < num && num < maxDelta) {
|
|
|
+ result = target;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ target = current + num;
|
|
|
+ result = Scalar.MoveTowards(current, target, maxDelta);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
|
|
|
+ */
|
|
|
+ Scalar.Lerp = function (start, end, amount) {
|
|
|
+ return start + ((end - start) * amount);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
|
|
|
+ * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
|
|
|
+ */
|
|
|
+ Scalar.LerpAngle = function (start, end, amount) {
|
|
|
+ var num = Scalar.Repeat(end - start, 360.0);
|
|
|
+ if (num > 180.0) {
|
|
|
+ num -= 360.0;
|
|
|
+ }
|
|
|
+ return start + num * Scalar.Clamp(amount);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Calculates the linear parameter t that produces the interpolant value within the range [a, b].
|
|
|
+ */
|
|
|
+ Scalar.InverseLerp = function (a, b, value) {
|
|
|
+ var result = 0;
|
|
|
+ if (a != b) {
|
|
|
+ result = Scalar.Clamp((value - a) / (b - a));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ result = 0.0;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
|
|
|
+ */
|
|
|
+ Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {
|
|
|
+ var squared = amount * amount;
|
|
|
+ var cubed = amount * squared;
|
|
|
+ var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;
|
|
|
+ var part2 = (-2.0 * cubed) + (3.0 * squared);
|
|
|
+ var part3 = (cubed - (2.0 * squared)) + amount;
|
|
|
+ var part4 = cubed - squared;
|
|
|
+ return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);
|
|
|
+ };
|
|
|
+ return Scalar;
|
|
|
+ }());
|
|
|
+ BABYLON.Scalar = Scalar;
|
|
|
+})(BABYLON || (BABYLON = {}));
|
|
|
+
|
|
|
+//# sourceMappingURL=babylon.math.scalar.js.map
|
|
|
+
|
|
|
|
|
|
|
|
|
//# sourceMappingURL=babylon.mixins.js.map
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ var __decoratorInitialStore = {};
|
|
|
+ var __mergedStore = {};
|
|
|
+ function getDirectStore(target) {
|
|
|
+ var classKey = target.getClassName();
|
|
|
+ if (!__decoratorInitialStore[classKey]) {
|
|
|
+ __decoratorInitialStore[classKey] = {};
|
|
|
+ }
|
|
|
+ return __decoratorInitialStore[classKey];
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * Return the list of properties flagged as serializable
|
|
|
+ * @param target: host object
|
|
|
+ */
|
|
|
+ function getMergedStore(target) {
|
|
|
+ var classKey = target.getClassName();
|
|
|
+ if (__mergedStore[classKey]) {
|
|
|
+ return __mergedStore[classKey];
|
|
|
+ }
|
|
|
+ __mergedStore[classKey] = {};
|
|
|
+ var store = __mergedStore[classKey];
|
|
|
+ var currentTarget = target;
|
|
|
+ var currentKey = classKey;
|
|
|
+ while (currentKey) {
|
|
|
+ var initialStore = __decoratorInitialStore[currentKey];
|
|
|
+ for (var property in initialStore) {
|
|
|
+ store[property] = initialStore[property];
|
|
|
+ }
|
|
|
+ var parent_1 = void 0;
|
|
|
+ var done = false;
|
|
|
+ do {
|
|
|
+ parent_1 = Object.getPrototypeOf(currentTarget);
|
|
|
+ if (!parent_1.getClassName) {
|
|
|
+ done = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (parent_1.getClassName() !== currentKey) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ currentTarget = parent_1;
|
|
|
+ } while (parent_1);
|
|
|
+ if (done) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ currentKey = parent_1.getClassName();
|
|
|
+ currentTarget = parent_1;
|
|
|
+ }
|
|
|
+ return store;
|
|
|
+ }
|
|
|
function generateSerializableMember(type, sourceName) {
|
|
|
return function (target, propertyKey) {
|
|
|
- if (!target.__serializableMembers) {
|
|
|
- target.__serializableMembers = {};
|
|
|
- }
|
|
|
- if (!target.__serializableMembers[propertyKey]) {
|
|
|
- target.__serializableMembers[propertyKey] = { type: type, sourceName: sourceName };
|
|
|
+ var classStore = getDirectStore(target);
|
|
|
+ if (!classStore[propertyKey]) {
|
|
|
+ classStore[propertyKey] = { type: type, sourceName: sourceName };
|
|
|
}
|
|
|
};
|
|
|
}
|
|
@@ -4841,9 +4987,10 @@ var BABYLON;
|
|
|
if (BABYLON.Tags) {
|
|
|
serializationObject.tags = BABYLON.Tags.GetTags(entity);
|
|
|
}
|
|
|
+ var serializedProperties = getMergedStore(entity);
|
|
|
// Properties
|
|
|
- for (var property in entity.__serializableMembers) {
|
|
|
- var propertyDescriptor = entity.__serializableMembers[property];
|
|
|
+ for (var property in serializedProperties) {
|
|
|
+ var propertyDescriptor = serializedProperties[property];
|
|
|
var targetPropertyName = propertyDescriptor.sourceName || property;
|
|
|
var propertyType = propertyDescriptor.type;
|
|
|
var sourceProperty = entity[property];
|
|
@@ -4890,9 +5037,10 @@ var BABYLON;
|
|
|
if (BABYLON.Tags) {
|
|
|
BABYLON.Tags.AddTagsTo(destination, source.tags);
|
|
|
}
|
|
|
+ var classStore = getMergedStore(destination);
|
|
|
// Properties
|
|
|
- for (var property in destination.__serializableMembers) {
|
|
|
- var propertyDescriptor = destination.__serializableMembers[property];
|
|
|
+ for (var property in classStore) {
|
|
|
+ var propertyDescriptor = classStore[property];
|
|
|
var sourceProperty = source[propertyDescriptor.sourceName || property];
|
|
|
var propertyType = propertyDescriptor.type;
|
|
|
if (sourceProperty !== undefined && sourceProperty !== null) {
|
|
@@ -4938,9 +5086,10 @@ var BABYLON;
|
|
|
if (BABYLON.Tags) {
|
|
|
BABYLON.Tags.AddTagsTo(destination, source.tags);
|
|
|
}
|
|
|
+ var classStore = getMergedStore(destination);
|
|
|
// Properties
|
|
|
- for (var property in destination.__serializableMembers) {
|
|
|
- var propertyDescriptor = destination.__serializableMembers[property];
|
|
|
+ for (var property in classStore) {
|
|
|
+ var propertyDescriptor = classStore[property];
|
|
|
var sourceProperty = source[property];
|
|
|
var propertyType = propertyDescriptor.type;
|
|
|
if (sourceProperty !== undefined && sourceProperty !== null) {
|
|
@@ -6209,7 +6358,7 @@ var BABYLON;
|
|
|
* @param object the object to get the class name from
|
|
|
* @return the name of the class, will be "object" for a custom data type not using the @className decorator
|
|
|
*/
|
|
|
- Tools.getClassName = function (object, isType) {
|
|
|
+ Tools.GetClassName = function (object, isType) {
|
|
|
if (isType === void 0) { isType = false; }
|
|
|
var name = null;
|
|
|
if (!isType && object.getClassName) {
|
|
@@ -7926,6 +8075,13 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(Engine.prototype, "performanceMonitor", {
|
|
|
+ get: function () {
|
|
|
+ return this._performanceMonitor;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(Engine.prototype, "texturesSupported", {
|
|
|
get: function () {
|
|
|
return this._texturesSupported;
|
|
@@ -9855,7 +10011,7 @@ var BABYLON;
|
|
|
var smoothness = i / (mipSlices - 1);
|
|
|
var roughness = 1 - smoothness;
|
|
|
var minLODIndex = offset; // roughness = 0
|
|
|
- var maxLODIndex = BABYLON.MathTools.Log2(width) * scale + offset; // roughness = 1
|
|
|
+ var maxLODIndex = BABYLON.Scalar.Log2(width) * scale + offset; // roughness = 1
|
|
|
var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;
|
|
|
var mipmapIndex = Math.min(Math.max(Math.round(lodIndex), 0), maxLODIndex);
|
|
|
var glTextureFromLod = gl.createTexture();
|
|
@@ -19239,6 +19395,9 @@ var BABYLON;
|
|
|
BaseTexture.prototype.toString = function () {
|
|
|
return this.name;
|
|
|
};
|
|
|
+ BaseTexture.prototype.getClassName = function () {
|
|
|
+ return "BaseTexture";
|
|
|
+ };
|
|
|
Object.defineProperty(BaseTexture.prototype, "onDispose", {
|
|
|
set: function (callback) {
|
|
|
if (this._onDisposeObserver) {
|
|
@@ -19791,6 +19950,9 @@ var BABYLON;
|
|
|
}
|
|
|
return serializationObject;
|
|
|
};
|
|
|
+ Texture.prototype.getClassName = function () {
|
|
|
+ return "Texture";
|
|
|
+ };
|
|
|
// Statics
|
|
|
Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError, format) {
|
|
|
if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
|
|
@@ -20545,7 +20707,7 @@ var BABYLON;
|
|
|
this._updateBoundingInfo();
|
|
|
return this;
|
|
|
};
|
|
|
- Mesh.prototype._createGlobalSubMesh = function () {
|
|
|
+ Mesh.prototype._createGlobalSubMesh = function (force) {
|
|
|
var totalVertices = this.getTotalVertices();
|
|
|
if (!totalVertices || !this.getIndices()) {
|
|
|
return null;
|
|
@@ -20554,15 +20716,20 @@ var BABYLON;
|
|
|
if (this.subMeshes && this.subMeshes.length > 0) {
|
|
|
var totalIndices = this.getIndices().length;
|
|
|
var needToRecreate = false;
|
|
|
- for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
|
|
|
- var submesh = _a[_i];
|
|
|
- if (submesh.indexStart + submesh.indexCount >= totalIndices) {
|
|
|
- needToRecreate = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
|
|
|
- needToRecreate = true;
|
|
|
- break;
|
|
|
+ if (force) {
|
|
|
+ needToRecreate = true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
|
|
|
+ var submesh = _a[_i];
|
|
|
+ if (submesh.indexStart + submesh.indexCount >= totalIndices) {
|
|
|
+ needToRecreate = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
|
|
|
+ needToRecreate = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (!needToRecreate) {
|
|
@@ -26760,15 +26927,15 @@ var BABYLON;
|
|
|
var face = 0;
|
|
|
for (var index = 0; index < normals.length; index += 3) {
|
|
|
//Edge Face no. 1
|
|
|
- if (Math.abs(normals[index + 1]) == 0) {
|
|
|
+ if (Math.abs(normals[index + 1]) < 0.001) {
|
|
|
face = 1;
|
|
|
}
|
|
|
//Top Face no. 0
|
|
|
- if (normals[index + 1] == 1) {
|
|
|
+ if (Math.abs(normals[index + 1] - 1) < 0.001) {
|
|
|
face = 0;
|
|
|
}
|
|
|
//Bottom Face no. 2
|
|
|
- if (normals[index + 1] == -1) {
|
|
|
+ if (Math.abs(normals[index + 1] + 1) < 0.001) {
|
|
|
face = 2;
|
|
|
}
|
|
|
idx = index / 3;
|
|
@@ -27660,7 +27827,7 @@ var BABYLON;
|
|
|
for (var index = 0; index < numOfMeshes; index++) {
|
|
|
var mesh = meshes[index];
|
|
|
mesh._boundingInfo = new BABYLON.BoundingInfo(this._extend.minimum, this._extend.maximum);
|
|
|
- mesh._createGlobalSubMesh();
|
|
|
+ mesh._createGlobalSubMesh(false);
|
|
|
mesh.computeWorldMatrix(true);
|
|
|
}
|
|
|
}
|
|
@@ -27799,7 +27966,7 @@ var BABYLON;
|
|
|
var meshes = this._meshes;
|
|
|
var numOfMeshes = meshes.length;
|
|
|
for (var index = 0; index < numOfMeshes; index++) {
|
|
|
- meshes[index]._createGlobalSubMesh();
|
|
|
+ meshes[index]._createGlobalSubMesh(true);
|
|
|
}
|
|
|
this.notifyUpdate();
|
|
|
};
|
|
@@ -27895,7 +28062,7 @@ var BABYLON;
|
|
|
this.updateExtend(this._vertexBuffers[kind].getData());
|
|
|
}
|
|
|
mesh._boundingInfo = new BABYLON.BoundingInfo(this._extend.minimum, this._extend.maximum);
|
|
|
- mesh._createGlobalSubMesh();
|
|
|
+ mesh._createGlobalSubMesh(false);
|
|
|
//bounding info was just created again, world matrix should be applied again.
|
|
|
mesh._updateBoundingInfo();
|
|
|
}
|
|
@@ -30357,7 +30524,7 @@ var BABYLON;
|
|
|
CameraInputsManager.prototype.removeByType = function (inputType) {
|
|
|
for (var cam in this.attached) {
|
|
|
var input = this.attached[cam];
|
|
|
- if (input.getTypeName() === inputType) {
|
|
|
+ if (input.getClassName() === inputType) {
|
|
|
input.detachControl(this.attachedElement);
|
|
|
delete this.attached[cam];
|
|
|
this.rebuildInputCheck();
|
|
@@ -30418,7 +30585,7 @@ var BABYLON;
|
|
|
for (var cam in this.attached) {
|
|
|
var input = this.attached[cam];
|
|
|
var res = BABYLON.SerializationHelper.Serialize(input);
|
|
|
- inputs[input.getTypeName()] = res;
|
|
|
+ inputs[input.getClassName()] = res;
|
|
|
}
|
|
|
serializedCamera.inputsmgr = inputs;
|
|
|
};
|
|
@@ -30438,7 +30605,7 @@ var BABYLON;
|
|
|
else {
|
|
|
//2016-03-08 this part is for managing backward compatibility
|
|
|
for (var n in this.attached) {
|
|
|
- var construct = BABYLON.CameraInputTypes[this.attached[n].getTypeName()];
|
|
|
+ var construct = BABYLON.CameraInputTypes[this.attached[n].getClassName()];
|
|
|
if (construct) {
|
|
|
var input = BABYLON.SerializationHelper.Parse(function () { return new construct(); }, parsedCamera, null);
|
|
|
this.remove(this.attached[n]);
|
|
@@ -30834,7 +31001,7 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- ArcRotateCameraKeyboardMoveInput.prototype.getTypeName = function () {
|
|
|
+ ArcRotateCameraKeyboardMoveInput.prototype.getClassName = function () {
|
|
|
return "ArcRotateCameraKeyboardMoveInput";
|
|
|
};
|
|
|
ArcRotateCameraKeyboardMoveInput.prototype.getSimpleName = function () {
|
|
@@ -30898,7 +31065,7 @@ var BABYLON;
|
|
|
this._wheel = null;
|
|
|
}
|
|
|
};
|
|
|
- ArcRotateCameraMouseWheelInput.prototype.getTypeName = function () {
|
|
|
+ ArcRotateCameraMouseWheelInput.prototype.getClassName = function () {
|
|
|
return "ArcRotateCameraMouseWheelInput";
|
|
|
};
|
|
|
ArcRotateCameraMouseWheelInput.prototype.getSimpleName = function () {
|
|
@@ -31099,7 +31266,7 @@ var BABYLON;
|
|
|
{ name: "blur", handler: this._onLostFocus }
|
|
|
]);
|
|
|
};
|
|
|
- ArcRotateCameraPointersInput.prototype.getTypeName = function () {
|
|
|
+ ArcRotateCameraPointersInput.prototype.getClassName = function () {
|
|
|
return "ArcRotateCameraPointersInput";
|
|
|
};
|
|
|
ArcRotateCameraPointersInput.prototype.getSimpleName = function () {
|
|
@@ -33445,14 +33612,14 @@ var BABYLON;
|
|
|
for (var y = 0; y < height; y++) {
|
|
|
for (var x = 0; x < width; x++) {
|
|
|
var srcPos = (x + y * width) * 4;
|
|
|
- destArray[index] = BABYLON.MathTools.Clamp(srcData[srcPos]) * 255;
|
|
|
- destArray[index + 1] = BABYLON.MathTools.Clamp(srcData[srcPos + 1]) * 255;
|
|
|
- destArray[index + 2] = BABYLON.MathTools.Clamp(srcData[srcPos + 2]) * 255;
|
|
|
+ destArray[index] = BABYLON.Scalar.Clamp(srcData[srcPos]) * 255;
|
|
|
+ destArray[index + 1] = BABYLON.Scalar.Clamp(srcData[srcPos + 1]) * 255;
|
|
|
+ destArray[index + 2] = BABYLON.Scalar.Clamp(srcData[srcPos + 2]) * 255;
|
|
|
if (DDSTools.StoreLODInAlphaChannel) {
|
|
|
destArray[index + 3] = lod;
|
|
|
}
|
|
|
else {
|
|
|
- destArray[index + 3] = BABYLON.MathTools.Clamp(srcData[srcPos + 3]) * 255;
|
|
|
+ destArray[index + 3] = BABYLON.Scalar.Clamp(srcData[srcPos + 3]) * 255;
|
|
|
}
|
|
|
index += 4;
|
|
|
}
|
|
@@ -33466,14 +33633,14 @@ var BABYLON;
|
|
|
for (var y = 0; y < height; y++) {
|
|
|
for (var x = 0; x < width; x++) {
|
|
|
var srcPos = (x + y * width) * 4;
|
|
|
- destArray[index] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos])) * 255;
|
|
|
- destArray[index + 1] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 1])) * 255;
|
|
|
- destArray[index + 2] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 2])) * 255;
|
|
|
+ destArray[index] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos])) * 255;
|
|
|
+ destArray[index + 1] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 1])) * 255;
|
|
|
+ destArray[index + 2] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 2])) * 255;
|
|
|
if (DDSTools.StoreLODInAlphaChannel) {
|
|
|
destArray[index + 3] = lod;
|
|
|
}
|
|
|
else {
|
|
|
- destArray[index + 3] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 3])) * 255;
|
|
|
+ destArray[index + 3] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 3])) * 255;
|
|
|
}
|
|
|
index += 4;
|
|
|
}
|
|
@@ -36006,6 +36173,9 @@ var BABYLON;
|
|
|
_this._markAllSubMeshesAsImageProcessingDirty();
|
|
|
});
|
|
|
};
|
|
|
+ PBRBaseMaterial.prototype.getClassName = function () {
|
|
|
+ return "PBRBaseMaterial";
|
|
|
+ };
|
|
|
Object.defineProperty(PBRBaseMaterial.prototype, "useLogarithmicDepth", {
|
|
|
get: function () {
|
|
|
return this._useLogarithmicDepth;
|
|
@@ -36924,6 +37094,9 @@ var BABYLON;
|
|
|
}
|
|
|
return activeTextures;
|
|
|
};
|
|
|
+ PBRBaseSimpleMaterial.prototype.getClassName = function () {
|
|
|
+ return "PBRBaseSimpleMaterial";
|
|
|
+ };
|
|
|
return PBRBaseSimpleMaterial;
|
|
|
}(BABYLON.PBRBaseMaterial));
|
|
|
__decorate([
|
|
@@ -40236,6 +40409,9 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ ImageProcessingPostProcess.prototype.getClassName = function () {
|
|
|
+ return "ImageProcessingPostProcess";
|
|
|
+ };
|
|
|
ImageProcessingPostProcess.prototype._updateParameters = function () {
|
|
|
this._defines.FROMLINEARSPACE = this._fromLinearSpace;
|
|
|
this.imageProcessingConfiguration.prepareDefines(this._defines);
|
|
@@ -40784,6 +40960,9 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ ColorCurves.prototype.getClassName = function () {
|
|
|
+ return "ColorCurves";
|
|
|
+ };
|
|
|
/**
|
|
|
* Binds the color curves to the shader.
|
|
|
* @param colorCurves The color curve to bind
|
|
@@ -41284,6 +41463,9 @@ var BABYLON;
|
|
|
this._renderEffectsForIsolatedPass = new Array();
|
|
|
this._cameras = [];
|
|
|
}
|
|
|
+ PostProcessRenderPipeline.prototype.getClassName = function () {
|
|
|
+ return "PostProcessRenderPipeline";
|
|
|
+ };
|
|
|
Object.defineProperty(PostProcessRenderPipeline.prototype, "isSupported", {
|
|
|
get: function () {
|
|
|
for (var renderEffectName in this._renderEffects) {
|
|
@@ -41980,6 +42162,9 @@ var BABYLON;
|
|
|
ImageProcessingConfiguration.prototype._updateParameters = function () {
|
|
|
this.onUpdateParameters.notifyObservers(this);
|
|
|
};
|
|
|
+ ImageProcessingConfiguration.prototype.getClassName = function () {
|
|
|
+ return "ImageProcessingConfiguration";
|
|
|
+ };
|
|
|
/**
|
|
|
* Prepare the list of uniforms associated with the Image Processing effects.
|
|
|
* @param uniformsList The list of uniforms used in the effect
|
|
@@ -46965,9 +47150,9 @@ var BABYLON;
|
|
|
}
|
|
|
// Handle Gamma space textures.
|
|
|
if (cubeInfo.gammaSpace) {
|
|
|
- r = Math.pow(BABYLON.MathTools.Clamp(r), BABYLON.ToLinearSpace);
|
|
|
- g = Math.pow(BABYLON.MathTools.Clamp(g), BABYLON.ToLinearSpace);
|
|
|
- b = Math.pow(BABYLON.MathTools.Clamp(b), BABYLON.ToLinearSpace);
|
|
|
+ r = Math.pow(BABYLON.Scalar.Clamp(r), BABYLON.ToLinearSpace);
|
|
|
+ g = Math.pow(BABYLON.Scalar.Clamp(g), BABYLON.ToLinearSpace);
|
|
|
+ b = Math.pow(BABYLON.Scalar.Clamp(b), BABYLON.ToLinearSpace);
|
|
|
}
|
|
|
var color = new BABYLON.Color3(r, g, b);
|
|
|
sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);
|
|
@@ -49012,6 +49197,9 @@ var BABYLON;
|
|
|
serializationObject.customType = "BABYLON.GridMaterial";
|
|
|
return serializationObject;
|
|
|
};
|
|
|
+ GridMaterial.prototype.getClassName = function () {
|
|
|
+ return "GridMaterial";
|
|
|
+ };
|
|
|
GridMaterial.Parse = function (source, scene, rootUrl) {
|
|
|
return BABYLON.SerializationHelper.Parse(function () { return new GridMaterial(source.name, scene); }, source, scene, rootUrl);
|
|
|
};
|