Skip to content

Commit 27f0400

Browse files
authored
RenderTarget: Clean up. (#26775)
* RenderTarget: Clean up. * use `Object.assign()` * remove duplicate code
1 parent 72d0d3c commit 27f0400

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Diff for: src/core/RenderTarget.js

+16-7
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,29 @@ class RenderTarget extends EventDispatcher {
3737

3838
}
3939

40+
options = Object.assign( {
41+
generateMipmaps: false,
42+
internalFormat: null,
43+
minFilter: LinearFilter,
44+
depthBuffer: true,
45+
stencilBuffer: false,
46+
depthTexture: null,
47+
samples: 0
48+
}, options );
49+
4050
this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
4151
this.texture.isRenderTargetTexture = true;
4252

4353
this.texture.flipY = false;
44-
this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
45-
this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
46-
this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
54+
this.texture.generateMipmaps = options.generateMipmaps;
55+
this.texture.internalFormat = options.internalFormat;
4756

48-
this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
49-
this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
57+
this.depthBuffer = options.depthBuffer;
58+
this.stencilBuffer = options.stencilBuffer;
5059

51-
this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
60+
this.depthTexture = options.depthTexture;
5261

53-
this.samples = options.samples !== undefined ? options.samples : 0;
62+
this.samples = options.samples;
5463

5564
}
5665

0 commit comments

Comments
 (0)