|
@@ -44535,12 +44535,14 @@ var PlaneRotationGizmo = /** @class */ (function (_super) {
|
|
|
* @param planeNormal The normal of the plane which the gizmo will be able to rotate on
|
|
|
* @param color The color of the gizmo
|
|
|
* @param tessellation Amount of tessellation to be used when creating rotation circles
|
|
|
+ * @param useEulerRotation Use and update Euler angle instead of quaternion
|
|
|
*/
|
|
|
- function PlaneRotationGizmo(planeNormal, color, gizmoLayer, tessellation, parent) {
|
|
|
+ function PlaneRotationGizmo(planeNormal, color, gizmoLayer, tessellation, parent, useEulerRotation) {
|
|
|
if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__["Color3"].Gray(); }
|
|
|
if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__["UtilityLayerRenderer"].DefaultUtilityLayer; }
|
|
|
if (tessellation === void 0) { tessellation = 32; }
|
|
|
if (parent === void 0) { parent = null; }
|
|
|
+ if (useEulerRotation === void 0) { useEulerRotation = false; }
|
|
|
var _this = _super.call(this, gizmoLayer) || this;
|
|
|
_this._pointerObserver = null;
|
|
|
/**
|
|
@@ -44597,7 +44599,7 @@ var PlaneRotationGizmo = /** @class */ (function (_super) {
|
|
|
var amountToRotate = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__["Quaternion"]();
|
|
|
_this.dragBehavior.onDragObservable.add(function (event) {
|
|
|
if (_this.attachedMesh) {
|
|
|
- if (!_this.attachedMesh.rotationQuaternion) {
|
|
|
+ if (!_this.attachedMesh.rotationQuaternion || useEulerRotation) {
|
|
|
_this.attachedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__["Quaternion"].RotationYawPitchRoll(_this.attachedMesh.rotation.y, _this.attachedMesh.rotation.x, _this.attachedMesh.rotation.z);
|
|
|
}
|
|
|
// Remove parent priort to rotating
|
|
@@ -44669,6 +44671,11 @@ var PlaneRotationGizmo = /** @class */ (function (_super) {
|
|
|
// Rotate selected mesh quaternion over rotated axis
|
|
|
amountToRotate.multiplyToRef(_this.attachedMesh.rotationQuaternion, _this.attachedMesh.rotationQuaternion);
|
|
|
}
|
|
|
+ if (useEulerRotation) {
|
|
|
+ _this.attachedMesh.rotationQuaternion.toEulerAnglesToRef(tmpVector);
|
|
|
+ _this.attachedMesh.rotationQuaternion = null;
|
|
|
+ _this.attachedMesh.rotation.copyFrom(tmpVector);
|
|
|
+ }
|
|
|
lastDragPosition.copyFrom(event.dragPlanePoint);
|
|
|
if (snapped) {
|
|
|
tmpSnapEvent.snapDistance = angle;
|
|
@@ -44962,18 +44969,20 @@ var RotationGizmo = /** @class */ (function (_super) {
|
|
|
* Creates a RotationGizmo
|
|
|
* @param gizmoLayer The utility layer the gizmo will be added to
|
|
|
* @param tessellation Amount of tessellation to be used when creating rotation circles
|
|
|
+ * @param useEulerRotation Use and update Euler angle instead of quaternion
|
|
|
*/
|
|
|
- function RotationGizmo(gizmoLayer, tessellation) {
|
|
|
+ function RotationGizmo(gizmoLayer, tessellation, useEulerRotation) {
|
|
|
if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__["UtilityLayerRenderer"].DefaultUtilityLayer; }
|
|
|
if (tessellation === void 0) { tessellation = 32; }
|
|
|
+ if (useEulerRotation === void 0) { useEulerRotation = false; }
|
|
|
var _this = _super.call(this, gizmoLayer) || this;
|
|
|
/** Fires an event when any of it's sub gizmos are dragged */
|
|
|
_this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__["Observable"]();
|
|
|
/** Fires an event when any of it's sub gizmos are released from dragging */
|
|
|
_this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__["Observable"]();
|
|
|
- _this.xGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__["PlaneRotationGizmo"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__["Color3"].Red().scale(0.5), gizmoLayer, tessellation, _this);
|
|
|
- _this.yGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__["PlaneRotationGizmo"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__["Color3"].Green().scale(0.5), gizmoLayer, tessellation, _this);
|
|
|
- _this.zGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__["PlaneRotationGizmo"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__["Color3"].Blue().scale(0.5), gizmoLayer, tessellation, _this);
|
|
|
+ _this.xGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__["PlaneRotationGizmo"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__["Color3"].Red().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);
|
|
|
+ _this.yGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__["PlaneRotationGizmo"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__["Color3"].Green().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);
|
|
|
+ _this.zGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__["PlaneRotationGizmo"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__["Color3"].Blue().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);
|
|
|
// Relay drag events
|
|
|
[_this.xGizmo, _this.yGizmo, _this.zGizmo].forEach(function (gizmo) {
|
|
|
gizmo.dragBehavior.onDragStartObservable.add(function () {
|
|
@@ -98673,6 +98682,14 @@ var AbstractMesh = /** @class */ (function (_super) {
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(AbstractMesh, "BILLBOARDMODE_USE_POSITION", {
|
|
|
+ /** Billboard on using position instead of orientation */
|
|
|
+ get: function () {
|
|
|
+ return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__["TransformNode"].BILLBOARDMODE_USE_POSITION;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(AbstractMesh.prototype, "facetNb", {
|
|
|
/**
|
|
|
* Gets the number of facets in the mesh
|
|
@@ -112314,6 +112331,22 @@ var TransformNode = /** @class */ (function (_super) {
|
|
|
this._currentRenderId = currentRenderId;
|
|
|
return this._worldMatrix;
|
|
|
}
|
|
|
+ var camera = this.getScene().activeCamera;
|
|
|
+ var useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;
|
|
|
+ var useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;
|
|
|
+ // Billboarding based on camera position
|
|
|
+ if (useBillboardPath && camera && useBillboardPosition) {
|
|
|
+ this.lookAt(camera.position);
|
|
|
+ if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {
|
|
|
+ this.rotation.x = 0;
|
|
|
+ }
|
|
|
+ if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {
|
|
|
+ this.rotation.y = 0;
|
|
|
+ }
|
|
|
+ if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {
|
|
|
+ this.rotation.z = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
this._updateCache();
|
|
|
var cache = this._cache;
|
|
|
cache.pivotMatrixUpdated = false;
|
|
@@ -112323,8 +112356,6 @@ var TransformNode = /** @class */ (function (_super) {
|
|
|
this._childUpdateId++;
|
|
|
this._isDirty = false;
|
|
|
var parent = this._getEffectiveParent();
|
|
|
- var useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;
|
|
|
- var camera = this.getScene().activeCamera;
|
|
|
// Scaling
|
|
|
var scaling = cache.scaling;
|
|
|
var translation = cache.position;
|
|
@@ -112413,8 +112444,8 @@ var TransformNode = /** @class */ (function (_super) {
|
|
|
else {
|
|
|
this._worldMatrix.copyFrom(this._localMatrix);
|
|
|
}
|
|
|
- // Billboarding (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)
|
|
|
- if (useBillboardPath && camera) {
|
|
|
+ // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)
|
|
|
+ if (useBillboardPath && camera && this.billboardMode && !useBillboardPosition) {
|
|
|
var storedTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["TmpVectors"].Vector3[0];
|
|
|
this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation
|
|
|
// Cancel camera rotation
|
|
@@ -112686,6 +112717,10 @@ var TransformNode = /** @class */ (function (_super) {
|
|
|
* Object will rotate to face the camera
|
|
|
*/
|
|
|
TransformNode.BILLBOARDMODE_ALL = 7;
|
|
|
+ /**
|
|
|
+ * Object will rotate to face the camera's position instead of orientation
|
|
|
+ */
|
|
|
+ TransformNode.BILLBOARDMODE_USE_POSITION = 128;
|
|
|
TransformNode._lookAtVectorCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](0, 0, 0);
|
|
|
TransformNode._rotationAxisCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Quaternion"]();
|
|
|
tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
|