소스 검색

Examples: add resize event for `webgl_postprocessing_crossfade.html` (#28172)

林炳权 1 년 전
부모
커밋
e462f0e7cd
1개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. 18 0
      examples/webgl_postprocessing_crossfade.html

+ 18 - 0
examples/webgl_postprocessing_crossfade.html

@@ -72,6 +72,16 @@
 
 				transition = new Transition( sceneA, sceneB );
 
+				window.addEventListener( 'resize', onWindowResize );
+
+				function onWindowResize() {
+
+					sceneA.resize();
+					sceneB.resize();
+					renderer.setSize( window.innerWidth, window.innerHeight );
+
+				}
+
 			}
 
 			function animate() {
@@ -208,6 +218,14 @@
 
 				};
 
+				this.resize = function () {
+
+					camera.aspect = window.innerWidth / window.innerHeight;
+					camera.updateProjectionMatrix();
+					this.fbo.setSize( window.innerWidth, window.innerHeight );
+
+				};
+
 			}
 
 			function Transition( sceneA, sceneB ) {