File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 2020
2121 var camera , scene , renderer ;
2222 var mesh ;
23+ var AMOUNT = 6 ;
2324
2425 init ( ) ;
2526 animate ( ) ;
2829
2930 var ASPECT_RATIO = window . innerWidth / window . innerHeight ;
3031
31- var AMOUNT = 6 ;
3232 var WIDTH = ( window . innerWidth / AMOUNT ) * window . devicePixelRatio ;
3333 var HEIGHT = ( window . innerHeight / AMOUNT ) * window . devicePixelRatio ;
3434
9595
9696 function onWindowResize ( ) {
9797
98- camera . aspect = window . innerWidth / window . innerHeight ;
98+ var ASPECT_RATIO = window . innerWidth / window . innerHeight ;
99+ var WIDTH = ( window . innerWidth / AMOUNT ) * window . devicePixelRatio ;
100+ var HEIGHT = ( window . innerHeight / AMOUNT ) * window . devicePixelRatio ;
101+
102+ camera . aspect = ASPECT_RATIO ;
99103 camera . updateProjectionMatrix ( ) ;
100104
105+ for ( var y = 0 ; y < AMOUNT ; y ++ ) {
106+
107+ for ( var x = 0 ; x < AMOUNT ; x ++ ) {
108+
109+ var subcamera = camera . cameras [ AMOUNT * y + x ] ;
110+
111+ subcamera . viewport . set (
112+ Math . floor ( x * WIDTH ) ,
113+ Math . floor ( y * HEIGHT ) ,
114+ Math . ceil ( WIDTH ) ,
115+ Math . ceil ( HEIGHT ) ) ;
116+
117+ subcamera . aspect = ASPECT_RATIO ;
118+ subcamera . updateProjectionMatrix ( ) ;
119+
120+ }
121+ }
122+
101123 renderer . setSize ( window . innerWidth , window . innerHeight ) ;
102124
103125 }
You can’t perform that action at this time.
0 commit comments