Skip to content

Commit b514505

Browse files
committed
pick a good default PMREMGenerator cube size, and allow it to be overriden.
1 parent 3606d2f commit b514505

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

examples/js/pmrem/PMREMGenerator.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,10 @@
1111
* by this class.
1212
*/
1313

14-
THREE.PMREMGenerator = function( sourceTexture ) {
15-
if ( sourceTexture instanceof THREE.CubeTexture ) {
14+
THREE.PMREMGenerator = function( sourceTexture, resolution ) {
1615

17-
if ( sourceTexture.images[ 0 ] === undefined )
18-
console.error( "sourceTexture Not Initialized" );
19-
if(sourceTexture.images[ 0 ] instanceof THREE.DataTexture) {
20-
this.resolution = sourceTexture.images[ 0 ].image.width;
21-
}
22-
else {
23-
this.resolution = sourceTexture.images[ 0 ].width;
24-
}
25-
26-
}
27-
else if ( sourceTexture instanceof THREE.WebGLRenderTargetCube ) {
28-
if ( sourceTexture === undefined ) console.error( "Render Target Not Initialized" );
29-
this.resolution = sourceTexture.width;
30-
}
31-
else {
32-
console.error( "Wrong Input to PMREMGenerator" );
33-
}
3416
this.sourceTexture = sourceTexture;
17+
this.resolution = ( resolution !== undefined ) ? resolution : 256;
3518

3619
var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
3720
( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );

0 commit comments

Comments
 (0)