diff --git a/src/core/InstancedBufferAttribute.js b/src/core/InstancedBufferAttribute.js index 0ece03a66d4785..01eee65b267e18 100644 --- a/src/core/InstancedBufferAttribute.js +++ b/src/core/InstancedBufferAttribute.js @@ -2,7 +2,7 @@ import { BufferAttribute } from './BufferAttribute.js'; class InstancedBufferAttribute extends BufferAttribute { - constructor( array, itemSize, normalized, meshPerAttribute ) { + constructor( array, itemSize, normalized, meshPerAttribute = 1 ) { if ( typeof normalized === 'number' ) { @@ -16,7 +16,7 @@ class InstancedBufferAttribute extends BufferAttribute { super( array, itemSize, normalized ); - this.meshPerAttribute = meshPerAttribute || 1; + this.meshPerAttribute = meshPerAttribute; } @@ -30,7 +30,7 @@ class InstancedBufferAttribute extends BufferAttribute { } - toJSON() { + toJSON() { const data = super.toJSON(); diff --git a/src/extras/Earcut.js b/src/extras/Earcut.js index 913f4ef5874d41..bcb49b4c51f0e0 100644 --- a/src/extras/Earcut.js +++ b/src/extras/Earcut.js @@ -4,9 +4,7 @@ const Earcut = { - triangulate: function ( data, holeIndices, dim ) { - - dim = dim || 2; + triangulate: function ( data, holeIndices, dim = 2 ) { const hasHoles = holeIndices && holeIndices.length; const outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length; diff --git a/src/renderers/WebGLRenderTarget.js b/src/renderers/WebGLRenderTarget.js index 4ed57e9489b100..a97b0de88baf7d 100644 --- a/src/renderers/WebGLRenderTarget.js +++ b/src/renderers/WebGLRenderTarget.js @@ -10,7 +10,7 @@ import { Vector4 } from '../math/Vector4.js'; */ class WebGLRenderTarget extends EventDispatcher { - constructor( width, height, options ) { + constructor( width, height, options = {} ) { super(); @@ -23,8 +23,6 @@ class WebGLRenderTarget extends EventDispatcher { this.viewport = new Vector4( 0, 0, width, height ); - options = options || {}; - this.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding ); this.texture.image = { width: width, height: height, depth: 1 }; diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index cc16d8d4b61000..d9d183b85a5888 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -51,9 +51,7 @@ function createCanvasElement() { } -function WebGLRenderer( parameters ) { - - parameters = parameters || {}; +function WebGLRenderer( parameters = {} ) { const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(), _context = parameters.context !== undefined ? parameters.context : null, diff --git a/src/textures/DataTexture.js b/src/textures/DataTexture.js index acd56f830a2b74..40ecf12c4e399a 100644 --- a/src/textures/DataTexture.js +++ b/src/textures/DataTexture.js @@ -3,14 +3,14 @@ import { NearestFilter } from '../constants.js'; class DataTexture extends Texture { - constructor( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) { + constructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, encoding ) { super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); - this.image = { data: data || null, width: width || 1, height: height || 1 }; + this.image = { data: data, width: width, height: height }; - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; + this.magFilter = magFilter; + this.minFilter = minFilter; this.generateMipmaps = false; this.flipY = false;