Mr.doob 6 роки тому
батько
коміт
fde9b0ed71
2 змінених файлів з 35 додано та 27 видалено
  1. 18 14
      src/scenes/Fog.js
  2. 17 13
      src/scenes/FogExp2.js

+ 18 - 14
src/scenes/Fog.js

@@ -1,10 +1,10 @@
-import { Color } from '../math/Color.js';
-
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author alteredq / http://alteredqualia.com/
  */
 
+import { Color } from '../math/Color.js';
+
 function Fog( color, near, far ) {
 
 	this.name = '';
@@ -16,23 +16,27 @@ function Fog( color, near, far ) {
 
 }
 
-Fog.prototype.isFog = true;
+Object.assign( Fog.prototype, {
+
+	isFog: true,
+
+	clone: function () {
 
-Fog.prototype.clone = function () {
+		return new Fog( this.color, this.near, this.far );
 
-	return new Fog( this.color, this.near, this.far );
+	},
 
-};
+	toJSON: function ( /* meta */ ) {
 
-Fog.prototype.toJSON = function ( /* meta */ ) {
+		return {
+			type: 'Fog',
+			color: this.color.getHex(),
+			near: this.near,
+			far: this.far
+		}
 
-	return {
-		type: 'Fog',
-		color: this.color.getHex(),
-		near: this.near,
-		far: this.far
-	};
+	}
 
-};
+} );
 
 export { Fog };

+ 17 - 13
src/scenes/FogExp2.js

@@ -1,10 +1,10 @@
-import { Color } from '../math/Color.js';
-
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author alteredq / http://alteredqualia.com/
  */
 
+import { Color } from '../math/Color.js';
+
 function FogExp2( color, density ) {
 
 	this.name = '';
@@ -14,22 +14,26 @@ function FogExp2( color, density ) {
 
 }
 
-FogExp2.prototype.isFogExp2 = true;
+Object.assign( FogExp2.prototype, {
+
+	isFogExp2: true,
+
+	clone: function () {
 
-FogExp2.prototype.clone = function () {
+		return new FogExp2( this.color, this.density );
 
-	return new FogExp2( this.color, this.density );
+	},
 
-};
+	toJSON: function ( /* meta */ ) {
 
-FogExp2.prototype.toJSON = function ( /* meta */ ) {
+		return {
+			type: 'FogExp2',
+			color: this.color.getHex(),
+			density: this.density
+		};
 
-	return {
-		type: 'FogExp2',
-		color: this.color.getHex(),
-		density: this.density
-	};
+	}
 
-};
+} );
 
 export { FogExp2 };