浏览代码

Merge pull request #21293 from mrdoob/es6

Revert to *.prototype.is* = true
Mr.doob 4 年之前
父节点
当前提交
f23d9e0896
共有 45 个文件被更改,包括 179 次插入178 次删除
  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. 60 60
      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. 10 10
      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. 5 5
      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. 29 29
      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 };

+ 60 - 60
src/math/Box3.js

@@ -1,69 +1,9 @@
 import { Vector3 } from './Vector3.js';
 
-const _points = [
-	/*@__PURE__*/ new Vector3(),
-	/*@__PURE__*/ new Vector3(),
-	/*@__PURE__*/ new Vector3(),
-	/*@__PURE__*/ new Vector3(),
-	/*@__PURE__*/ new Vector3(),
-	/*@__PURE__*/ new Vector3(),
-	/*@__PURE__*/ new Vector3(),
-	/*@__PURE__*/ new Vector3()
-];
-
-const _vector = /*@__PURE__*/ new Vector3();
-
-const _box = /*@__PURE__*/ new Box3();
-
-// triangle centered vertices
-
-const _v0 = /*@__PURE__*/ new Vector3();
-const _v1 = /*@__PURE__*/ new Vector3();
-const _v2 = /*@__PURE__*/ new Vector3();
-
-// triangle edge vectors
-
-const _f0 = /*@__PURE__*/ new Vector3();
-const _f1 = /*@__PURE__*/ new Vector3();
-const _f2 = /*@__PURE__*/ new Vector3();
-
-const _center = /*@__PURE__*/ new Vector3();
-const _extents = /*@__PURE__*/ new Vector3();
-const _triangleNormal = /*@__PURE__*/ new Vector3();
-const _testAxis = /*@__PURE__*/ new Vector3();
-
-function satForAxes( axes, v0, v1, v2, extents ) {
-
-	for ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {
-
-		_testAxis.fromArray( axes, i );
-		// project the aabb onto the seperating axis
-		const r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );
-		// project all 3 vertices of the triangle onto the seperating axis
-		const p0 = v0.dot( _testAxis );
-		const p1 = v1.dot( _testAxis );
-		const p2 = v2.dot( _testAxis );
-		// actual test, basically see if either of the most extreme of the triangle points intersects r
-		if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
-
-			// points of the projected triangle are outside the projected half-length of the aabb
-			// the axis is seperating and we can exit
-			return false;
-
-		}
-
-	}
-
-	return true;
-
-}
-
 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 +490,64 @@ class Box3 {
 
 }
 
+Box3.prototype.isBox3 = true;
+
+const _points = [
+	/*@__PURE__*/ new Vector3(),
+	/*@__PURE__*/ new Vector3(),
+	/*@__PURE__*/ new Vector3(),
+	/*@__PURE__*/ new Vector3(),
+	/*@__PURE__*/ new Vector3(),
+	/*@__PURE__*/ new Vector3(),
+	/*@__PURE__*/ new Vector3(),
+	/*@__PURE__*/ new Vector3()
+];
+
+const _vector = /*@__PURE__*/ new Vector3();
+
+const _box = /*@__PURE__*/ new Box3();
+
+// triangle centered vertices
+
+const _v0 = /*@__PURE__*/ new Vector3();
+const _v1 = /*@__PURE__*/ new Vector3();
+const _v2 = /*@__PURE__*/ new Vector3();
+
+// triangle edge vectors
+
+const _f0 = /*@__PURE__*/ new Vector3();
+const _f1 = /*@__PURE__*/ new Vector3();
+const _f2 = /*@__PURE__*/ new Vector3();
+
+const _center = /*@__PURE__*/ new Vector3();
+const _extents = /*@__PURE__*/ new Vector3();
+const _triangleNormal = /*@__PURE__*/ new Vector3();
+const _testAxis = /*@__PURE__*/ new Vector3();
+
+function satForAxes( axes, v0, v1, v2, extents ) {
+
+	for ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {
+
+		_testAxis.fromArray( axes, i );
+		// project the aabb onto the seperating axis
+		const r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );
+		// project all 3 vertices of the triangle onto the seperating axis
+		const p0 = v0.dot( _testAxis );
+		const p1 = v1.dot( _testAxis );
+		const p2 = v2.dot( _testAxis );
+		// actual test, basically see if either of the most extreme of the triangle points intersects r
+		if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
+
+			// points of the projected triangle are outside the projected half-length of the aabb
+			// the axis is seperating and we can exit
+			return false;
+
+		}
+
+	}
+
+	return 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 };

+ 10 - 10
src/math/Matrix4.js

@@ -1,19 +1,9 @@
 import { Vector3 } from './Vector3.js';
 
-const _v1 = /*@__PURE__*/ new Vector3();
-const _m1 = /*@__PURE__*/ new Matrix4();
-const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
-const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
-const _x = /*@__PURE__*/ new Vector3();
-const _y = /*@__PURE__*/ new Vector3();
-const _z = /*@__PURE__*/ new Vector3();
-
 class Matrix4 {
 
 	constructor() {
 
-		this.isMatrix4 = true;
-
 		this.elements = [
 
 			1, 0, 0, 0,
@@ -882,4 +872,14 @@ class Matrix4 {
 
 }
 
+Matrix4.prototype.isMatrix4 = true;
+
+const _v1 = /*@__PURE__*/ new Vector3();
+const _m1 = /*@__PURE__*/ new Matrix4();
+const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
+const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
+const _x = /*@__PURE__*/ new Vector3();
+const _y = /*@__PURE__*/ new Vector3();
+const _z = /*@__PURE__*/ new Vector3();
+
 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 };

+ 5 - 5
src/math/Vector3.js

@@ -1,15 +1,10 @@
 import { MathUtils } from './MathUtils.js';
 import { Quaternion } from './Quaternion.js';
 
-const _vector = /*@__PURE__*/ new Vector3();
-const _quaternion = /*@__PURE__*/ new Quaternion();
-
 class Vector3 {
 
 	constructor( x = 0, y = 0, z = 0 ) {
 
-		this.isVector3 = true;
-
 		this.x = x;
 		this.y = y;
 		this.z = z;
@@ -718,4 +713,9 @@ class Vector3 {
 
 }
 
+Vector3.prototype.isVector3 = true;
+
+const _vector = /*@__PURE__*/ new Vector3();
+const _quaternion = /*@__PURE__*/ new Quaternion();
+
 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 };

+ 29 - 29
src/objects/Sprite.js

@@ -26,33 +26,6 @@ const _uvA = /*@__PURE__*/ new Vector2();
 const _uvB = /*@__PURE__*/ new Vector2();
 const _uvC = /*@__PURE__*/ new Vector2();
 
-function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {
-
-	// compute position in camera space
-	_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );
-
-	// to check if rotation is not zero
-	if ( sin !== undefined ) {
-
-		_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );
-		_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );
-
-	} else {
-
-		_rotatedPosition.copy( _alignedPosition );
-
-	}
-
-
-	vertexPosition.copy( mvPosition );
-	vertexPosition.x += _rotatedPosition.x;
-	vertexPosition.y += _rotatedPosition.y;
-
-	// transform to world space
-	vertexPosition.applyMatrix4( _viewWorldMatrix );
-
-}
-
 class Sprite extends Object3D {
 
 	constructor( material ) {
@@ -85,8 +58,6 @@ class Sprite extends Object3D {
 
 		this.center = new Vector2( 0.5, 0.5 );
 
-		this.isSprite = true;
-
 	}
 
 	raycast( raycaster, intersects ) {
@@ -178,4 +149,33 @@ class Sprite extends Object3D {
 
 }
 
+Sprite.prototype.isSprite = true;
+
+function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {
+
+	// compute position in camera space
+	_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );
+
+	// to check if rotation is not zero
+	if ( sin !== undefined ) {
+
+		_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );
+		_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );
+
+	} else {
+
+		_rotatedPosition.copy( _alignedPosition );
+
+	}
+
+
+	vertexPosition.copy( mvPosition );
+	vertexPosition.x += _rotatedPosition.x;
+	vertexPosition.y += _rotatedPosition.y;
+
+	// transform to world space
+	vertexPosition.applyMatrix4( _viewWorldMatrix );
+
+}
+
 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
+			} );
 
 		} );