|
@@ -266,6 +266,7 @@ function Viewport( editor ) {
|
|
controls.center.set( 0, 0, 0 );
|
|
controls.center.set( 0, 0, 0 );
|
|
pathtracer.reset();
|
|
pathtracer.reset();
|
|
|
|
|
|
|
|
+ initPT();
|
|
render();
|
|
render();
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -362,6 +363,7 @@ function Viewport( editor ) {
|
|
|
|
|
|
signals.sceneGraphChanged.add( function () {
|
|
signals.sceneGraphChanged.add( function () {
|
|
|
|
|
|
|
|
+ initPT();
|
|
render();
|
|
render();
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -411,6 +413,7 @@ function Viewport( editor ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ initPT();
|
|
render();
|
|
render();
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -437,6 +440,7 @@ function Viewport( editor ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ initPT();
|
|
render();
|
|
render();
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -444,6 +448,7 @@ function Viewport( editor ) {
|
|
signals.objectRemoved.add( function ( object ) {
|
|
signals.objectRemoved.add( function ( object ) {
|
|
|
|
|
|
controls.enabled = true; // see #14180
|
|
controls.enabled = true; // see #14180
|
|
|
|
+
|
|
if ( object === transformControls.object ) {
|
|
if ( object === transformControls.object ) {
|
|
|
|
|
|
transformControls.detach();
|
|
transformControls.detach();
|
|
@@ -454,6 +459,7 @@ function Viewport( editor ) {
|
|
|
|
|
|
signals.materialChanged.add( function () {
|
|
signals.materialChanged.add( function () {
|
|
|
|
|
|
|
|
+ initPT();
|
|
render();
|
|
render();
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -507,6 +513,7 @@ function Viewport( editor ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ initPT();
|
|
render();
|
|
render();
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -529,6 +536,7 @@ function Viewport( editor ) {
|
|
useBackgroundAsEnvironment = true;
|
|
useBackgroundAsEnvironment = true;
|
|
|
|
|
|
scene.environment = scene.background;
|
|
scene.environment = scene.background;
|
|
|
|
+ scene.environment.mapping = THREE.EquirectangularReflectionMapping;
|
|
scene.environmentRotation.y = scene.backgroundRotation.y;
|
|
scene.environmentRotation.y = scene.backgroundRotation.y;
|
|
|
|
|
|
break;
|
|
break;
|
|
@@ -537,8 +545,8 @@ function Viewport( editor ) {
|
|
|
|
|
|
if ( environmentEquirectangularTexture ) {
|
|
if ( environmentEquirectangularTexture ) {
|
|
|
|
|
|
- environmentEquirectangularTexture.mapping = THREE.EquirectangularReflectionMapping;
|
|
|
|
scene.environment = environmentEquirectangularTexture;
|
|
scene.environment = environmentEquirectangularTexture;
|
|
|
|
+ scene.environment.mapping = THREE.EquirectangularReflectionMapping;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -552,6 +560,7 @@ function Viewport( editor ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ initPT();
|
|
render();
|
|
render();
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -731,6 +740,22 @@ function Viewport( editor ) {
|
|
|
|
|
|
if ( needsUpdate === true ) render();
|
|
if ( needsUpdate === true ) render();
|
|
|
|
|
|
|
|
+ updatePT();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function initPT() {
|
|
|
|
+
|
|
|
|
+ if ( editor.viewportShading === 'realistic' ) {
|
|
|
|
+
|
|
|
|
+ pathtracer.init( scene, camera );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function updatePT() {
|
|
|
|
+
|
|
if ( editor.viewportShading === 'realistic' ) {
|
|
if ( editor.viewportShading === 'realistic' ) {
|
|
|
|
|
|
pathtracer.update();
|
|
pathtracer.update();
|
|
@@ -746,12 +771,6 @@ function Viewport( editor ) {
|
|
|
|
|
|
function render() {
|
|
function render() {
|
|
|
|
|
|
- if ( editor.viewportShading === 'realistic' ) {
|
|
|
|
-
|
|
|
|
- pathtracer.init( scene, camera );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
startTime = performance.now();
|
|
startTime = performance.now();
|
|
|
|
|
|
renderer.setViewport( 0, 0, container.dom.offsetWidth, container.dom.offsetHeight );
|
|
renderer.setViewport( 0, 0, container.dom.offsetWidth, container.dom.offsetHeight );
|