Browse Source

Add some explanatory comments around reading the projection matrix

Jason Johnston 3 years ago
parent
commit
3cef1d8c89
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/three/TilesRenderer.js

+ 7 - 0
src/three/TilesRenderer.js

@@ -391,17 +391,24 @@ export class TilesRenderer extends TilesRendererBase {
 
 
 			}
 			}
 
 
+			// Read the calculated projection matrix directly to support custom Camera implementations
 			const projection = camera.projectionMatrix.elements;
 			const projection = camera.projectionMatrix.elements;
+
+			// The last element of the projection matrix is 1 for orthographic, 0 for perspective
 			info.isOrthographic = projection[ 15 ] === 1;
 			info.isOrthographic = projection[ 15 ] === 1;
 
 
 			if ( info.isOrthographic ) {
 			if ( info.isOrthographic ) {
 
 
+				// See OrthographicCamera.updateProjectionMatrix and Matrix4.makeOrthographic:
+				// the view width and height are used to populate matrix elements 0 and 5.
 				const w = 2 / projection[ 0 ];
 				const w = 2 / projection[ 0 ];
 				const h = 2 / projection[ 5 ];
 				const h = 2 / projection[ 5 ];
 				info.pixelSize = Math.max( h / resolution.height, w / resolution.width );
 				info.pixelSize = Math.max( h / resolution.height, w / resolution.width );
 
 
 			} else {
 			} else {
 
 
+				// See PerspectiveCamera.updateProjectionMatrix and Matrix4.makePerspective:
+				// the vertical FOV is used to populate matrix element 5.
 				info.sseDenominator = ( 2 / projection[ 5 ] ) / resolution.height;
 				info.sseDenominator = ( 2 / projection[ 5 ] ) / resolution.height;
 
 
 			}
 			}