Prechádzať zdrojové kódy

Use ES6 default parameters. (#21545)

linbingquan 4 rokov pred
rodič
commit
b098ddd290
2 zmenil súbory, kde vykonal 5 pridanie a 5 odobranie
  1. 3 3
      src/scenes/Fog.js
  2. 2 2
      src/scenes/FogExp2.js

+ 3 - 3
src/scenes/Fog.js

@@ -2,14 +2,14 @@ import { Color } from '../math/Color.js';
 
 class Fog {
 
-	constructor( color, near, far ) {
+	constructor( color, near = 1, far = 1000 ) {
 
 		this.name = '';
 
 		this.color = new Color( color );
 
-		this.near = ( near !== undefined ) ? near : 1;
-		this.far = ( far !== undefined ) ? far : 1000;
+		this.near = near;
+		this.far = far;
 
 	}
 

+ 2 - 2
src/scenes/FogExp2.js

@@ -2,12 +2,12 @@ import { Color } from '../math/Color.js';
 
 class FogExp2 {
 
-	constructor( color, density ) {
+	constructor( color, density = 0.00025 ) {
 
 		this.name = '';
 
 		this.color = new Color( color );
-		this.density = ( density !== undefined ) ? density : 0.00025;
+		this.density = density;
 
 	}