Ver código fonte

Merge pull request #8363 from bhouston/pmrem_default_size

Fix PMREM cubemap size at 256 for performance reasons
Mr.doob 9 anos atrás
pai
commit
4659fb21cd
1 arquivos alterados com 2 adições e 19 exclusões
  1. 2 19
      examples/js/pmrem/PMREMGenerator.js

+ 2 - 19
examples/js/pmrem/PMREMGenerator.js

@@ -11,27 +11,10 @@
  *  by this class.
  *  by this class.
  */
  */
 
 
- THREE.PMREMGenerator = function( sourceTexture ) {
-	if ( sourceTexture instanceof THREE.CubeTexture ) {
+THREE.PMREMGenerator = function( sourceTexture ) {
 
 
-		if ( sourceTexture.images[ 0 ] === undefined )
-		  console.error( "sourceTexture Not Initialized" );
-      if(sourceTexture.images[ 0 ] instanceof THREE.DataTexture) {
-          this.resolution = sourceTexture.images[ 0 ].image.width;
-      }
-      else {
-          this.resolution = sourceTexture.images[ 0 ].width;
-      }
-
-	}
-	else if ( sourceTexture instanceof THREE.WebGLRenderTargetCube ) {
-		if ( sourceTexture === undefined ) console.error( "Render Target Not Initialized" );
-		this.resolution = sourceTexture.width;
-	}
-	else {
-		console.error( "Wrong Input to PMREMGenerator" );
-	}
 	this.sourceTexture = sourceTexture;
 	this.sourceTexture = sourceTexture;
+  this.resolution = 256; // NODE: 256 is currently hard coded in the glsl code for performance reasons
 
 
   var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
   var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
     ( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );
     ( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );