Przeglądaj źródła

Revert to *.prototype.is* = true

Mr.doob 4 lat temu
rodzic
commit
15ab0e6e6a
45 zmienionych plików z 83 dodań i 82 usunięć
  1. 2 2
      src/extras/core/Font.js
  2. 2 1
      src/extras/curves/ArcCurve.js
  3. 3 1
      src/extras/curves/CatmullRomCurve3.js
  4. 2 1
      src/extras/curves/CubicBezierCurve.js
  5. 2 1
      src/extras/curves/CubicBezierCurve3.js
  6. 2 1
      src/extras/curves/EllipseCurve.js
  7. 2 1
      src/extras/curves/LineCurve.js
  8. 2 1
      src/extras/curves/QuadraticBezierCurve.js
  9. 2 1
      src/extras/curves/QuadraticBezierCurve3.js
  10. 2 1
      src/extras/curves/SplineCurve.js
  11. 1 1
      src/lights/AmbientLight.js
  12. 2 2
      src/lights/AmbientLightProbe.js
  13. 2 2
      src/lights/DirectionalLight.js
  14. 2 2
      src/lights/DirectionalLightShadow.js
  15. 2 2
      src/lights/HemisphereLight.js
  16. 2 2
      src/lights/HemisphereLightProbe.js
  17. 2 2
      src/lights/Light.js
  18. 2 2
      src/lights/LightProbe.js
  19. 2 2
      src/lights/PointLight.js
  20. 2 2
      src/lights/PointLightShadow.js
  21. 2 2
      src/lights/RectAreaLight.js
  22. 2 2
      src/lights/SpotLight.js
  23. 2 2
      src/lights/SpotLightShadow.js
  24. 1 2
      src/math/Box2.js
  25. 2 2
      src/math/Box3.js
  26. 2 3
      src/math/Color.js
  27. 2 2
      src/math/Euler.js
  28. 2 2
      src/math/Matrix3.js
  29. 2 2
      src/math/Matrix4.js
  30. 1 2
      src/math/Plane.js
  31. 2 2
      src/math/Quaternion.js
  32. 1 2
      src/math/SphericalHarmonics3.js
  33. 1 2
      src/math/Vector2.js
  34. 2 2
      src/math/Vector3.js
  35. 2 2
      src/math/Vector4.js
  36. 2 1
      src/objects/Group.js
  37. 2 3
      src/objects/LineLoop.js
  38. 2 2
      src/objects/Sprite.js
  39. 1 2
      src/renderers/WebGLCubeRenderTarget.js
  40. 1 2
      src/renderers/WebGLMultisampleRenderTarget.js
  41. 1 2
      src/renderers/WebGLRenderTarget.js
  42. 1 2
      src/scenes/Fog.js
  43. 1 2
      src/scenes/FogExp2.js
  44. 1 2
      src/scenes/Scene.js
  45. 5 3
      test/unit/src/core/Object3D.tests.js

+ 2 - 2
src/extras/core/Font.js

