Skip to content

Commit 02f9252

Browse files
committed
src: Default value for ES6 and clean up.
1 parent cd1b695 commit 02f9252

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

src/core/InstancedBufferAttribute.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BufferAttribute } from './BufferAttribute.js';
22

33
class InstancedBufferAttribute extends BufferAttribute {
44

5-
constructor( array, itemSize, normalized, meshPerAttribute ) {
5+
constructor( array, itemSize, normalized, meshPerAttribute = 1 ) {
66

77
if ( typeof normalized === 'number' ) {
88

@@ -16,7 +16,7 @@ class InstancedBufferAttribute extends BufferAttribute {
1616

1717
super( array, itemSize, normalized );
1818

19-
this.meshPerAttribute = meshPerAttribute || 1;
19+
this.meshPerAttribute = meshPerAttribute;
2020

2121
}
2222

@@ -30,7 +30,7 @@ class InstancedBufferAttribute extends BufferAttribute {
3030

3131
}
3232

33-
toJSON() {
33+
toJSON() {
3434

3535
const data = super.toJSON();
3636

src/extras/Earcut.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
const Earcut = {
66

7-
triangulate: function ( data, holeIndices, dim ) {
8-
9-
dim = dim || 2;
7+
triangulate: function ( data, holeIndices, dim = 2 ) {
108

119
const hasHoles = holeIndices && holeIndices.length;
1210
const outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;

src/renderers/WebGLRenderTarget.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Vector4 } from '../math/Vector4.js';
1010
*/
1111
class WebGLRenderTarget extends EventDispatcher {
1212

13-
constructor( width, height, options ) {
13+
constructor( width, height, options = {} ) {
1414

1515
super();
1616

@@ -23,8 +23,6 @@ class WebGLRenderTarget extends EventDispatcher {
2323

2424
this.viewport = new Vector4( 0, 0, width, height );
2525

26-
options = options || {};
27-
2826
this.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
2927

3028
this.texture.image = { width: width, height: height, depth: 1 };

src/renderers/WebGLRenderer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ function createCanvasElement() {
5151

5252
}
5353

54-
function WebGLRenderer( parameters ) {
55-
56-
parameters = parameters || {};
54+
function WebGLRenderer( parameters = {} ) {
5755

5856
const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(),
5957
_context = parameters.context !== undefined ? parameters.context : null,

src/textures/DataTexture.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { NearestFilter } from '../constants.js';
33

44
class DataTexture extends Texture {
55

6-
constructor( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
6+
constructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, encoding ) {
77

88
super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
99

10-
this.image = { data: data || null, width: width || 1, height: height || 1 };
10+
this.image = { data: data, width: width, height: height };
1111

12-
this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
13-
this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
12+
this.magFilter = magFilter;
13+
this.minFilter = minFilter;
1414

1515
this.generateMipmaps = false;
1616
this.flipY = false;

0 commit comments

Comments
 (0)