|
@@ -16608,7 +16608,7 @@ var BABYLON;
|
|
|
_this._rotation = BABYLON.Vector3.Zero();
|
|
|
_this._scaling = BABYLON.Vector3.One();
|
|
|
_this._isDirty = false;
|
|
|
- _this.billboardMode = BABYLON.AbstractMesh.BILLBOARDMODE_NONE;
|
|
|
+ _this.billboardMode = TransformNode.BILLBOARDMODE_NONE;
|
|
|
_this.scalingDeterminant = 1;
|
|
|
_this.infiniteDistance = false;
|
|
|
_this.position = BABYLON.Vector3.Zero();
|
|
@@ -16748,7 +16748,7 @@ var BABYLON;
|
|
|
});
|
|
|
/**
|
|
|
* Copies the paramater passed Matrix into the mesh Pose matrix.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.updatePoseMatrix = function (matrix) {
|
|
|
this._poseMatrix.copyFrom(matrix);
|
|
@@ -16765,7 +16765,7 @@ var BABYLON;
|
|
|
if (this._isDirty) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (this.billboardMode !== this._cache.billboardMode || this.billboardMode !== BABYLON.AbstractMesh.BILLBOARDMODE_NONE)
|
|
|
+ if (this.billboardMode !== this._cache.billboardMode || this.billboardMode !== TransformNode.BILLBOARDMODE_NONE)
|
|
|
return false;
|
|
|
if (this._cache.pivotMatrixUpdated) {
|
|
|
return false;
|
|
@@ -16852,7 +16852,7 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Prevents the World matrix to be computed any longer.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.freezeWorldMatrix = function () {
|
|
|
this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily
|
|
@@ -16862,7 +16862,7 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Allows back the World matrix computation.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.unfreezeWorldMatrix = function () {
|
|
|
this._isWorldMatrixFrozen = false;
|
|
@@ -16890,7 +16890,7 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Sets the mesh absolute position in the World from a Vector3 or an Array(3).
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.setAbsolutePosition = function (absolutePosition) {
|
|
|
if (!absolutePosition) {
|
|
@@ -16927,7 +16927,7 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Sets the mesh position in its local space.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.setPositionWithLocalVector = function (vector3) {
|
|
|
this.computeWorldMatrix();
|
|
@@ -16946,7 +16946,7 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Translates the mesh along the passed Vector3 in its local space.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.locallyTranslate = function (vector3) {
|
|
|
this.computeWorldMatrix(true);
|
|
@@ -16967,7 +16967,7 @@ var BABYLON;
|
|
|
if (pitchCor === void 0) { pitchCor = 0; }
|
|
|
if (rollCor === void 0) { rollCor = 0; }
|
|
|
if (space === void 0) { space = BABYLON.Space.LOCAL; }
|
|
|
- var dv = BABYLON.AbstractMesh._lookAtVectorCache;
|
|
|
+ var dv = TransformNode._lookAtVectorCache;
|
|
|
var pos = space === BABYLON.Space.LOCAL ? this.position : this.getAbsolutePosition();
|
|
|
targetPoint.subtractToRef(pos, dv);
|
|
|
var yaw = -Math.atan2(dv.z, dv.x) - Math.PI / 2;
|
|
@@ -16996,7 +16996,7 @@ var BABYLON;
|
|
|
* Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
|
|
|
* localAxis is expressed in the mesh local space.
|
|
|
* result is computed in the Wordl space from the mesh World matrix.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.getDirectionToRef = function (localAxis, result) {
|
|
|
BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
|
|
@@ -17031,7 +17031,7 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.getPivotPointToRef = function (result) {
|
|
|
result.x = -this._pivotMatrix.m[12];
|
|
@@ -17049,7 +17049,7 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.getAbsolutePivotPointToRef = function (result) {
|
|
|
result.x = this._pivotMatrix.m[12];
|
|
@@ -17157,7 +17157,7 @@ var BABYLON;
|
|
|
* space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
|
|
|
* Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
|
|
|
* The passed axis is also normalized.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.rotate = function (axis, amount, space) {
|
|
|
axis.normalize();
|
|
@@ -17167,7 +17167,7 @@ var BABYLON;
|
|
|
}
|
|
|
var rotationQuaternion;
|
|
|
if (!space || space === BABYLON.Space.LOCAL) {
|
|
|
- rotationQuaternion = BABYLON.Quaternion.RotationAxisToRef(axis, amount, BABYLON.AbstractMesh._rotationAxisCache);
|
|
|
+ rotationQuaternion = BABYLON.Quaternion.RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);
|
|
|
this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);
|
|
|
}
|
|
|
else {
|
|
@@ -17176,7 +17176,7 @@ var BABYLON;
|
|
|
invertParentWorldMatrix.invert();
|
|
|
axis = BABYLON.Vector3.TransformNormal(axis, invertParentWorldMatrix);
|
|
|
}
|
|
|
- rotationQuaternion = BABYLON.Quaternion.RotationAxisToRef(axis, amount, BABYLON.AbstractMesh._rotationAxisCache);
|
|
|
+ rotationQuaternion = BABYLON.Quaternion.RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);
|
|
|
rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
|
|
|
}
|
|
|
return this;
|
|
@@ -17185,7 +17185,7 @@ var BABYLON;
|
|
|
* Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.
|
|
|
* Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
|
|
|
* The passed axis is also normalized.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
* Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm
|
|
|
*/
|
|
|
TransformNode.prototype.rotateAround = function (point, axis, amount) {
|
|
@@ -17208,7 +17208,7 @@ var BABYLON;
|
|
|
/**
|
|
|
* Translates the mesh along the axis vector for the passed distance in the given space.
|
|
|
* space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.translate = function (axis, distance, space) {
|
|
|
var displacementVector = axis.scale(distance);
|
|
@@ -17233,7 +17233,7 @@ var BABYLON;
|
|
|
* ```
|
|
|
* Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
|
|
|
* Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.
|
|
|
- * Returns the AbstractMesh.
|
|
|
+ * Returns the TransformNode.
|
|
|
*/
|
|
|
TransformNode.prototype.addRotation = function (x, y, z) {
|
|
|
var rotationQuaternion;
|
|
@@ -17307,8 +17307,8 @@ var BABYLON;
|
|
|
this._pivotMatrix.multiplyToRef(BABYLON.Tmp.Matrix[1], BABYLON.Tmp.Matrix[4]);
|
|
|
BABYLON.Tmp.Matrix[4].multiplyToRef(BABYLON.Tmp.Matrix[0], BABYLON.Tmp.Matrix[5]);
|
|
|
// Billboarding (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)
|
|
|
- if (this.billboardMode !== BABYLON.AbstractMesh.BILLBOARDMODE_NONE && camera) {
|
|
|
- if ((this.billboardMode & BABYLON.AbstractMesh.BILLBOARDMODE_ALL) !== BABYLON.AbstractMesh.BILLBOARDMODE_ALL) {
|
|
|
+ if (this.billboardMode !== TransformNode.BILLBOARDMODE_NONE && camera) {
|
|
|
+ if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {
|
|
|
// Need to decompose each rotation here
|
|
|
var currentPosition = BABYLON.Tmp.Vector3[3];
|
|
|
if (this.parent && this.parent.getWorldMatrix) {
|
|
@@ -17325,13 +17325,13 @@ var BABYLON;
|
|
|
}
|
|
|
currentPosition.subtractInPlace(camera.globalPosition);
|
|
|
var finalEuler = BABYLON.Tmp.Vector3[4].copyFromFloats(0, 0, 0);
|
|
|
- if ((this.billboardMode & BABYLON.AbstractMesh.BILLBOARDMODE_X) === BABYLON.AbstractMesh.BILLBOARDMODE_X) {
|
|
|
+ if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) === TransformNode.BILLBOARDMODE_X) {
|
|
|
finalEuler.x = Math.atan2(-currentPosition.y, currentPosition.z);
|
|
|
}
|
|
|
- if ((this.billboardMode & BABYLON.AbstractMesh.BILLBOARDMODE_Y) === BABYLON.AbstractMesh.BILLBOARDMODE_Y) {
|
|
|
+ if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) === TransformNode.BILLBOARDMODE_Y) {
|
|
|
finalEuler.y = Math.atan2(currentPosition.x, currentPosition.z);
|
|
|
}
|
|
|
- if ((this.billboardMode & BABYLON.AbstractMesh.BILLBOARDMODE_Z) === BABYLON.AbstractMesh.BILLBOARDMODE_Z) {
|
|
|
+ if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) === TransformNode.BILLBOARDMODE_Z) {
|
|
|
finalEuler.z = Math.atan2(currentPosition.y, currentPosition.x);
|
|
|
}
|
|
|
BABYLON.Matrix.RotationYawPitchRollToRef(finalEuler.y, finalEuler.x, finalEuler.z, BABYLON.Tmp.Matrix[0]);
|
|
@@ -17348,7 +17348,7 @@ var BABYLON;
|
|
|
BABYLON.Tmp.Matrix[5].multiplyToRef(BABYLON.Tmp.Matrix[2], this._localWorld);
|
|
|
// Parent
|
|
|
if (this.parent && this.parent.getWorldMatrix) {
|
|
|
- if (this.billboardMode !== BABYLON.AbstractMesh.BILLBOARDMODE_NONE) {
|
|
|
+ if (this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {
|
|
|
if (this._transformToBoneReferal) {
|
|
|
this.parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), BABYLON.Tmp.Matrix[6]);
|
|
|
BABYLON.Tmp.Matrix[5].copyFrom(BABYLON.Tmp.Matrix[6]);
|
|
@@ -31790,6 +31790,21 @@ var BABYLON;
|
|
|
},
|
|
|
/**
|
|
|
* Sets the value of the alpha mode.
|
|
|
+ *
|
|
|
+ * | Value | Type | Description |
|
|
|
+ * | --- | --- | --- |
|
|
|
+ * | 0 | ALPHA_DISABLE | |
|
|
|
+ * | 1 | ALPHA_ADD | |
|
|
|
+ * | 2 | ALPHA_COMBINE | |
|
|
|
+ * | 3 | ALPHA_SUBTRACT | |
|
|
|
+ * | 4 | ALPHA_MULTIPLY | |
|
|
|
+ * | 5 | ALPHA_MAXIMIZED | |
|
|
|
+ * | 6 | ALPHA_ONEONE | |
|
|
|
+ * | 7 | ALPHA_PREMULTIPLIED | |
|
|
|
+ * | 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |
|
|
|
+ * | 9 | ALPHA_INTERPOLATE | |
|
|
|
+ * | 10 | ALPHA_SCREENMODE | |
|
|
|
+ *
|
|
|
*/
|
|
|
set: function (value) {
|
|
|
if (this._alphaMode === value) {
|
|
@@ -44817,7 +44832,18 @@ var BABYLON;
|
|
|
var event = p.event;
|
|
|
var delta = 0;
|
|
|
if (event.wheelDelta) {
|
|
|
- delta = _this.wheelDeltaPercentage ? (event.wheelDelta * 0.01) * _this.camera.radius * _this.wheelDeltaPercentage : event.wheelDelta / (_this.wheelPrecision * 40);
|
|
|
+ if (_this.wheelDeltaPercentage) {
|
|
|
+ var wheelDelta = (event.wheelDelta * 0.01 * _this.wheelDeltaPercentage) * _this.camera.radius;
|
|
|
+ if (event.wheelDelta > 0) {
|
|
|
+ delta = wheelDelta / (1.0 + _this.wheelDeltaPercentage);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ delta = wheelDelta * (1.0 + _this.wheelDeltaPercentage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ delta = event.wheelDelta / (_this.wheelPrecision * 40);
|
|
|
+ }
|
|
|
}
|
|
|
else if (event.detail) {
|
|
|
delta = -event.detail / _this.wheelPrecision;
|
|
@@ -49009,21 +49035,46 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /**
|
|
|
+ * A Condition applied to an Action
|
|
|
+ */
|
|
|
var Condition = /** @class */ (function () {
|
|
|
+ /**
|
|
|
+ * Creates a new Condition
|
|
|
+ * @param actionManager the manager of the action the condition is applied to
|
|
|
+ */
|
|
|
function Condition(actionManager) {
|
|
|
this._actionManager = actionManager;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Check if the current condition is valid
|
|
|
+ */
|
|
|
Condition.prototype.isValid = function () {
|
|
|
return true;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Condition.prototype._getProperty = function (propertyPath) {
|
|
|
return this._actionManager._getProperty(propertyPath);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Condition.prototype._getEffectiveTarget = function (target, propertyPath) {
|
|
|
return this._actionManager._getEffectiveTarget(target, propertyPath);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Serialize placeholder for child classes
|
|
|
+ */
|
|
|
Condition.prototype.serialize = function () {
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Condition.prototype._serialize = function (serializedCondition) {
|
|
|
return {
|
|
|
type: 2,
|
|
@@ -49035,8 +49086,19 @@ var BABYLON;
|
|
|
return Condition;
|
|
|
}());
|
|
|
BABYLON.Condition = Condition;
|
|
|
+ /**
|
|
|
+ * Defines specific conditional operators as extensions of Condition
|
|
|
+ */
|
|
|
var ValueCondition = /** @class */ (function (_super) {
|
|
|
__extends(ValueCondition, _super);
|
|
|
+ /**
|
|
|
+ * Creates a new ValueCondition
|
|
|
+ * @param actionManager manager for the action the condition applies to
|
|
|
+ * @param target for the action
|
|
|
+ * @param propertyPath path to specify the property of the target the conditional operator uses
|
|
|
+ * @param value the vale compared by the conditional operator against the current value of the property
|
|
|
+ * @param operator the conditional operator, default {BABYLON.ValueCondition.IsEqual}
|
|
|
+ */
|
|
|
function ValueCondition(actionManager, target, propertyPath, value, operator) {
|
|
|
if (operator === void 0) { operator = ValueCondition.IsEqual; }
|
|
|
var _this = _super.call(this, actionManager) || this;
|
|
@@ -49049,6 +49111,9 @@ var BABYLON;
|
|
|
return _this;
|
|
|
}
|
|
|
Object.defineProperty(ValueCondition, "IsEqual", {
|
|
|
+ /**
|
|
|
+ * @returns the number for IsEqual
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return ValueCondition._IsEqual;
|
|
|
},
|
|
@@ -49056,6 +49121,9 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(ValueCondition, "IsDifferent", {
|
|
|
+ /**
|
|
|
+ * @returns the number for IsDifferent
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return ValueCondition._IsDifferent;
|
|
|
},
|
|
@@ -49063,6 +49131,9 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(ValueCondition, "IsGreater", {
|
|
|
+ /**
|
|
|
+ * @returns the number for IsGreater
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return ValueCondition._IsGreater;
|
|
|
},
|
|
@@ -49070,13 +49141,19 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(ValueCondition, "IsLesser", {
|
|
|
+ /**
|
|
|
+ * @returns the number for IsLesser
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return ValueCondition._IsLesser;
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
- // Methods
|
|
|
+ /**
|
|
|
+ * Compares the given value with the property value for the specified conditional operator
|
|
|
+ * @returns the result of the comparison
|
|
|
+ */
|
|
|
ValueCondition.prototype.isValid = function () {
|
|
|
switch (this.operator) {
|
|
|
case ValueCondition.IsGreater:
|
|
@@ -49096,6 +49173,10 @@ var BABYLON;
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Serialize the ValueCondition into a JSON compatible object
|
|
|
+ * @returns serialization object
|
|
|
+ */
|
|
|
ValueCondition.prototype.serialize = function () {
|
|
|
return this._serialize({
|
|
|
name: "ValueCondition",
|
|
@@ -49107,6 +49188,11 @@ var BABYLON;
|
|
|
]
|
|
|
});
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the name of the conditional operator for the ValueCondition
|
|
|
+ * @param operator the conditional operator
|
|
|
+ * @returns the name
|
|
|
+ */
|
|
|
ValueCondition.GetOperatorName = function (operator) {
|
|
|
switch (operator) {
|
|
|
case ValueCondition._IsEqual: return "IsEqual";
|
|
@@ -49116,39 +49202,80 @@ var BABYLON;
|
|
|
default: return "";
|
|
|
}
|
|
|
};
|
|
|
- // Statics
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
ValueCondition._IsEqual = 0;
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
ValueCondition._IsDifferent = 1;
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
ValueCondition._IsGreater = 2;
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
ValueCondition._IsLesser = 3;
|
|
|
return ValueCondition;
|
|
|
}(Condition));
|
|
|
BABYLON.ValueCondition = ValueCondition;
|
|
|
+ /**
|
|
|
+ * Defines a predicate condition as an extension of Condition
|
|
|
+ */
|
|
|
var PredicateCondition = /** @class */ (function (_super) {
|
|
|
__extends(PredicateCondition, _super);
|
|
|
+ /**
|
|
|
+ * Creates a new {BABYLON.PredicateCondition}
|
|
|
+ * @param actionManager manager for the action the condition applies to
|
|
|
+ * @param predicate
|
|
|
+ */
|
|
|
function PredicateCondition(actionManager, predicate) {
|
|
|
var _this = _super.call(this, actionManager) || this;
|
|
|
_this.predicate = predicate;
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @returns the validity of the predicate condition
|
|
|
+ */
|
|
|
PredicateCondition.prototype.isValid = function () {
|
|
|
return this.predicate();
|
|
|
};
|
|
|
return PredicateCondition;
|
|
|
}(Condition));
|
|
|
BABYLON.PredicateCondition = PredicateCondition;
|
|
|
+ /**
|
|
|
+ * Defines a state condition as an extension of {BABYLON.Condition}
|
|
|
+ */
|
|
|
var StateCondition = /** @class */ (function (_super) {
|
|
|
__extends(StateCondition, _super);
|
|
|
+ /**
|
|
|
+ * Creates a new {BABYLON.StateCondition}
|
|
|
+ * @param actionManager manager for the action the condition applies to
|
|
|
+ * @param target of the condition
|
|
|
+ * @param value to compare with target state
|
|
|
+ */
|
|
|
function StateCondition(actionManager, target, value) {
|
|
|
var _this = _super.call(this, actionManager) || this;
|
|
|
_this.value = value;
|
|
|
_this._target = target;
|
|
|
return _this;
|
|
|
}
|
|
|
- // Methods
|
|
|
+ /**
|
|
|
+ * @returns the validity of the state
|
|
|
+ */
|
|
|
StateCondition.prototype.isValid = function () {
|
|
|
return this._target.state === this.value;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Serialize the {BABYLON.StateCondition} into a JSON compatible object
|
|
|
+ * @returns serialization object
|
|
|
+ */
|
|
|
StateCondition.prototype.serialize = function () {
|
|
|
return this._serialize({
|
|
|
name: "StateCondition",
|
|
@@ -49168,9 +49295,22 @@ var BABYLON;
|
|
|
"use strict";
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /**
|
|
|
+ * The action to be carried out following a trigger
|
|
|
+ * @see http://doc.babylonjs.com/how_to/how_to_use_actions#available-actions
|
|
|
+ */
|
|
|
var Action = /** @class */ (function () {
|
|
|
+ /**
|
|
|
+ * Creates a new Action
|
|
|
+ * @param triggerOptions the trigger, with or without parameters, for the action
|
|
|
+ * @param condition an optional determinant of action
|
|
|
+ */
|
|
|
function Action(triggerOptions, condition) {
|
|
|
this.triggerOptions = triggerOptions;
|
|
|
+ /**
|
|
|
+ * An event triggered prior to action being executed.
|
|
|
+ * @type Observable
|
|
|
+ */
|
|
|
this.onBeforeExecuteObservable = new BABYLON.Observable();
|
|
|
if (triggerOptions.parameter) {
|
|
|
this.trigger = triggerOptions.trigger;
|
|
@@ -49182,12 +49322,23 @@ var BABYLON;
|
|
|
this._nextActiveAction = this;
|
|
|
this._condition = condition;
|
|
|
}
|
|
|
- // Methods
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Action.prototype._prepare = function () {
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the trigger parameters
|
|
|
+ * @returns the trigger parameters
|
|
|
+ */
|
|
|
Action.prototype.getTriggerParameter = function () {
|
|
|
return this._triggerParameter;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only - executes current action event
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Action.prototype._executeCurrent = function (evt) {
|
|
|
if (this._nextActiveAction._condition) {
|
|
|
var condition = this._nextActiveAction._condition;
|
|
@@ -49211,8 +49362,15 @@ var BABYLON;
|
|
|
this._nextActiveAction.execute(evt);
|
|
|
this.skipToNextActiveAction();
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Execute placeholder for child classes
|
|
|
+ * @param evt optional action event
|
|
|
+ */
|
|
|
Action.prototype.execute = function (evt) {
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Skips to next active action
|
|
|
+ */
|
|
|
Action.prototype.skipToNextActiveAction = function () {
|
|
|
if (this._nextActiveAction._child) {
|
|
|
if (!this._nextActiveAction._child._actionManager) {
|
|
@@ -49224,21 +49382,42 @@ var BABYLON;
|
|
|
this._nextActiveAction = this;
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Adds action to chain of actions, may be a DoNothingAction
|
|
|
+ * @param index The index of the attribute.
|
|
|
+ * @returns The action passed in
|
|
|
+ * @see https://www.babylonjs-playground.com/#1T30HR#0
|
|
|
+ */
|
|
|
Action.prototype.then = function (action) {
|
|
|
this._child = action;
|
|
|
action._actionManager = this._actionManager;
|
|
|
action._prepare();
|
|
|
return action;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Action.prototype._getProperty = function (propertyPath) {
|
|
|
return this._actionManager._getProperty(propertyPath);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Action.prototype._getEffectiveTarget = function (target, propertyPath) {
|
|
|
return this._actionManager._getEffectiveTarget(target, propertyPath);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Serialize placeholder for child classes
|
|
|
+ * @param parent of child
|
|
|
+ */
|
|
|
Action.prototype.serialize = function (parent) {
|
|
|
};
|
|
|
- // Called by BABYLON.Action objects in serialize(...). Internal use
|
|
|
+ /**
|
|
|
+ * Internal only called by serialize
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Action.prototype._serialize = function (serializedAction, parent) {
|
|
|
var serializationObject = {
|
|
|
type: 1,
|
|
@@ -49264,6 +49443,10 @@ var BABYLON;
|
|
|
}
|
|
|
return serializationObject;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Action._SerializeValueAsString = function (value) {
|
|
|
if (typeof value === "number") {
|
|
|
return value.toString();
|
|
@@ -49285,6 +49468,10 @@ var BABYLON;
|
|
|
}
|
|
|
return value; // string
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Internal only
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
Action._GetTargetProperty = function (target) {
|
|
|
return {
|
|
|
name: "target",
|
|
@@ -49306,7 +49493,7 @@ var BABYLON;
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
/**
|
|
|
- * ActionEvent is the event beint sent when an action is triggered.
|
|
|
+ * ActionEvent is the event being sent when an action is triggered.
|
|
|
*/
|
|
|
var ActionEvent = /** @class */ (function () {
|
|
|
/**
|
|
@@ -60351,8 +60538,21 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /**
|
|
|
+ * A class extending {BABYLON.Texture} allowing drawing on a texture
|
|
|
+ * @see http://doc.babylonjs.com/how_to/dynamictexture
|
|
|
+ */
|
|
|
var DynamicTexture = /** @class */ (function (_super) {
|
|
|
__extends(DynamicTexture, _super);
|
|
|
+ /**
|
|
|
+ * Creates a {BABYLON.DynamicTexture}
|
|
|
+ * @param name defines the name of the texture
|
|
|
+ * @param options provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height
|
|
|
+ * @param scene defines the scene where you want the texture
|
|
|
+ * @param generateMipMaps defines the use of MinMaps or not (default is false)
|
|
|
+ * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
|
|
|
+ * @param format defines the texture format to use (default is BABYLON.Engine.TEXTUREFORMAT_RGBA)
|
|
|
+ */
|
|
|
function DynamicTexture(name, options, scene, generateMipMaps, samplingMode, format) {
|
|
|
if (scene === void 0) { scene = null; }
|
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
@@ -60383,6 +60583,9 @@ var BABYLON;
|
|
|
return _this;
|
|
|
}
|
|
|
Object.defineProperty(DynamicTexture.prototype, "canRescale", {
|
|
|
+ /**
|
|
|
+ * Gets the current state of canRescale
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return true;
|
|
|
},
|
|
@@ -60395,28 +60598,59 @@ var BABYLON;
|
|
|
this.releaseInternalTexture();
|
|
|
this._texture = this._engine.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this._samplingMode);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Scales the texture
|
|
|
+ * @param ratio the scale factor to apply to both width and height
|
|
|
+ */
|
|
|
DynamicTexture.prototype.scale = function (ratio) {
|
|
|
var textureSize = this.getSize();
|
|
|
textureSize.width *= ratio;
|
|
|
textureSize.height *= ratio;
|
|
|
this._recreate(textureSize);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Resizes the texture
|
|
|
+ * @param width the new width
|
|
|
+ * @param height the new height
|
|
|
+ */
|
|
|
DynamicTexture.prototype.scaleTo = function (width, height) {
|
|
|
var textureSize = this.getSize();
|
|
|
textureSize.width = width;
|
|
|
textureSize.height = height;
|
|
|
this._recreate(textureSize);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the context of the canvas used by the texture
|
|
|
+ * @returns the canvas context of the dynamic texture
|
|
|
+ */
|
|
|
DynamicTexture.prototype.getContext = function () {
|
|
|
return this._context;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Clears the texture
|
|
|
+ */
|
|
|
DynamicTexture.prototype.clear = function () {
|
|
|
var size = this.getSize();
|
|
|
this._context.fillRect(0, 0, size.width, size.height);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Updates the texture
|
|
|
+ * @param invertY defines the direction for the Y axis (default is true - y increases downwards)
|
|
|
+ */
|
|
|
DynamicTexture.prototype.update = function (invertY) {
|
|
|
this._engine.updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY, undefined, this._format || undefined);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Draws text onto the texture
|
|
|
+ * @param text defines the text to be drawn
|
|
|
+ * @param x defines the placement of the text from the left
|
|
|
+ * @param y defines the placement of the text from the top when invertY is true and from the bottom when false
|
|
|
+ * @param font defines the font to be used with font-style, font-size, font-name
|
|
|
+ * @param color defines the color used for the text
|
|
|
+ * @param clearColor defines the color for the canvas, use null to not overwrite canvas
|
|
|
+ * @param invertY defines the direction for the Y axis (default is true - y increases downwards)
|
|
|
+ * @param update defines whether texture is immediately update (default is true)
|
|
|
+ */
|
|
|
DynamicTexture.prototype.drawText = function (text, x, y, font, color, clearColor, invertY, update) {
|
|
|
if (update === void 0) { update = true; }
|
|
|
var size = this.getSize();
|
|
@@ -60440,6 +60674,10 @@ var BABYLON;
|
|
|
this.update(invertY);
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Clones the texture
|
|
|
+ * @returns the clone of the texture.
|
|
|
+ */
|
|
|
DynamicTexture.prototype.clone = function () {
|
|
|
var scene = this.getScene();
|
|
|
if (!scene) {
|
|
@@ -60455,6 +60693,7 @@ var BABYLON;
|
|
|
newTexture.wrapV = this.wrapV;
|
|
|
return newTexture;
|
|
|
};
|
|
|
+ /** @ignore */
|
|
|
DynamicTexture.prototype._rebuild = function () {
|
|
|
this.update();
|
|
|
};
|