|
@@ -47,6 +47,44 @@ function WebGLMultiview( requested, gl, canvas, extensions, capabilities, proper
|
|
depthStencil: null
|
|
depthStencil: null
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ this.computeCameraMatrices = function ( camera ) {
|
|
|
|
+
|
|
|
|
+ if ( ! camera.projectionMatrices ) {
|
|
|
|
+
|
|
|
|
+ camera.projectionMatrices = new Array( numViews );
|
|
|
|
+ camera.viewMatrices = new Array( numViews );
|
|
|
|
+
|
|
|
|
+ for ( var i = 0; i < numViews; i ++ ) {
|
|
|
|
+
|
|
|
|
+ camera.projectionMatrices[ i ] = new Matrix4();
|
|
|
|
+ camera.viewMatrices[ i ] = new Matrix4();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ( camera.isArrayCamera ) {
|
|
|
|
+
|
|
|
|
+ for ( var i = 0; i < numViews; i ++ ) {
|
|
|
|
+
|
|
|
|
+ camera.projectionMatrices[ i ].copy( camera.cameras[ i ].projectionMatrix );
|
|
|
|
+ camera.viewMatrices[ i ].copy( camera.cameras[ i ].matrixWorldInverse );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ for ( var i = 0; i < numViews; i ++ ) {
|
|
|
|
+
|
|
|
|
+ camera.projectionMatrices[ i ].copy( camera.projectionMatrix );
|
|
|
|
+ camera.viewMatrices[ i ].copy( camera.matrixWorldInverse );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
this.computeObjectMatrices = function ( object, camera ) {
|
|
this.computeObjectMatrices = function ( object, camera ) {
|
|
|
|
|
|
if ( ! object.modelViewMatrices ) {
|
|
if ( ! object.modelViewMatrices ) {
|
|
@@ -78,7 +116,7 @@ function WebGLMultiview( requested, gl, canvas, extensions, capabilities, proper
|
|
object.modelViewMatrices[ 0 ].multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
|
|
object.modelViewMatrices[ 0 ].multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
|
|
object.normalMatrices[ 0 ].getNormalMatrix( object.modelViewMatrices[ 0 ] );
|
|
object.normalMatrices[ 0 ].getNormalMatrix( object.modelViewMatrices[ 0 ] );
|
|
|
|
|
|
- for ( var i = 0; i < numViews; i ++ ) {
|
|
|
|
|
|
+ for ( var i = 1; i < numViews; i ++ ) {
|
|
|
|
|
|
object.modelViewMatrices[ i ].copy( object.modelViewMatrices[ 0 ] );
|
|
object.modelViewMatrices[ i ].copy( object.modelViewMatrices[ 0 ] );
|
|
object.normalMatrices[ i ].copy( object.normalMatrices[ 0 ] );
|
|
object.normalMatrices[ i ].copy( object.normalMatrices[ 0 ] );
|