提交 94743d10 编写于 作者: R Richard Monette

use options hash

上级 ad597c55
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
* @author Richard M. / https://github.com/richardmonette * @author Richard M. / https://github.com/richardmonette
*/ */
THREE.EquiangularToCubeGenerator = function ( sourceTexture, resolution, type, format ) { THREE.EquiangularToCubeGenerator = function ( sourceTexture, options ) {
this.sourceTexture = sourceTexture; this.sourceTexture = sourceTexture;
this.resolution = resolution; this.resolution = options.resolution || 512;
this.views = [ this.views = [
{ t: [ 1, 0, 0 ], u: [ 0, - 1, 0 ] }, { t: [ 1, 0, 0 ], u: [ 0, - 1, 0 ] },
...@@ -23,10 +23,10 @@ THREE.EquiangularToCubeGenerator = function ( sourceTexture, resolution, type, f ...@@ -23,10 +23,10 @@ THREE.EquiangularToCubeGenerator = function ( sourceTexture, resolution, type, f
this.scene.add( this.boxMesh ); this.scene.add( this.boxMesh );
var params = { var params = {
format: format ? format : this.sourceTexture.format, format: options.format || this.sourceTexture.format,
magFilter: this.sourceTexture.magFilter, magFilter: this.sourceTexture.magFilter,
minFilter: this.sourceTexture.minFilter, minFilter: this.sourceTexture.minFilter,
type: type ? type : this.sourceTexture.type, type: options.type || this.sourceTexture.type,
generateMipmaps: this.sourceTexture.generateMipmaps, generateMipmaps: this.sourceTexture.generateMipmaps,
anisotropy: this.sourceTexture.anisotropy, anisotropy: this.sourceTexture.anisotropy,
encoding: this.sourceTexture.encoding encoding: this.sourceTexture.encoding
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
texture.magFilter = THREE.NearestFilter; texture.magFilter = THREE.NearestFilter;
texture.encoding = THREE.LinearEncoding; texture.encoding = THREE.LinearEncoding;
var cubemapGenerator = new THREE.EquiangularToCubeGenerator( texture, 512, THREE.HalfFloatType ); var cubemapGenerator = new THREE.EquiangularToCubeGenerator( texture, { resolution: 512, type: THREE.HalfFloatType } );
var cubeMapTexture = cubemapGenerator.update( renderer ); var cubeMapTexture = cubemapGenerator.update( renderer );
var pmremGenerator = new THREE.PMREMGenerator( cubeMapTexture ); var pmremGenerator = new THREE.PMREMGenerator( cubeMapTexture );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册