|
@@ -22,6 +22,7 @@ export class PreviewManager {
|
|
private _onAnimationCommandActivatedObserver: Nullable<Observer<void>>;
|
|
private _onAnimationCommandActivatedObserver: Nullable<Observer<void>>;
|
|
private _onUpdateRequiredObserver: Nullable<Observer<void>>;
|
|
private _onUpdateRequiredObserver: Nullable<Observer<void>>;
|
|
private _onPreviewBackgroundChangedObserver: Nullable<Observer<void>>;
|
|
private _onPreviewBackgroundChangedObserver: Nullable<Observer<void>>;
|
|
|
|
+ private _onBackFaceCullingChangedObserver: Nullable<Observer<void>>;
|
|
private _engine: Engine;
|
|
private _engine: Engine;
|
|
private _scene: Scene;
|
|
private _scene: Scene;
|
|
private _light: HemisphericLight;
|
|
private _light: HemisphericLight;
|
|
@@ -57,6 +58,11 @@ export class PreviewManager {
|
|
this._handleAnimations();
|
|
this._handleAnimations();
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ this._onBackFaceCullingChangedObserver = globalState.onBackFaceCullingChanged.add(() => {
|
|
|
|
+ let serializationObject = this._nodeMaterial.serialize();
|
|
|
|
+ this._updatePreview(serializationObject);
|
|
|
|
+ });
|
|
|
|
+
|
|
this._engine = new Engine(targetCanvas, true);
|
|
this._engine = new Engine(targetCanvas, true);
|
|
this._scene = new Scene(this._engine);
|
|
this._scene = new Scene(this._engine);
|
|
this._camera = new ArcRotateCamera("Camera", 0, 0.8, 4, Vector3.Zero(), this._scene);
|
|
this._camera = new ArcRotateCamera("Camera", 0, 0.8, 4, Vector3.Zero(), this._scene);
|
|
@@ -190,6 +196,8 @@ export class PreviewManager {
|
|
try {
|
|
try {
|
|
let tempMaterial = NodeMaterial.Parse(serializationObject, this._scene);
|
|
let tempMaterial = NodeMaterial.Parse(serializationObject, this._scene);
|
|
|
|
|
|
|
|
+ tempMaterial.backFaceCulling = this._globalState.backFaceCulling;
|
|
|
|
+
|
|
if (this._meshes.length) {
|
|
if (this._meshes.length) {
|
|
let tasks = this._meshes.map(m => this._forceCompilationAsync(tempMaterial, m));
|
|
let tasks = this._meshes.map(m => this._forceCompilationAsync(tempMaterial, m));
|
|
|
|
|
|
@@ -218,6 +226,7 @@ export class PreviewManager {
|
|
this._globalState.onUpdateRequiredObservable.remove(this._onUpdateRequiredObserver);
|
|
this._globalState.onUpdateRequiredObservable.remove(this._onUpdateRequiredObserver);
|
|
this._globalState.onAnimationCommandActivated.remove(this._onAnimationCommandActivatedObserver);
|
|
this._globalState.onAnimationCommandActivated.remove(this._onAnimationCommandActivatedObserver);
|
|
this._globalState.onPreviewBackgroundChanged.remove(this._onPreviewBackgroundChangedObserver);
|
|
this._globalState.onPreviewBackgroundChanged.remove(this._onPreviewBackgroundChangedObserver);
|
|
|
|
+ this._globalState.onBackFaceCullingChanged.remove(this._onBackFaceCullingChangedObserver);
|
|
|
|
|
|
if (this._material) {
|
|
if (this._material) {
|
|
this._material.dispose();
|
|
this._material.dispose();
|