浏览代码

Merge branch 'cubemap-param-overrides' of https://github.com/richardmonette/three.js into dev

# Conflicts:
#	examples/js/loaders/EquirectangularToCubeGenerator.js
#	examples/webgl_materials_envmaps_exr.html
Mr.doob 7 年之前
父节点
当前提交
f08d22f751
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. 4 4
      examples/js/loaders/EquirectangularToCubeGenerator.js
  2. 1 1
      examples/webgl_materials_envmaps_exr.html

+ 4 - 4
examples/js/loaders/EquirectangularToCubeGenerator.js

@@ -2,10 +2,10 @@
 * @author Richard M. / https://github.com/richardmonette
 */
 
-THREE.EquirectangularToCubeGenerator = function ( sourceTexture, resolution ) {
+THREE.EquirectangularToCubeGenerator = function ( sourceTexture, options ) {
 
 	this.sourceTexture = sourceTexture;
-	this.resolution = resolution;
+	this.resolution = options.resolution || 512;
 
  	this.views = [
 		{ t: [ 1, 0, 0 ], u: [ 0, - 1, 0 ] },
@@ -23,10 +23,10 @@ THREE.EquirectangularToCubeGenerator = function ( sourceTexture, resolution ) {
 	this.scene.add( this.boxMesh );
 
 	var params = {
-		format: THREE.RGBAFormat,
+		format: options.format || this.sourceTexture.format,
 		magFilter: this.sourceTexture.magFilter,
 		minFilter: this.sourceTexture.minFilter,
-		type: this.sourceTexture.type,
+		type: options.type || this.sourceTexture.type,
 		generateMipmaps: this.sourceTexture.generateMipmaps,
 		anisotropy: this.sourceTexture.anisotropy,
 		encoding: this.sourceTexture.encoding

+ 1 - 1
examples/webgl_materials_envmaps_exr.html

@@ -106,7 +106,7 @@
 					texture.magFilter = THREE.NearestFilter;
 					texture.encoding = THREE.LinearEncoding;
 
-					var cubemapGenerator = new THREE.EquirectangularToCubeGenerator( texture, 512 );
+					var cubemapGenerator = new THREE.EquirectangularToCubeGenerator( texture, { resolution: 512, type: THREE.HalfFloatType } );
 					var cubeMapTexture = cubemapGenerator.update( renderer );
 
 					var pmremGenerator = new THREE.PMREMGenerator( cubeMapTexture );