@@ -4,8 +4,6 @@ class Font {
 
 	constructor( data ) {
 
-		this.isFont = true;
-
 		this.type = 'Font';
 
 		this.data = data;
@@ -140,4 +138,6 @@ function createPath( char, scale, offsetX, offsetY, data ) {
 
 }
 
+Font.prototype.isFont = true;
+
 export { Font };

+ 2 - 1
src/extras/curves/ArcCurve.js

@@ -7,10 +7,11 @@ class ArcCurve extends EllipseCurve {
 		super( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );
 
 		this.type = 'ArcCurve';
-		this.isArcCurve = true;
 
 	}
 
 }
 
+ArcCurve.prototype.isArcCurve = true;
+
 export { ArcCurve };

+ 3 - 1
src/extras/curves/CatmullRomCurve3.js

@@ -88,7 +88,7 @@ class CatmullRomCurve3 extends Curve {
 		super();
 
 		this.type = 'CatmullRomCurve3';
-		this.isCatmullRomCurve3 = true;
+
 		this.points = points;
 		this.closed = closed;
 		this.curveType = curveType;
@@ -248,4 +248,6 @@ class CatmullRomCurve3 extends Curve {
 
 }
 
+CatmullRomCurve3.prototype.isCatmullRomCurve3 = true;
+
 export { CatmullRomCurve3 };

+ 2 - 1
src/extras/curves/CubicBezierCurve.js

@@ -9,7 +9,6 @@ class CubicBezierCurve extends Curve {
 		super();
 
 		this.type = 'CubicBezierCurve';
-		this.isCubicBezierCurve = true;
 
 		this.v0 = v0;
 		this.v1 = v1;
@@ -74,4 +73,6 @@ class CubicBezierCurve extends Curve {
 
 }
 
+CubicBezierCurve.prototype.isCubicBezierCurve = true;
+
 export { CubicBezierCurve };

+ 2 - 1
src/extras/curves/CubicBezierCurve3.js

@@ -9,7 +9,6 @@ class CubicBezierCurve3 extends Curve {
 		super();
 
 		this.type = 'CubicBezierCurve3';
-		this.isCubicBezierCurve3 = true;
 
 		this.v0 = v0;
 		this.v1 = v1;
@@ -75,4 +74,6 @@ class CubicBezierCurve3 extends Curve {
 
 }
 
+CubicBezierCurve3.prototype.isCubicBezierCurve3 = true;
+
 export { CubicBezierCurve3 };

+ 2 - 1
src/extras/curves/EllipseCurve.js

@@ -8,7 +8,6 @@ class EllipseCurve extends Curve {
 		super();
 
 		this.type = 'EllipseCurve';
-		this.isEllipseCurve = true;
 
 		this.aX = aX;
 		this.aY = aY;
@@ -152,4 +151,6 @@ class EllipseCurve extends Curve {
 
 }
 
+EllipseCurve.prototype.isEllipseCurve = true;
+
 export { EllipseCurve };

+ 2 - 1
src/extras/curves/LineCurve.js

@@ -8,7 +8,6 @@ class LineCurve extends Curve {
 		super();
 
 		this.type = 'LineCurve';
-		this.isLineCurve = true;
 
 		this.v1 = v1;
 		this.v2 = v2;
@@ -86,4 +85,6 @@ class LineCurve extends Curve {
 
 }
 
+LineCurve.prototype.isLineCurve = true;
+
 export { LineCurve };

+ 2 - 1
src/extras/curves/QuadraticBezierCurve.js

@@ -9,7 +9,6 @@ class QuadraticBezierCurve extends Curve {
 		super();
 
 		this.type = 'QuadraticBezierCurve';
-		this.isQuadraticBezierCurve = true;
 
 		this.v0 = v0;
 		this.v1 = v1;
@@ -70,4 +69,6 @@ class QuadraticBezierCurve extends Curve {
 
 }
 
+QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;
+
 export { QuadraticBezierCurve };

+ 2 - 1
src/extras/curves/QuadraticBezierCurve3.js

@@ -9,7 +9,6 @@ class QuadraticBezierCurve3 extends Curve {
 		super();
 
 		this.type = 'QuadraticBezierCurve3';
-		this.isQuadraticBezierCurve3 = true;
 
 		this.v0 = v0;
 		this.v1 = v1;
@@ -71,4 +70,6 @@ class QuadraticBezierCurve3 extends Curve {
 
 }
 
+QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;
+
 export { QuadraticBezierCurve3 };

+ 2 - 1
src/extras/curves/SplineCurve.js

@@ -9,7 +9,6 @@ class SplineCurve extends Curve {
 		super();
 
 		this.type = 'SplineCurve';
-		this.isSplineCurve = true;
 
 		this.points = points;
 
@@ -93,4 +92,6 @@ class SplineCurve extends Curve {
 
 }
 
+SplineCurve.prototype.isSplineCurve = true;
+
 export { SplineCurve };

+ 1 - 1
src/lights/AmbientLight.js

@@ -7,11 +7,11 @@ class AmbientLight extends Light {
 		super( color, intensity );
 
 		this.type = 'AmbientLight';
-		this.isAmbientLight = true;
 
 	}
 
 }
 
+AmbientLight.prototype.isAmbientLight = true;
 
 export { AmbientLight };

+ 2 - 2
src/lights/AmbientLightProbe.js

@@ -7,8 +7,6 @@ class AmbientLightProbe extends LightProbe {
 
 		super( undefined, intensity );
 
-		this.isAmbientLightProbe = true;
-
 		const color1 = new Color().set( color );
 
 		// without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );
@@ -18,4 +16,6 @@ class AmbientLightProbe extends LightProbe {
 
 }
 
+AmbientLightProbe.prototype.isAmbientLightProbe = true;
+
 export { AmbientLightProbe };

+ 2 - 2
src/lights/DirectionalLight.js

@@ -8,8 +8,6 @@ class DirectionalLight extends Light {
 
 		super( color, intensity );
 
-		this.isDirectionalLight = true;
-
 		this.type = 'DirectionalLight';
 
 		this.position.copy( Object3D.DefaultUp );
@@ -34,4 +32,6 @@ class DirectionalLight extends Light {
 
 }
 
+DirectionalLight.prototype.isDirectionalLight = true;
+
 export { DirectionalLight };

+ 2 - 2
src/lights/DirectionalLightShadow.js

@@ -7,10 +7,10 @@ class DirectionalLightShadow extends LightShadow {
 
 		super( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );
 
-		this.isDirectionalLightShadow = true;
-
 	}
 
 }
 
+DirectionalLightShadow.prototype.isDirectionalLightShadow = true;
+
 export { DirectionalLightShadow };

+ 2 - 2
src/lights/HemisphereLight.js

@@ -8,8 +8,6 @@ class HemisphereLight extends Light {
 
 		super( skyColor, intensity );
 
-		this.isHemisphereLight = true;
-
 		this.type = 'HemisphereLight';
 
 		this.position.copy( Object3D.DefaultUp );
@@ -31,4 +29,6 @@ class HemisphereLight extends Light {
 
 }
 
+HemisphereLight.prototype.isHemisphereLight = true;
+
 export { HemisphereLight };

+ 2 - 2
src/lights/HemisphereLightProbe.js

@@ -8,8 +8,6 @@ class HemisphereLightProbe extends LightProbe {
 
 		super( undefined, intensity );
 
-		this.isHemisphereLightProbe = true;
-
 		const color1 = new Color().set( skyColor );
 		const color2 = new Color().set( groundColor );
 
@@ -27,4 +25,6 @@ class HemisphereLightProbe extends LightProbe {
 
 }
 
+HemisphereLightProbe.prototype.isHemisphereLightProbe = true;
+
 export { HemisphereLightProbe };

+ 2 - 2
src/lights/Light.js

@@ -7,8 +7,6 @@ class Light extends Object3D {
 
 		super();
 
-		this.isLight = true;
-
 		this.type = 'Light';
 
 		this.color = new Color( color );
@@ -49,4 +47,6 @@ class Light extends Object3D {
 
 }
 
+Light.prototype.isLight = true;
+
 export { Light };

+ 2 - 2
src/lights/LightProbe.js

@@ -7,8 +7,6 @@ class LightProbe extends Light {
 
 		super( undefined, intensity );
 
-		this.isLightProbe = true;
-
 		this.sh = sh;
 
 	}
@@ -44,4 +42,6 @@ class LightProbe extends Light {
 
 }
 
+LightProbe.prototype.isLightProbe = true;
+
 export { LightProbe };

+ 2 - 2
src/lights/PointLight.js

@@ -7,8 +7,6 @@ class PointLight extends Light {
 
 		super( color, intensity );
 
-		this.isPointLight = true;
-
 		this.type = 'PointLight';
 
 		this.distance = distance;
@@ -49,4 +47,6 @@ class PointLight extends Light {
 
 }
 
+PointLight.prototype.isPointLight = true;
+
 export { PointLight };

+ 2 - 2
src/lights/PointLightShadow.js

@@ -15,8 +15,6 @@ class PointLightShadow extends LightShadow {
 
 		super( new PerspectiveCamera( 90, 1, 0.5, 500 ) );
 
-		this.isPointLightShadow = true;
-
 		this._frameExtents = new Vector2( 4, 2 );
 
 		this._viewportCount = 6;
@@ -84,4 +82,6 @@ class PointLightShadow extends LightShadow {
 
 }
 
+PointLightShadow.prototype.isPointLightShadow = true;
+
 export { PointLightShadow };

+ 2 - 2
src/lights/RectAreaLight.js

@@ -6,8 +6,6 @@ class RectAreaLight extends Light {
 
 		super( color, intensity );
 
-		this.isRectAreaLight = true;
-
 		this.type = 'RectAreaLight';
 
 		this.width = width;
@@ -39,4 +37,6 @@ class RectAreaLight extends Light {
 
 }
 
+RectAreaLight.prototype.isRectAreaLight = true;
+
 export { RectAreaLight };

+ 2 - 2
src/lights/SpotLight.js

@@ -8,8 +8,6 @@ class SpotLight extends Light {
 
 		super( color, intensity );
 
-		this.isSpotLight = true;
-
 		this.type = 'SpotLight';
 
 		this.position.copy( Object3D.DefaultUp );
@@ -61,4 +59,6 @@ class SpotLight extends Light {
 
 }
 
+SpotLight.prototype.isSpotLight = true;
+
 export { SpotLight };

+ 2 - 2
src/lights/SpotLightShadow.js

@@ -8,8 +8,6 @@ class SpotLightShadow extends LightShadow {
 
 		super( new PerspectiveCamera( 50, 1, 0.5, 500 ) );
 
-		this.isSpotLightShadow = true;
-
 		this.focus = 1;
 
 	}
@@ -37,4 +35,6 @@ class SpotLightShadow extends LightShadow {
 
 }
 
+SpotLightShadow.prototype.isSpotLightShadow = true;
+
 export { SpotLightShadow };

+ 1 - 2
src/math/Box2.js

@@ -6,8 +6,6 @@ class Box2 {
 
 	constructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {
 
-		this.isBox2 = true;
-
 		this.min = min;
 		this.max = max;
 
@@ -228,5 +226,6 @@ class Box2 {
 
 }
 
+Box2.prototype.isBox2 = true;
 
 export { Box2 };

+ 2 - 2
src/math/Box3.js

@@ -62,8 +62,6 @@ class Box3 {
 
 	constructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {
 
-		this.isBox3 = true;
-
 		this.min = min;
 		this.max = max;
 
@@ -550,4 +548,6 @@ class Box3 {
 
 }
 
+Box3.prototype.isBox3 = true;
+
 export { Box3 };

+ 2 - 3
src/math/Color.js

@@ -55,8 +55,6 @@ class Color {
 
 	constructor( r, g, b ) {
 
-		this.isColor = true;
-
 		if ( g === undefined && b === undefined ) {
 
 			// r is THREE.Color, hex or string
@@ -604,9 +602,10 @@ class Color {
 }
 
 Color.NAMES = _colorKeywords;
+
+Color.prototype.isColor = true;
 Color.prototype.r = 1;
 Color.prototype.g = 1;
 Color.prototype.b = 1;
 
-
 export { Color };

+ 2 - 2
src/math/Euler.js

@@ -10,8 +10,6 @@ class Euler {
 
 	constructor( x = 0, y = 0, z = 0, order = Euler.DefaultOrder ) {
 
-		this.isEuler = true;
-		
 		this._x = x;
 		this._y = y;
 		this._z = z;
@@ -320,6 +318,8 @@ class Euler {
 
 }
 
+Euler.prototype.isEuler = true;
+
 Euler.DefaultOrder = 'XYZ';
 Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];
 

+ 2 - 2
src/math/Matrix3.js

@@ -2,8 +2,6 @@ class Matrix3 {
 
 	constructor() {
 
-		this.isMatrix3 = true;
-
 		this.elements = [
 
 			1, 0, 0,
@@ -336,4 +334,6 @@ class Matrix3 {
 
 }
 
+Matrix3.prototype.isMatrix3 = true;
+
 export { Matrix3 };

+ 2 - 2
src/math/Matrix4.js

@@ -12,8 +12,6 @@ class Matrix4 {
 
 	constructor() {
 
-		this.isMatrix4 = true;
-
 		this.elements = [
 
 			1, 0, 0, 0,
@@ -882,4 +880,6 @@ class Matrix4 {
 
 }
 
+Matrix4.prototype.isMatrix4 = true;
+
 export { Matrix4 };

+ 1 - 2
src/math/Plane.js

@@ -9,8 +9,6 @@ class Plane {
 
 	constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {
 
-		this.isPlane = true;
-
 		// normal is assumed to be normalized
 
 		this.normal = normal;
@@ -223,5 +221,6 @@ class Plane {
 
 }
 
+Plane.prototype.isPlane = true;
 
 export { Plane };

+ 2 - 2
src/math/Quaternion.js

@@ -4,8 +4,6 @@ class Quaternion {
 
 	constructor( x = 0, y = 0, z = 0, w = 1 ) {
 
-		this.isQuaternion = true;
-
 		this._x = x;
 		this._y = y;
 		this._z = z;
@@ -656,4 +654,6 @@ class Quaternion {
 
 }
 
+Quaternion.prototype.isQuaternion = true;
+
 export { Quaternion };

+ 1 - 2
src/math/SphericalHarmonics3.js

@@ -14,8 +14,6 @@ class SphericalHarmonics3 {
 
 	constructor() {
 
-		this.isSphericalHarmonics3 = true;
-
 		this.coefficients = [];
 
 		for ( let i = 0; i < 9; i ++ ) {
@@ -240,5 +238,6 @@ class SphericalHarmonics3 {
 
 }
 
+SphericalHarmonics3.prototype.isSphericalHarmonics3 = true;
 
 export { SphericalHarmonics3 };

+ 1 - 2
src/math/Vector2.js

@@ -2,8 +2,6 @@ class Vector2 {
 
 	constructor( x = 0, y = 0 ) {
 
-		this.isVector2 = true;
-
 		this.x = x;
 		this.y = y;
 
@@ -474,5 +472,6 @@ class Vector2 {
 
 }
 
+Vector2.prototype.isVector2 = true;
 
 export { Vector2 };

+ 2 - 2
src/math/Vector3.js

@@ -8,8 +8,6 @@ class Vector3 {
 
 	constructor( x = 0, y = 0, z = 0 ) {
 
-		this.isVector3 = true;
-
 		this.x = x;
 		this.y = y;
 		this.z = z;
@@ -718,4 +716,6 @@ class Vector3 {
 
 }
 
+Vector3.prototype.isVector3 = true;
+
 export { Vector3 };

+ 2 - 2
src/math/Vector4.js

@@ -2,8 +2,6 @@ class Vector4 {
 
 	constructor( x = 0, y = 0, z = 0, w = 1 ) {
 
-		this.isVector4 = true;
-
 		this.x = x;
 		this.y = y;
 		this.z = z;
@@ -652,4 +650,6 @@ class Vector4 {
 
 }
 
+Vector4.prototype.isVector4 = true;
+
 export { Vector4 };

+ 2 - 1
src/objects/Group.js

@@ -5,12 +5,13 @@ class Group extends Object3D {
 	constructor() {
 
 		super();
+
 		this.type = 'Group';
-		this.isGroup = true;
 
 	}
 
 }
 
+Group.prototype.isGroup = true;
 
 export { Group };

+ 2 - 3
src/objects/LineLoop.js

@@ -5,14 +5,13 @@ class LineLoop extends Line {
 	constructor( geometry, material ) {
 
 		super( geometry, material );
+
 		this.type = 'LineLoop';
-		this.isLineLoop = true;
 
 	}
 
-
-
 }
 
+LineLoop.prototype.isLineLoop = true;
 
 export { LineLoop };

+ 2 - 2
src/objects/Sprite.js

@@ -85,8 +85,6 @@ class Sprite extends Object3D {
 
 		this.center = new Vector2( 0.5, 0.5 );
 
-		this.isSprite = true;
-
 	}
 
 	raycast( raycaster, intersects ) {
@@ -178,4 +176,6 @@ class Sprite extends Object3D {
 
 }
 
+Sprite.prototype.isSprite = true;
+
 export { Sprite };

+ 1 - 2
src/renderers/WebGLCubeRenderTarget.js

@@ -21,8 +21,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
 
 		super( size, size, options );
 
-		this.isWebGLCubeRenderTarget = true;
-
 		options = options || {};
 
 		this.texture = new CubeTexture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
@@ -140,5 +138,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
 
 }
 
+WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;
 
 export { WebGLCubeRenderTarget };

+ 1 - 2
src/renderers/WebGLMultisampleRenderTarget.js

@@ -6,8 +6,6 @@ class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
 
 		super( width, height, options );
 
-		this.isWebGLMultisampleRenderTarget = true;
-
 		this.samples = 4;
 
 	}
@@ -24,5 +22,6 @@ class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
 
 }
 
+WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true;
 
 export { WebGLMultisampleRenderTarget };

+ 1 - 2
src/renderers/WebGLRenderTarget.js

@@ -14,8 +14,6 @@ class WebGLRenderTarget extends EventDispatcher {
 
 		super();
 
-		this.isWebGLRenderTarget = true;
-
 		this.width = width;
 		this.height = height;
 		this.depth = 1;
@@ -108,5 +106,6 @@ class WebGLRenderTarget extends EventDispatcher {
 
 }
 
+WebGLRenderTarget.prototype.isWebGLRenderTarget = true;
 
 export { WebGLRenderTarget };

+ 1 - 2
src/scenes/Fog.js

@@ -4,8 +4,6 @@ class Fog {
 
 	constructor( color, near, far ) {
 
-		this.isFog = true;
-
 		this.name = '';
 
 		this.color = new Color( color );
@@ -34,5 +32,6 @@ class Fog {
 
 }
 
+Fog.prototype.isFog = true;
 
 export { Fog };

+ 1 - 2
src/scenes/FogExp2.js

@@ -4,8 +4,6 @@ class FogExp2 {
 
 	constructor( color, density ) {
 
-		this.isFogExp2 = true;
-
 		this.name = '';
 
 		this.color = new Color( color );
@@ -31,5 +29,6 @@ class FogExp2 {
 
 }
 
+FogExp2.prototype.isFogExp2 = true;
 
 export { FogExp2 };

+ 1 - 2
src/scenes/Scene.js

@@ -6,8 +6,6 @@ class Scene extends Object3D {
 
 		super();
 
-		this.isScene = true;
-
 		this.type = 'Scene';
 
 		this.background = null;
@@ -57,5 +55,6 @@ class Scene extends Object3D {
 
 }
 
+Scene.prototype.isScene = true;
 
 export { Scene };

+ 5 - 3
test/unit/src/core/Object3D.tests.js

@@ -297,9 +297,11 @@ export default QUnit.module( 'Core', () => {
 			obj.translateOnAxis( new Vector3( 0, 1, 0 ), 1.23 );
 			obj.translateOnAxis( new Vector3( 0, 0, 1 ), - 4.56 );
 
-			assert.numEqual( obj.position.x, 1, 'x is equal' );
-			assert.numEqual( obj.position.y, 1.23, 'y is equal' );
-			assert.numEqual( obj.position.z, - 4.56, 'z is equal' );
+			assert.propEqual( obj.position, {
+				x: 1,
+				y: 1.23,
+				z: - 4.56
+			} );
 
 		} );