|
@@ -20293,7 +20293,7 @@ var BABYLON;
|
|
if (this._cache.pivotMatrixUpdated) {
|
|
if (this._cache.pivotMatrixUpdated) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (this.infiniteDistance) {
|
|
|
|
|
|
+ if (this.infiniteDistance !== this._cache.infiniteDistance) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
if (!this._cache.position.equals(this._position)) {
|
|
if (!this._cache.position.equals(this._position)) {
|
|
@@ -20321,6 +20321,7 @@ var BABYLON;
|
|
this._cache.rotation = BABYLON.Vector3.Zero();
|
|
this._cache.rotation = BABYLON.Vector3.Zero();
|
|
this._cache.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 0);
|
|
this._cache.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 0);
|
|
this._cache.billboardMode = -1;
|
|
this._cache.billboardMode = -1;
|
|
|
|
+ this._cache.infiniteDistance = false;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Flag the transform node as dirty (Forcing it to update everything)
|
|
* Flag the transform node as dirty (Forcing it to update everything)
|
|
@@ -20854,6 +20855,7 @@ var BABYLON;
|
|
this._cache.scaling.copyFrom(this.scaling);
|
|
this._cache.scaling.copyFrom(this.scaling);
|
|
this._cache.pivotMatrixUpdated = false;
|
|
this._cache.pivotMatrixUpdated = false;
|
|
this._cache.billboardMode = this.billboardMode;
|
|
this._cache.billboardMode = this.billboardMode;
|
|
|
|
+ this._cache.infiniteDistance = this.infiniteDistance;
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
this._childRenderId = this.getScene().getRenderId();
|
|
this._childRenderId = this.getScene().getRenderId();
|
|
this._isDirty = false;
|
|
this._isDirty = false;
|
|
@@ -32482,15 +32484,19 @@ var BABYLON;
|
|
* Update the url (and optional buffer) of this texture if url was null during construction.
|
|
* Update the url (and optional buffer) of this texture if url was null during construction.
|
|
* @param url the url of the texture
|
|
* @param url the url of the texture
|
|
* @param buffer the buffer of the texture (defaults to null)
|
|
* @param buffer the buffer of the texture (defaults to null)
|
|
|
|
+ * @param onLoad callback called when the texture is loaded (defaults to null)
|
|
*/
|
|
*/
|
|
- Texture.prototype.updateURL = function (url, buffer) {
|
|
|
|
|
|
+ Texture.prototype.updateURL = function (url, buffer, onLoad) {
|
|
if (buffer === void 0) { buffer = null; }
|
|
if (buffer === void 0) { buffer = null; }
|
|
if (this.url) {
|
|
if (this.url) {
|
|
- throw new Error("URL is already set");
|
|
|
|
|
|
+ this.releaseInternalTexture();
|
|
}
|
|
}
|
|
this.url = url;
|
|
this.url = url;
|
|
this._buffer = buffer;
|
|
this._buffer = buffer;
|
|
this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
|
|
this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
|
|
|
|
+ if (onLoad) {
|
|
|
|
+ this._delayedOnLoad = onLoad;
|
|
|
|
+ }
|
|
this.delayLoad();
|
|
this.delayLoad();
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
@@ -66512,27 +66518,34 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
function AxesViewer(scene, scaleLines) {
|
|
function AxesViewer(scene, scaleLines) {
|
|
if (scaleLines === void 0) { scaleLines = 1; }
|
|
if (scaleLines === void 0) { scaleLines = 1; }
|
|
- this._xline = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
|
|
|
|
- this._yline = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
|
|
|
|
- this._zline = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
|
|
|
|
/**
|
|
/**
|
|
* Gets or sets a number used to scale line length
|
|
* Gets or sets a number used to scale line length
|
|
*/
|
|
*/
|
|
this.scaleLines = 1;
|
|
this.scaleLines = 1;
|
|
this.scaleLines = scaleLines;
|
|
this.scaleLines = scaleLines;
|
|
- this._xmesh = BABYLON.Mesh.CreateLines("xline", this._xline, scene, true);
|
|
|
|
- this._ymesh = BABYLON.Mesh.CreateLines("yline", this._yline, scene, true);
|
|
|
|
- this._zmesh = BABYLON.Mesh.CreateLines("zline", this._zline, scene, true);
|
|
|
|
- this._xmesh.renderingGroupId = 2;
|
|
|
|
- this._ymesh.renderingGroupId = 2;
|
|
|
|
- this._zmesh.renderingGroupId = 2;
|
|
|
|
- this._xmesh.material.checkReadyOnlyOnce = true;
|
|
|
|
- this._xmesh.color = new BABYLON.Color3(1, 0, 0);
|
|
|
|
- this._ymesh.material.checkReadyOnlyOnce = true;
|
|
|
|
- this._ymesh.color = new BABYLON.Color3(0, 1, 0);
|
|
|
|
- this._zmesh.material.checkReadyOnlyOnce = true;
|
|
|
|
- this._zmesh.color = new BABYLON.Color3(0, 0, 1);
|
|
|
|
|
|
+ var greenColoredMaterial = new BABYLON.StandardMaterial("", scene);
|
|
|
|
+ greenColoredMaterial.disableLighting = true;
|
|
|
|
+ greenColoredMaterial.emissiveColor = BABYLON.Color3.Green().scale(0.5);
|
|
|
|
+ var redColoredMaterial = new BABYLON.StandardMaterial("", scene);
|
|
|
|
+ redColoredMaterial.disableLighting = true;
|
|
|
|
+ redColoredMaterial.emissiveColor = BABYLON.Color3.Red().scale(0.5);
|
|
|
|
+ var blueColoredMaterial = new BABYLON.StandardMaterial("", scene);
|
|
|
|
+ blueColoredMaterial.disableLighting = true;
|
|
|
|
+ blueColoredMaterial.emissiveColor = BABYLON.Color3.Blue().scale(0.5);
|
|
|
|
+ this._xmesh = BABYLON.AxisDragGizmo._CreateArrow(scene, redColoredMaterial);
|
|
|
|
+ this._ymesh = BABYLON.AxisDragGizmo._CreateArrow(scene, greenColoredMaterial);
|
|
|
|
+ this._zmesh = BABYLON.AxisDragGizmo._CreateArrow(scene, blueColoredMaterial);
|
|
|
|
+ this._xmesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
|
+ this._xmesh.scaling.scaleInPlace(4);
|
|
|
|
+ this._ymesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
|
+ this._ymesh.scaling.scaleInPlace(4);
|
|
|
|
+ this._zmesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
|
+ this._zmesh.scaling.scaleInPlace(4);
|
|
|
|
+ AxesViewer._recursiveChangeRenderingGroupId(this._xmesh, 2);
|
|
|
|
+ AxesViewer._recursiveChangeRenderingGroupId(this._ymesh, 2);
|
|
|
|
+ AxesViewer._recursiveChangeRenderingGroupId(this._zmesh, 2);
|
|
this.scene = scene;
|
|
this.scene = scene;
|
|
|
|
+ this.update(new BABYLON.Vector3(), BABYLON.Vector3.Right(), BABYLON.Vector3.Up(), BABYLON.Vector3.Forward());
|
|
}
|
|
}
|
|
Object.defineProperty(AxesViewer.prototype, "xAxisMesh", {
|
|
Object.defineProperty(AxesViewer.prototype, "xAxisMesh", {
|
|
/** Gets the mesh used to render x-axis */
|
|
/** Gets the mesh used to render x-axis */
|
|
@@ -66558,6 +66571,12 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ AxesViewer._recursiveChangeRenderingGroupId = function (mesh, id) {
|
|
|
|
+ mesh.renderingGroupId = id;
|
|
|
|
+ mesh.getChildMeshes().forEach(function (m) {
|
|
|
|
+ AxesViewer._recursiveChangeRenderingGroupId(m, id);
|
|
|
|
+ });
|
|
|
|
+ };
|
|
/**
|
|
/**
|
|
* Force the viewer to update
|
|
* Force the viewer to update
|
|
* @param position defines the position of the viewer
|
|
* @param position defines the position of the viewer
|
|
@@ -66566,31 +66585,24 @@ var BABYLON;
|
|
* @param zaxis defines the z axis of the viewer
|
|
* @param zaxis defines the z axis of the viewer
|
|
*/
|
|
*/
|
|
AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {
|
|
AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {
|
|
- var scaleLines = this.scaleLines;
|
|
|
|
if (this._xmesh) {
|
|
if (this._xmesh) {
|
|
this._xmesh.position.copyFrom(position);
|
|
this._xmesh.position.copyFrom(position);
|
|
|
|
+ var cross = BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), xaxis);
|
|
|
|
+ this._xmesh.rotationQuaternion.set(cross.x, cross.y, cross.z, 1 + BABYLON.Vector3.Dot(BABYLON.Vector3.Forward(), xaxis));
|
|
|
|
+ this._xmesh.rotationQuaternion.normalize();
|
|
}
|
|
}
|
|
if (this._ymesh) {
|
|
if (this._ymesh) {
|
|
this._ymesh.position.copyFrom(position);
|
|
this._ymesh.position.copyFrom(position);
|
|
|
|
+ var cross = BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), yaxis);
|
|
|
|
+ this._ymesh.rotationQuaternion.set(cross.x, cross.y, cross.z, 1 + BABYLON.Vector3.Dot(BABYLON.Vector3.Forward(), yaxis));
|
|
|
|
+ this._ymesh.rotationQuaternion.normalize();
|
|
}
|
|
}
|
|
if (this._zmesh) {
|
|
if (this._zmesh) {
|
|
this._zmesh.position.copyFrom(position);
|
|
this._zmesh.position.copyFrom(position);
|
|
|
|
+ var cross = BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), zaxis);
|
|
|
|
+ this._zmesh.rotationQuaternion.set(cross.x, cross.y, cross.z, 1 + BABYLON.Vector3.Dot(BABYLON.Vector3.Forward(), zaxis));
|
|
|
|
+ this._zmesh.rotationQuaternion.normalize();
|
|
}
|
|
}
|
|
- var point2 = this._xline[1];
|
|
|
|
- point2.x = xaxis.x * scaleLines;
|
|
|
|
- point2.y = xaxis.y * scaleLines;
|
|
|
|
- point2.z = xaxis.z * scaleLines;
|
|
|
|
- BABYLON.Mesh.CreateLines("", this._xline, null, false, this._xmesh);
|
|
|
|
- point2 = this._yline[1];
|
|
|
|
- point2.x = yaxis.x * scaleLines;
|
|
|
|
- point2.y = yaxis.y * scaleLines;
|
|
|
|
- point2.z = yaxis.z * scaleLines;
|
|
|
|
- BABYLON.Mesh.CreateLines("", this._yline, null, false, this._ymesh);
|
|
|
|
- point2 = this._zline[1];
|
|
|
|
- point2.x = zaxis.x * scaleLines;
|
|
|
|
- point2.y = zaxis.y * scaleLines;
|
|
|
|
- point2.z = zaxis.z * scaleLines;
|
|
|
|
- BABYLON.Mesh.CreateLines("", this._zline, null, false, this._zmesh);
|
|
|
|
};
|
|
};
|
|
/** Releases resources */
|
|
/** Releases resources */
|
|
AxesViewer.prototype.dispose = function () {
|
|
AxesViewer.prototype.dispose = function () {
|
|
@@ -73770,6 +73782,22 @@ var BABYLON;
|
|
return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);
|
|
return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Update the url (and optional buffer) of this texture if url was null during construction.
|
|
|
|
+ * @param url the url of the texture
|
|
|
|
+ * @param onLoad callback called when the texture is loaded (defaults to null)
|
|
|
|
+ */
|
|
|
|
+ CubeTexture.prototype.updateURL = function (url, onLoad) {
|
|
|
|
+ if (this.url) {
|
|
|
|
+ this.releaseInternalTexture();
|
|
|
|
+ }
|
|
|
|
+ this.url = url;
|
|
|
|
+ this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
|
|
|
|
+ if (onLoad) {
|
|
|
|
+ this._delayedOnLoad = onLoad;
|
|
|
|
+ }
|
|
|
|
+ this.delayLoad();
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Delays loading of the cube texture
|
|
* Delays loading of the cube texture
|
|
*/
|
|
*/
|
|
CubeTexture.prototype.delayLoad = function () {
|
|
CubeTexture.prototype.delayLoad = function () {
|
|
@@ -73784,10 +73812,10 @@ var BABYLON;
|
|
this._texture = this._getFromCache(this.url, this._noMipmap);
|
|
this._texture = this._getFromCache(this.url, this._noMipmap);
|
|
if (!this._texture) {
|
|
if (!this._texture) {
|
|
if (this._prefiltered) {
|
|
if (this._prefiltered) {
|
|
- this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format, undefined, this._createPolynomials);
|
|
|
|
|
|
+ this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, undefined, undefined, this._format);
|
|
|
|
|
|
+ this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -103386,20 +103414,7 @@ var BABYLON;
|
|
hoverMaterial.disableLighting = true;
|
|
hoverMaterial.disableLighting = true;
|
|
hoverMaterial.emissiveColor = color.add(new BABYLON.Color3(0.3, 0.3, 0.3));
|
|
hoverMaterial.emissiveColor = color.add(new BABYLON.Color3(0.3, 0.3, 0.3));
|
|
// Build mesh on root node
|
|
// Build mesh on root node
|
|
- var arrow = new BABYLON.AbstractMesh("", gizmoLayer.utilityLayerScene);
|
|
|
|
- var arrowMesh = BABYLON.MeshBuilder.CreateCylinder("yPosMesh", { diameterTop: 0, height: 1.5, diameterBottom: 0.75, tessellation: 96 }, gizmoLayer.utilityLayerScene);
|
|
|
|
- var arrowTail = BABYLON.MeshBuilder.CreateLines("yPosMesh", { points: [new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(0, 1.1, 0)] }, gizmoLayer.utilityLayerScene);
|
|
|
|
- arrowTail.color = coloredMaterial.emissiveColor;
|
|
|
|
- arrow.addChild(arrowMesh);
|
|
|
|
- arrow.addChild(arrowTail);
|
|
|
|
- // Position arrow pointing in its drag axis
|
|
|
|
- arrowMesh.scaling.scaleInPlace(0.05);
|
|
|
|
- arrowMesh.material = coloredMaterial;
|
|
|
|
- arrowMesh.rotation.x = Math.PI / 2;
|
|
|
|
- arrowMesh.position.z += 0.3;
|
|
|
|
- arrowTail.scaling.scaleInPlace(0.26);
|
|
|
|
- arrowTail.rotation.x = Math.PI / 2;
|
|
|
|
- arrowTail.material = coloredMaterial;
|
|
|
|
|
|
+ var arrow = AxisDragGizmo._CreateArrow(gizmoLayer.utilityLayerScene, coloredMaterial);
|
|
arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
|
|
arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
|
|
arrow.scaling.scaleInPlace(1 / 3);
|
|
arrow.scaling.scaleInPlace(1 / 3);
|
|
_this._rootMesh.addChild(arrow);
|
|
_this._rootMesh.addChild(arrow);
|
|
@@ -103456,6 +103471,24 @@ var BABYLON;
|
|
});
|
|
});
|
|
return _this;
|
|
return _this;
|
|
}
|
|
}
|
|
|
|
+ /** @hidden */
|
|
|
|
+ AxisDragGizmo._CreateArrow = function (scene, material) {
|
|
|
|
+ var arrow = new BABYLON.AbstractMesh("", scene);
|
|
|
|
+ var arrowMesh = BABYLON.MeshBuilder.CreateCylinder("yPosMesh", { diameterTop: 0, height: 1.5, diameterBottom: 0.75, tessellation: 96 }, scene);
|
|
|
|
+ var arrowTail = BABYLON.MeshBuilder.CreateLines("yPosMesh", { points: [new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(0, 1.1, 0)] }, scene);
|
|
|
|
+ arrowTail.color = material.emissiveColor;
|
|
|
|
+ arrow.addChild(arrowMesh);
|
|
|
|
+ arrow.addChild(arrowTail);
|
|
|
|
+ // Position arrow pointing in its drag axis
|
|
|
|
+ arrowMesh.scaling.scaleInPlace(0.05);
|
|
|
|
+ arrowMesh.material = material;
|
|
|
|
+ arrowMesh.rotation.x = Math.PI / 2;
|
|
|
|
+ arrowMesh.position.z += 0.3;
|
|
|
|
+ arrowTail.scaling.scaleInPlace(0.26);
|
|
|
|
+ arrowTail.rotation.x = Math.PI / 2;
|
|
|
|
+ arrowTail.material = material;
|
|
|
|
+ return arrow;
|
|
|
|
+ };
|
|
AxisDragGizmo.prototype._attachedMeshChanged = function (value) {
|
|
AxisDragGizmo.prototype._attachedMeshChanged = function (value) {
|
|
if (this.dragBehavior) {
|
|
if (this.dragBehavior) {
|
|
this.dragBehavior.enabled = value ? true : false;
|
|
this.dragBehavior.enabled = value ? true : false;
|
|
@@ -104703,6 +104736,10 @@ var BABYLON;
|
|
function GizmoManager(scene) {
|
|
function GizmoManager(scene) {
|
|
var _this = this;
|
|
var _this = this;
|
|
this.scene = scene;
|
|
this.scene = scene;
|
|
|
|
+ /** When true, the gizmo will be detached from the current object when a pointer down occurs with an empty picked mesh */
|
|
|
|
+ this.clearGizmoOnEmptyPointerEvent = false;
|
|
|
|
+ /** Fires an event when the manager is attached to a mesh */
|
|
|
|
+ this.onAttachedToMeshObservable = new BABYLON.Observable();
|
|
this._gizmosEnabled = { positionGizmo: false, rotationGizmo: false, scaleGizmo: false, boundingBoxGizmo: false };
|
|
this._gizmosEnabled = { positionGizmo: false, rotationGizmo: false, scaleGizmo: false, boundingBoxGizmo: false };
|
|
this._pointerObserver = null;
|
|
this._pointerObserver = null;
|
|
this._attachedMesh = null;
|
|
this._attachedMesh = null;
|
|
@@ -104756,11 +104793,15 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- _this.attachToMesh(null);
|
|
|
|
|
|
+ if (_this.clearGizmoOnEmptyPointerEvent) {
|
|
|
|
+ _this.attachToMesh(null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- _this.attachToMesh(null);
|
|
|
|
|
|
+ if (_this.clearGizmoOnEmptyPointerEvent) {
|
|
|
|
+ _this.attachToMesh(null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -104783,6 +104824,7 @@ var BABYLON;
|
|
if (this.boundingBoxGizmoEnabled && this._attachedMesh) {
|
|
if (this.boundingBoxGizmoEnabled && this._attachedMesh) {
|
|
this._attachedMesh.addBehavior(this.boundingBoxDragBehavior);
|
|
this._attachedMesh.addBehavior(this.boundingBoxDragBehavior);
|
|
}
|
|
}
|
|
|
|
+ this.onAttachedToMeshObservable.notifyObservers(mesh);
|
|
};
|
|
};
|
|
Object.defineProperty(GizmoManager.prototype, "positionGizmoEnabled", {
|
|
Object.defineProperty(GizmoManager.prototype, "positionGizmoEnabled", {
|
|
get: function () {
|
|
get: function () {
|
|
@@ -104886,6 +104928,7 @@ var BABYLON;
|
|
this._defaultKeepDepthUtilityLayer.dispose();
|
|
this._defaultKeepDepthUtilityLayer.dispose();
|
|
this._defaultUtilityLayer.dispose();
|
|
this._defaultUtilityLayer.dispose();
|
|
this.boundingBoxDragBehavior.detach();
|
|
this.boundingBoxDragBehavior.detach();
|
|
|
|
+ this.onAttachedToMeshObservable.clear();
|
|
};
|
|
};
|
|
return GizmoManager;
|
|
return GizmoManager;
|
|
}());
|
|
}());
|