|
@@ -70803,6 +70803,10 @@ var TexturePropertyTabComponent = /** @class */ (function (_super) {
|
|
|
_this.state = { isEmbedded: !texture || texture.name.substring(0, 4) !== "http" };
|
|
|
return _this;
|
|
|
}
|
|
|
+ TexturePropertyTabComponent.prototype.UNSAFE_componentWillUpdate = function (nextProps, nextState) {
|
|
|
+ var texture = nextProps.node.texture;
|
|
|
+ nextState.isEmbedded = !texture || texture.name.substring(0, 4) !== "http";
|
|
|
+ };
|
|
|
TexturePropertyTabComponent.prototype._generateRandomForCache = function () {
|
|
|
return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[x]/g, function (c) {
|
|
|
var r = Math.random() * 10 | 0;
|
|
@@ -71417,7 +71421,21 @@ var PreviewAreaComponent = /** @class */ (function (_super) {
|
|
|
react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__["FontAwesomeIcon"], { icon: _fortawesome_free_solid_svg_icons__WEBPACK_IMPORTED_MODULE_3__["faPalette"] })),
|
|
|
react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("input", { ref: "color-picker", id: "color-picker", type: "color", onChange: function (evt) { return _this.changeBackground(evt.target.value); } })),
|
|
|
react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { title: "Render without back face culling", onClick: function () { return _this.changeBackFaceCulling(!_this.props.globalState.backFaceCulling); }, className: "button" + (!this.props.globalState.backFaceCulling ? " selected" : "") },
|
|
|
- react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__["FontAwesomeIcon"], { icon: _fortawesome_free_solid_svg_icons__WEBPACK_IMPORTED_MODULE_3__["faCheckDouble"] })))));
|
|
|
+ react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__["FontAwesomeIcon"], { icon: _fortawesome_free_solid_svg_icons__WEBPACK_IMPORTED_MODULE_3__["faCheckDouble"] })),
|
|
|
+ react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { title: "Turn on/off hemispheric light", onClick: function () {
|
|
|
+ _this.props.globalState.hemisphericLight = !_this.props.globalState.hemisphericLight;
|
|
|
+ _dataStorage__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].StoreBoolean("HemisphericLight", _this.props.globalState.hemisphericLight);
|
|
|
+ _this.props.globalState.onLightUpdated.notifyObservers();
|
|
|
+ _this.forceUpdate();
|
|
|
+ }, className: "button" + (this.props.globalState.hemisphericLight ? " selected" : "") },
|
|
|
+ react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__["FontAwesomeIcon"], { icon: _fortawesome_free_solid_svg_icons__WEBPACK_IMPORTED_MODULE_3__["faSun"] })),
|
|
|
+ react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("div", { title: "Turn on/off direction light #0", onClick: function () {
|
|
|
+ _this.props.globalState.directionalLight0 = !_this.props.globalState.directionalLight0;
|
|
|
+ _dataStorage__WEBPACK_IMPORTED_MODULE_5__["DataStorage"].StoreBoolean("DirectionalLight0", _this.props.globalState.directionalLight0);
|
|
|
+ _this.props.globalState.onLightUpdated.notifyObservers();
|
|
|
+ _this.forceUpdate();
|
|
|
+ }, className: "button" + (this.props.globalState.directionalLight0 ? " selected" : "") },
|
|
|
+ react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_fortawesome_react_fontawesome__WEBPACK_IMPORTED_MODULE_2__["FontAwesomeIcon"], { icon: _fortawesome_free_solid_svg_icons__WEBPACK_IMPORTED_MODULE_3__["faLocationArrow"] })))));
|
|
|
};
|
|
|
return PreviewAreaComponent;
|
|
|
}(react__WEBPACK_IMPORTED_MODULE_1__["Component"]));
|
|
@@ -71449,6 +71467,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
var PreviewManager = /** @class */ (function () {
|
|
|
function PreviewManager(targetCanvas, globalState) {
|
|
|
var _this = this;
|
|
@@ -71461,6 +71480,9 @@ var PreviewManager = /** @class */ (function () {
|
|
|
this._onPreviewCommandActivatedObserver = globalState.onPreviewCommandActivated.add(function () {
|
|
|
_this._refreshPreviewMesh();
|
|
|
});
|
|
|
+ this._onLightUpdatedObserver = globalState.onLightUpdated.add(function () {
|
|
|
+ _this._prepareLights();
|
|
|
+ });
|
|
|
this._onUpdateRequiredObserver = globalState.onUpdateRequiredObservable.add(function () {
|
|
|
var serializationObject = _this._nodeMaterial.serialize();
|
|
|
_this._updatePreview(serializationObject);
|
|
@@ -71505,11 +71527,23 @@ var PreviewManager = /** @class */ (function () {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- PreviewManager.prototype._prepareMeshes = function () {
|
|
|
- // Light
|
|
|
- if (!this._scene.lights.length) {
|
|
|
- this._light = new babylonjs_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__["HemisphericLight"]("light", new babylonjs_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, 1, 0), this._scene);
|
|
|
+ PreviewManager.prototype._prepareLights = function () {
|
|
|
+ // Remove current lights
|
|
|
+ var currentLights = this._scene.lights.slice(0);
|
|
|
+ for (var _i = 0, currentLights_1 = currentLights; _i < currentLights_1.length; _i++) {
|
|
|
+ var light = currentLights_1[_i];
|
|
|
+ light.dispose();
|
|
|
}
|
|
|
+ // Create new lights based on settings
|
|
|
+ if (this._globalState.hemisphericLight) {
|
|
|
+ new babylonjs_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__["HemisphericLight"]("Hemispheric light", new babylonjs_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, 1, 0), this._scene);
|
|
|
+ }
|
|
|
+ if (this._globalState.directionalLight0) {
|
|
|
+ new babylonjs_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__["DirectionalLight"]("Directional light #0", new babylonjs_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__["Vector3"](-1, -1, 0), this._scene);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ PreviewManager.prototype._prepareMeshes = function () {
|
|
|
+ this._prepareLights();
|
|
|
// Framing
|
|
|
this._camera.useFramingBehavior = true;
|
|
|
var framingBehavior = this._camera.getBehaviorByName("Framing");
|
|
@@ -71621,6 +71655,7 @@ var PreviewManager = /** @class */ (function () {
|
|
|
this._globalState.onAnimationCommandActivated.remove(this._onAnimationCommandActivatedObserver);
|
|
|
this._globalState.onPreviewBackgroundChanged.remove(this._onPreviewBackgroundChangedObserver);
|
|
|
this._globalState.onBackFaceCullingChanged.remove(this._onBackFaceCullingChangedObserver);
|
|
|
+ this._globalState.onLightUpdated.remove(this._onLightUpdatedObserver);
|
|
|
if (this._material) {
|
|
|
this._material.dispose();
|
|
|
}
|
|
@@ -71629,9 +71664,6 @@ var PreviewManager = /** @class */ (function () {
|
|
|
var mesh = _a[_i];
|
|
|
mesh.dispose();
|
|
|
}
|
|
|
- if (this._light) {
|
|
|
- this._light.dispose();
|
|
|
- }
|
|
|
this._scene.dispose();
|
|
|
this._engine.dispose();
|
|
|
};
|
|
@@ -72215,12 +72247,15 @@ var GlobalState = /** @class */ (function () {
|
|
|
this.onLogRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
|
|
|
this.onErrorMessageDialogRequiredObservable = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
|
|
|
this.onPreviewCommandActivated = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
|
|
|
+ this.onLightUpdated = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
|
|
|
this.onPreviewBackgroundChanged = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
|
|
|
this.onBackFaceCullingChanged = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
|
|
|
this.onAnimationCommandActivated = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]();
|
|
|
this.blockKeyboardEvents = false;
|
|
|
this.previewMeshType = _dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadNumber("PreviewMeshType", _components_preview_previewMeshType__WEBPACK_IMPORTED_MODULE_1__["PreviewMeshType"].Box);
|
|
|
this.backFaceCulling = _dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadBoolean("BackFaceCulling", true);
|
|
|
+ this.hemisphericLight = _dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadBoolean("HemisphericLight", true);
|
|
|
+ this.directionalLight0 = _dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadBoolean("DirectionalLight0", true);
|
|
|
var r = _dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadNumber("BackgroundColorR", 0.37);
|
|
|
var g = _dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadNumber("BackgroundColorG", 0.37);
|
|
|
var b = _dataStorage__WEBPACK_IMPORTED_MODULE_2__["DataStorage"].ReadNumber("BackgroundColorB", 0.37);
|