diff --git a/src/animation/AnimationObjectGroup.js b/src/animation/AnimationObjectGroup.js index 4f49d964fa131..d43a114f076b7 100644 --- a/src/animation/AnimationObjectGroup.js +++ b/src/animation/AnimationObjectGroup.js @@ -34,6 +34,8 @@ class AnimationObjectGroup { constructor() { + this.isAnimationObjectGroup = true; + this.uuid = MathUtils.generateUUID(); // cached objects followed by the active ones @@ -382,6 +384,4 @@ class AnimationObjectGroup { } -AnimationObjectGroup.prototype.isAnimationObjectGroup = true; - export { AnimationObjectGroup }; diff --git a/src/cameras/ArrayCamera.js b/src/cameras/ArrayCamera.js index 0d5ad131d4131..4da2d1d4a8d99 100644 --- a/src/cameras/ArrayCamera.js +++ b/src/cameras/ArrayCamera.js @@ -6,13 +6,12 @@ class ArrayCamera extends PerspectiveCamera { super(); + this.isArrayCamera = true; + this.cameras = array; } } -ArrayCamera.prototype.isArrayCamera = true; - - export { ArrayCamera }; diff --git a/src/cameras/Camera.js b/src/cameras/Camera.js index 3f745c93d2e17..7748346736145 100644 --- a/src/cameras/Camera.js +++ b/src/cameras/Camera.js @@ -7,6 +7,8 @@ class Camera extends Object3D { super(); + this.isCamera = true; + this.type = 'Camera'; this.matrixWorldInverse = new Matrix4(); @@ -63,6 +65,4 @@ class Camera extends Object3D { } -Camera.prototype.isCamera = true; - export { Camera }; diff --git a/src/cameras/OrthographicCamera.js b/src/cameras/OrthographicCamera.js index 523fd2330ee2f..f9520343fbc81 100755 --- a/src/cameras/OrthographicCamera.js +++ b/src/cameras/OrthographicCamera.js @@ -6,6 +6,8 @@ class OrthographicCamera extends Camera { super(); + this.isOrthographicCamera = true; + this.type = 'OrthographicCamera'; this.zoom = 1; @@ -131,6 +133,4 @@ class OrthographicCamera extends Camera { } -OrthographicCamera.prototype.isOrthographicCamera = true; - export { OrthographicCamera }; diff --git a/src/cameras/PerspectiveCamera.js b/src/cameras/PerspectiveCamera.js index 9c16b8c38bfe7..4a6becc3a099d 100644 --- a/src/cameras/PerspectiveCamera.js +++ b/src/cameras/PerspectiveCamera.js @@ -7,6 +7,8 @@ class PerspectiveCamera extends Camera { super(); + this.isPerspectiveCamera = true; + this.type = 'PerspectiveCamera'; this.fov = fov; @@ -228,6 +230,4 @@ class PerspectiveCamera extends Camera { } -PerspectiveCamera.prototype.isPerspectiveCamera = true; - export { PerspectiveCamera }; diff --git a/src/core/BufferAttribute.js b/src/core/BufferAttribute.js index 92fb5f0611f67..e9a184b95da9a 100644 --- a/src/core/BufferAttribute.js +++ b/src/core/BufferAttribute.js @@ -17,6 +17,8 @@ class BufferAttribute { } + this.isBufferAttribute = true; + this.name = ''; this.array = array; @@ -399,8 +401,6 @@ class BufferAttribute { } -BufferAttribute.prototype.isBufferAttribute = true; - // class Int8BufferAttribute extends BufferAttribute { @@ -479,11 +479,12 @@ class Float16BufferAttribute extends BufferAttribute { super( new Uint16Array( array ), itemSize, normalized ); + this.isFloat16BufferAttribute = true; + } } -Float16BufferAttribute.prototype.isFloat16BufferAttribute = true; class Float32BufferAttribute extends BufferAttribute { diff --git a/src/core/BufferGeometry.js b/src/core/BufferGeometry.js index 91b4578f6edcc..68bf0168ed879 100644 --- a/src/core/BufferGeometry.js +++ b/src/core/BufferGeometry.js @@ -25,6 +25,8 @@ class BufferGeometry extends EventDispatcher { super(); + this.isBufferGeometry = true; + Object.defineProperty( this, 'id', { value: _id ++ } ); this.uuid = MathUtils.generateUUID(); @@ -1125,6 +1127,4 @@ class BufferGeometry extends EventDispatcher { } -BufferGeometry.prototype.isBufferGeometry = true; - export { BufferGeometry }; diff --git a/src/core/GLBufferAttribute.js b/src/core/GLBufferAttribute.js index d301dbda15697..5e627d82bcbd4 100644 --- a/src/core/GLBufferAttribute.js +++ b/src/core/GLBufferAttribute.js @@ -2,6 +2,8 @@ class GLBufferAttribute { constructor( buffer, type, itemSize, elementSize, count ) { + this.isGLBufferAttribute = true; + this.buffer = buffer; this.type = type; this.itemSize = itemSize; @@ -53,6 +55,4 @@ class GLBufferAttribute { } -GLBufferAttribute.prototype.isGLBufferAttribute = true; - export { GLBufferAttribute }; diff --git a/src/core/InstancedBufferAttribute.js b/src/core/InstancedBufferAttribute.js index 01eee65b267e1..8123f4a23857d 100644 --- a/src/core/InstancedBufferAttribute.js +++ b/src/core/InstancedBufferAttribute.js @@ -16,6 +16,8 @@ class InstancedBufferAttribute extends BufferAttribute { super( array, itemSize, normalized ); + this.isInstancedBufferAttribute = true; + this.meshPerAttribute = meshPerAttribute; } @@ -44,6 +46,4 @@ class InstancedBufferAttribute extends BufferAttribute { } -InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true; - export { InstancedBufferAttribute }; diff --git a/src/core/InstancedBufferGeometry.js b/src/core/InstancedBufferGeometry.js index 34943d1f91447..f061ccaadcba7 100644 --- a/src/core/InstancedBufferGeometry.js +++ b/src/core/InstancedBufferGeometry.js @@ -6,6 +6,8 @@ class InstancedBufferGeometry extends BufferGeometry { super(); + this.isInstancedBufferGeometry = true; + this.type = 'InstancedBufferGeometry'; this.instanceCount = Infinity; @@ -41,6 +43,4 @@ class InstancedBufferGeometry extends BufferGeometry { } -InstancedBufferGeometry.prototype.isInstancedBufferGeometry = true; - export { InstancedBufferGeometry }; diff --git a/src/core/InstancedInterleavedBuffer.js b/src/core/InstancedInterleavedBuffer.js index 9d404af70bc0f..7f667161ee773 100644 --- a/src/core/InstancedInterleavedBuffer.js +++ b/src/core/InstancedInterleavedBuffer.js @@ -6,6 +6,8 @@ class InstancedInterleavedBuffer extends InterleavedBuffer { super( array, stride ); + this.isInstancedInterleavedBuffer = true; + this.meshPerAttribute = meshPerAttribute; } @@ -43,6 +45,4 @@ class InstancedInterleavedBuffer extends InterleavedBuffer { } -InstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true; - export { InstancedInterleavedBuffer }; diff --git a/src/core/InterleavedBuffer.js b/src/core/InterleavedBuffer.js index d252f3cd5b300..6fae629793c56 100644 --- a/src/core/InterleavedBuffer.js +++ b/src/core/InterleavedBuffer.js @@ -5,6 +5,8 @@ class InterleavedBuffer { constructor( array, stride ) { + this.isInterleavedBuffer = true; + this.array = array; this.stride = stride; this.count = array !== undefined ? array.length / stride : 0; @@ -140,6 +142,4 @@ class InterleavedBuffer { } -InterleavedBuffer.prototype.isInterleavedBuffer = true; - export { InterleavedBuffer }; diff --git a/src/core/InterleavedBufferAttribute.js b/src/core/InterleavedBufferAttribute.js index 1fe89b7f6e60f..6d13609721273 100644 --- a/src/core/InterleavedBufferAttribute.js +++ b/src/core/InterleavedBufferAttribute.js @@ -7,6 +7,8 @@ class InterleavedBufferAttribute { constructor( interleavedBuffer, itemSize, offset, normalized = false ) { + this.isInterleavedBufferAttribute = true; + this.name = ''; this.data = interleavedBuffer; @@ -276,7 +278,5 @@ class InterleavedBufferAttribute { } -InterleavedBufferAttribute.prototype.isInterleavedBufferAttribute = true; - export { InterleavedBufferAttribute }; diff --git a/src/core/Object3D.js b/src/core/Object3D.js index c315bbda6ab33..ea06b5453d6e6 100644 --- a/src/core/Object3D.js +++ b/src/core/Object3D.js @@ -31,6 +31,8 @@ class Object3D extends EventDispatcher { super(); + this.isObject3D = true; + Object.defineProperty( this, 'id', { value: _object3DId ++ } ); this.uuid = MathUtils.generateUUID(); @@ -922,6 +924,4 @@ class Object3D extends EventDispatcher { Object3D.DefaultUp = new Vector3( 0, 1, 0 ); Object3D.DefaultMatrixAutoUpdate = true; -Object3D.prototype.isObject3D = true; - export { Object3D }; diff --git a/src/extras/curves/ArcCurve.js b/src/extras/curves/ArcCurve.js index b1101c0d5fc6b..edb84f4630cf3 100644 --- a/src/extras/curves/ArcCurve.js +++ b/src/extras/curves/ArcCurve.js @@ -6,12 +6,12 @@ class ArcCurve extends EllipseCurve { super( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise ); + this.isArcCurve = true; + this.type = 'ArcCurve'; } } -ArcCurve.prototype.isArcCurve = true; - export { ArcCurve }; diff --git a/src/extras/curves/CatmullRomCurve3.js b/src/extras/curves/CatmullRomCurve3.js index 8ed78fa68717c..a0bfd4af887b2 100644 --- a/src/extras/curves/CatmullRomCurve3.js +++ b/src/extras/curves/CatmullRomCurve3.js @@ -87,6 +87,8 @@ class CatmullRomCurve3 extends Curve { super(); + this.isCatmullRomCurve3 = true; + this.type = 'CatmullRomCurve3'; this.points = points; @@ -248,6 +250,4 @@ class CatmullRomCurve3 extends Curve { } -CatmullRomCurve3.prototype.isCatmullRomCurve3 = true; - export { CatmullRomCurve3 }; diff --git a/src/extras/curves/CubicBezierCurve.js b/src/extras/curves/CubicBezierCurve.js index e9bd2eec2ff38..a2d45f53f77bc 100644 --- a/src/extras/curves/CubicBezierCurve.js +++ b/src/extras/curves/CubicBezierCurve.js @@ -8,6 +8,8 @@ class CubicBezierCurve extends Curve { super(); + this.isCubicBezierCurve = true; + this.type = 'CubicBezierCurve'; this.v0 = v0; @@ -73,6 +75,4 @@ class CubicBezierCurve extends Curve { } -CubicBezierCurve.prototype.isCubicBezierCurve = true; - export { CubicBezierCurve }; diff --git a/src/extras/curves/CubicBezierCurve3.js b/src/extras/curves/CubicBezierCurve3.js index 1c4af2c2d85a8..c5afdf26c902b 100644 --- a/src/extras/curves/CubicBezierCurve3.js +++ b/src/extras/curves/CubicBezierCurve3.js @@ -8,6 +8,8 @@ class CubicBezierCurve3 extends Curve { super(); + this.isCubicBezierCurve3 = true; + this.type = 'CubicBezierCurve3'; this.v0 = v0; @@ -74,6 +76,4 @@ class CubicBezierCurve3 extends Curve { } -CubicBezierCurve3.prototype.isCubicBezierCurve3 = true; - export { CubicBezierCurve3 }; diff --git a/src/extras/curves/EllipseCurve.js b/src/extras/curves/EllipseCurve.js index afce9dc381322..5833648193c6f 100644 --- a/src/extras/curves/EllipseCurve.js +++ b/src/extras/curves/EllipseCurve.js @@ -7,6 +7,8 @@ class EllipseCurve extends Curve { super(); + this.isEllipseCurve = true; + this.type = 'EllipseCurve'; this.aX = aX; @@ -151,6 +153,4 @@ class EllipseCurve extends Curve { } -EllipseCurve.prototype.isEllipseCurve = true; - export { EllipseCurve }; diff --git a/src/extras/curves/LineCurve.js b/src/extras/curves/LineCurve.js index cde9b2ef13b8e..4b14d5edb6aad 100644 --- a/src/extras/curves/LineCurve.js +++ b/src/extras/curves/LineCurve.js @@ -7,6 +7,8 @@ class LineCurve extends Curve { super(); + this.isLineCurve = true; + this.type = 'LineCurve'; this.v1 = v1; @@ -85,6 +87,4 @@ class LineCurve extends Curve { } -LineCurve.prototype.isLineCurve = true; - export { LineCurve }; diff --git a/src/extras/curves/LineCurve3.js b/src/extras/curves/LineCurve3.js index 1a101dfa96939..c315c3869f302 100644 --- a/src/extras/curves/LineCurve3.js +++ b/src/extras/curves/LineCurve3.js @@ -7,9 +7,10 @@ class LineCurve3 extends Curve { super(); - this.type = 'LineCurve3'; this.isLineCurve3 = true; + this.type = 'LineCurve3'; + this.v1 = v1; this.v2 = v2; diff --git a/src/extras/curves/QuadraticBezierCurve.js b/src/extras/curves/QuadraticBezierCurve.js index d311bd8230eda..6ed67d988ec7b 100644 --- a/src/extras/curves/QuadraticBezierCurve.js +++ b/src/extras/curves/QuadraticBezierCurve.js @@ -8,6 +8,8 @@ class QuadraticBezierCurve extends Curve { super(); + this.isQuadraticBezierCurve = true; + this.type = 'QuadraticBezierCurve'; this.v0 = v0; @@ -69,6 +71,4 @@ class QuadraticBezierCurve extends Curve { } -QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true; - export { QuadraticBezierCurve }; diff --git a/src/extras/curves/QuadraticBezierCurve3.js b/src/extras/curves/QuadraticBezierCurve3.js index 32b936c019af4..bdc882cc21eed 100644 --- a/src/extras/curves/QuadraticBezierCurve3.js +++ b/src/extras/curves/QuadraticBezierCurve3.js @@ -8,6 +8,8 @@ class QuadraticBezierCurve3 extends Curve { super(); + this.isQuadraticBezierCurve3 = true; + this.type = 'QuadraticBezierCurve3'; this.v0 = v0; @@ -70,6 +72,4 @@ class QuadraticBezierCurve3 extends Curve { } -QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true; - export { QuadraticBezierCurve3 }; diff --git a/src/extras/curves/SplineCurve.js b/src/extras/curves/SplineCurve.js index 182d459d7b6d9..073b9e46bdf2c 100644 --- a/src/extras/curves/SplineCurve.js +++ b/src/extras/curves/SplineCurve.js @@ -8,6 +8,8 @@ class SplineCurve extends Curve { super(); + this.isSplineCurve = true; + this.type = 'SplineCurve'; this.points = points; @@ -92,6 +94,4 @@ class SplineCurve extends Curve { } -SplineCurve.prototype.isSplineCurve = true; - export { SplineCurve }; diff --git a/src/helpers/SkeletonHelper.js b/src/helpers/SkeletonHelper.js index 75a5b31b07936..188395d7b7e1f 100644 --- a/src/helpers/SkeletonHelper.js +++ b/src/helpers/SkeletonHelper.js @@ -47,9 +47,10 @@ class SkeletonHelper extends LineSegments { super( geometry, material ); - this.type = 'SkeletonHelper'; this.isSkeletonHelper = true; + this.type = 'SkeletonHelper'; + this.root = object; this.bones = bones; diff --git a/src/lights/AmbientLight.js b/src/lights/AmbientLight.js index 6dc043676612f..1c73748619f62 100644 --- a/src/lights/AmbientLight.js +++ b/src/lights/AmbientLight.js @@ -6,12 +6,12 @@ class AmbientLight extends Light { super( color, intensity ); + this.isAmbientLight = true; + this.type = 'AmbientLight'; } } -AmbientLight.prototype.isAmbientLight = true; - export { AmbientLight }; diff --git a/src/lights/AmbientLightProbe.js b/src/lights/AmbientLightProbe.js index 7b19b4fb54219..d5aac6aa71857 100644 --- a/src/lights/AmbientLightProbe.js +++ b/src/lights/AmbientLightProbe.js @@ -7,6 +7,8 @@ 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 ); @@ -16,6 +18,4 @@ class AmbientLightProbe extends LightProbe { } -AmbientLightProbe.prototype.isAmbientLightProbe = true; - export { AmbientLightProbe }; diff --git a/src/lights/DirectionalLight.js b/src/lights/DirectionalLight.js index 7c477f71c38ae..7031c8bbacfcf 100644 --- a/src/lights/DirectionalLight.js +++ b/src/lights/DirectionalLight.js @@ -8,6 +8,8 @@ class DirectionalLight extends Light { super( color, intensity ); + this.isDirectionalLight = true; + this.type = 'DirectionalLight'; this.position.copy( Object3D.DefaultUp ); @@ -38,6 +40,4 @@ class DirectionalLight extends Light { } -DirectionalLight.prototype.isDirectionalLight = true; - export { DirectionalLight }; diff --git a/src/lights/DirectionalLightShadow.js b/src/lights/DirectionalLightShadow.js index 1b63dd897de11..10ade5b470367 100644 --- a/src/lights/DirectionalLightShadow.js +++ b/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 }; diff --git a/src/lights/HemisphereLight.js b/src/lights/HemisphereLight.js index 9d1ca94d0df3e..1ca6fb7af2a25 100644 --- a/src/lights/HemisphereLight.js +++ b/src/lights/HemisphereLight.js @@ -8,6 +8,8 @@ class HemisphereLight extends Light { super( skyColor, intensity ); + this.isHemisphereLight = true; + this.type = 'HemisphereLight'; this.position.copy( Object3D.DefaultUp ); @@ -29,6 +31,4 @@ class HemisphereLight extends Light { } -HemisphereLight.prototype.isHemisphereLight = true; - export { HemisphereLight }; diff --git a/src/lights/HemisphereLightProbe.js b/src/lights/HemisphereLightProbe.js index 6173409cddfce..4846332686ccc 100644 --- a/src/lights/HemisphereLightProbe.js +++ b/src/lights/HemisphereLightProbe.js @@ -8,6 +8,8 @@ class HemisphereLightProbe extends LightProbe { super( undefined, intensity ); + this.isHemisphereLightProbe = true; + const color1 = new Color().set( skyColor ); const color2 = new Color().set( groundColor ); @@ -25,6 +27,4 @@ class HemisphereLightProbe extends LightProbe { } -HemisphereLightProbe.prototype.isHemisphereLightProbe = true; - export { HemisphereLightProbe }; diff --git a/src/lights/Light.js b/src/lights/Light.js index f16d75d42d716..0b2bbdf88f648 100644 --- a/src/lights/Light.js +++ b/src/lights/Light.js @@ -7,6 +7,8 @@ class Light extends Object3D { super(); + this.isLight = true; + this.type = 'Light'; this.color = new Color( color ); @@ -53,6 +55,4 @@ class Light extends Object3D { } -Light.prototype.isLight = true; - export { Light }; diff --git a/src/lights/LightProbe.js b/src/lights/LightProbe.js index fbef062ef9b60..5f0714367ffbf 100644 --- a/src/lights/LightProbe.js +++ b/src/lights/LightProbe.js @@ -7,6 +7,8 @@ class LightProbe extends Light { super( undefined, intensity ); + this.isLightProbe = true; + this.sh = sh; } @@ -42,6 +44,4 @@ class LightProbe extends Light { } -LightProbe.prototype.isLightProbe = true; - export { LightProbe }; diff --git a/src/lights/PointLight.js b/src/lights/PointLight.js index 02817cf204920..b533f1dd8470e 100644 --- a/src/lights/PointLight.js +++ b/src/lights/PointLight.js @@ -7,6 +7,8 @@ class PointLight extends Light { super( color, intensity ); + this.isPointLight = true; + this.type = 'PointLight'; this.distance = distance; @@ -52,6 +54,4 @@ class PointLight extends Light { } -PointLight.prototype.isPointLight = true; - export { PointLight }; diff --git a/src/lights/PointLightShadow.js b/src/lights/PointLightShadow.js index 995a0bca050b3..86847d10c8c9d 100644 --- a/src/lights/PointLightShadow.js +++ b/src/lights/PointLightShadow.js @@ -15,6 +15,8 @@ class PointLightShadow extends LightShadow { super( new PerspectiveCamera( 90, 1, 0.5, 500 ) ); + this.isPointLightShadow = true; + this._frameExtents = new Vector2( 4, 2 ); this._viewportCount = 6; @@ -91,6 +93,4 @@ class PointLightShadow extends LightShadow { } -PointLightShadow.prototype.isPointLightShadow = true; - export { PointLightShadow }; diff --git a/src/lights/RectAreaLight.js b/src/lights/RectAreaLight.js index 711ca5bbb06cc..084685b347ea0 100644 --- a/src/lights/RectAreaLight.js +++ b/src/lights/RectAreaLight.js @@ -6,6 +6,8 @@ class RectAreaLight extends Light { super( color, intensity ); + this.isRectAreaLight = true; + this.type = 'RectAreaLight'; this.width = width; @@ -51,6 +53,4 @@ class RectAreaLight extends Light { } -RectAreaLight.prototype.isRectAreaLight = true; - export { RectAreaLight }; diff --git a/src/lights/SpotLight.js b/src/lights/SpotLight.js index 7c35259335800..9d6685c8401d2 100644 --- a/src/lights/SpotLight.js +++ b/src/lights/SpotLight.js @@ -8,6 +8,8 @@ class SpotLight extends Light { super( color, intensity ); + this.isSpotLight = true; + this.type = 'SpotLight'; this.position.copy( Object3D.DefaultUp ); @@ -64,6 +66,4 @@ class SpotLight extends Light { } -SpotLight.prototype.isSpotLight = true; - export { SpotLight }; diff --git a/src/lights/SpotLightShadow.js b/src/lights/SpotLightShadow.js index 8dd8d3e9e0385..7fa37b32f6f29 100644 --- a/src/lights/SpotLightShadow.js +++ b/src/lights/SpotLightShadow.js @@ -8,6 +8,8 @@ class SpotLightShadow extends LightShadow { super( new PerspectiveCamera( 50, 1, 0.5, 500 ) ); + this.isSpotLightShadow = true; + this.focus = 1; } @@ -45,6 +47,4 @@ class SpotLightShadow extends LightShadow { } -SpotLightShadow.prototype.isSpotLightShadow = true; - export { SpotLightShadow }; diff --git a/src/loaders/ImageBitmapLoader.js b/src/loaders/ImageBitmapLoader.js index 2a9d15a374284..6ca5585432a68 100644 --- a/src/loaders/ImageBitmapLoader.js +++ b/src/loaders/ImageBitmapLoader.js @@ -7,6 +7,8 @@ class ImageBitmapLoader extends Loader { super( manager ); + this.isImageBitmapLoader = true; + if ( typeof createImageBitmap === 'undefined' ) { console.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' ); @@ -94,6 +96,4 @@ class ImageBitmapLoader extends Loader { } -ImageBitmapLoader.prototype.isImageBitmapLoader = true; - export { ImageBitmapLoader }; diff --git a/src/materials/LineBasicMaterial.js b/src/materials/LineBasicMaterial.js index cd433105f755b..fe876f47979e1 100644 --- a/src/materials/LineBasicMaterial.js +++ b/src/materials/LineBasicMaterial.js @@ -7,6 +7,8 @@ class LineBasicMaterial extends Material { super(); + this.isLineBasicMaterial = true; + this.type = 'LineBasicMaterial'; this.color = new Color( 0xffffff ); @@ -40,6 +42,4 @@ class LineBasicMaterial extends Material { } -LineBasicMaterial.prototype.isLineBasicMaterial = true; - export { LineBasicMaterial }; diff --git a/src/materials/LineDashedMaterial.js b/src/materials/LineDashedMaterial.js index 5b7326af596f0..53f534d0a2ee3 100644 --- a/src/materials/LineDashedMaterial.js +++ b/src/materials/LineDashedMaterial.js @@ -6,6 +6,8 @@ class LineDashedMaterial extends LineBasicMaterial { super(); + this.isLineDashedMaterial = true; + this.type = 'LineDashedMaterial'; this.scale = 1; @@ -30,6 +32,4 @@ class LineDashedMaterial extends LineBasicMaterial { } -LineDashedMaterial.prototype.isLineDashedMaterial = true; - export { LineDashedMaterial }; diff --git a/src/materials/Material.js b/src/materials/Material.js index 39bfd6e4c06ce..f5baabb7fae1c 100644 --- a/src/materials/Material.js +++ b/src/materials/Material.js @@ -10,6 +10,8 @@ class Material extends EventDispatcher { super(); + this.isMaterial = true; + Object.defineProperty( this, 'id', { value: materialId ++ } ); this.uuid = MathUtils.generateUUID(); @@ -496,8 +498,6 @@ class Material extends EventDispatcher { } -Material.prototype.isMaterial = true; - Material.fromType = function ( /*type*/ ) { // TODO: Behavior added in Materials.js diff --git a/src/materials/MeshBasicMaterial.js b/src/materials/MeshBasicMaterial.js index 804f75e217028..b9f7c2b5706fd 100644 --- a/src/materials/MeshBasicMaterial.js +++ b/src/materials/MeshBasicMaterial.js @@ -8,6 +8,8 @@ class MeshBasicMaterial extends Material { super(); + this.isMeshBasicMaterial = true; + this.type = 'MeshBasicMaterial'; this.color = new Color( 0xffffff ); // emissive @@ -76,6 +78,4 @@ class MeshBasicMaterial extends Material { } -MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - export { MeshBasicMaterial }; diff --git a/src/materials/MeshDepthMaterial.js b/src/materials/MeshDepthMaterial.js index 597954036fd33..b56155d00ce58 100644 --- a/src/materials/MeshDepthMaterial.js +++ b/src/materials/MeshDepthMaterial.js @@ -7,6 +7,8 @@ class MeshDepthMaterial extends Material { super(); + this.isMeshDepthMaterial = true; + this.type = 'MeshDepthMaterial'; this.depthPacking = BasicDepthPacking; @@ -49,6 +51,4 @@ class MeshDepthMaterial extends Material { } -MeshDepthMaterial.prototype.isMeshDepthMaterial = true; - export { MeshDepthMaterial }; diff --git a/src/materials/MeshDistanceMaterial.js b/src/materials/MeshDistanceMaterial.js index 3e0d69d766952..3b54005235ed3 100644 --- a/src/materials/MeshDistanceMaterial.js +++ b/src/materials/MeshDistanceMaterial.js @@ -7,6 +7,8 @@ class MeshDistanceMaterial extends Material { super(); + this.isMeshDistanceMaterial = true; + this.type = 'MeshDistanceMaterial'; this.referencePosition = new Vector3(); @@ -47,6 +49,4 @@ class MeshDistanceMaterial extends Material { } -MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true; - export { MeshDistanceMaterial }; diff --git a/src/materials/MeshLambertMaterial.js b/src/materials/MeshLambertMaterial.js index 02bb914166380..cb17537a4564b 100644 --- a/src/materials/MeshLambertMaterial.js +++ b/src/materials/MeshLambertMaterial.js @@ -8,6 +8,8 @@ class MeshLambertMaterial extends Material { super(); + this.isMeshLambertMaterial = true; + this.type = 'MeshLambertMaterial'; this.color = new Color( 0xffffff ); // diffuse @@ -84,6 +86,4 @@ class MeshLambertMaterial extends Material { } -MeshLambertMaterial.prototype.isMeshLambertMaterial = true; - export { MeshLambertMaterial }; diff --git a/src/materials/MeshMatcapMaterial.js b/src/materials/MeshMatcapMaterial.js index a421c7798e600..84030dcae04ab 100644 --- a/src/materials/MeshMatcapMaterial.js +++ b/src/materials/MeshMatcapMaterial.js @@ -9,6 +9,8 @@ class MeshMatcapMaterial extends Material { super(); + this.isMeshMatcapMaterial = true; + this.defines = { 'MATCAP': '' }; this.type = 'MeshMatcapMaterial'; @@ -76,6 +78,4 @@ class MeshMatcapMaterial extends Material { } -MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; - export { MeshMatcapMaterial }; diff --git a/src/materials/MeshNormalMaterial.js b/src/materials/MeshNormalMaterial.js index 4674fb390d6ad..b891031b01302 100644 --- a/src/materials/MeshNormalMaterial.js +++ b/src/materials/MeshNormalMaterial.js @@ -8,6 +8,8 @@ class MeshNormalMaterial extends Material { super(); + this.isMeshNormalMaterial = true; + this.type = 'MeshNormalMaterial'; this.bumpMap = null; @@ -56,6 +58,4 @@ class MeshNormalMaterial extends Material { } -MeshNormalMaterial.prototype.isMeshNormalMaterial = true; - export { MeshNormalMaterial }; diff --git a/src/materials/MeshPhongMaterial.js b/src/materials/MeshPhongMaterial.js index 541927ec108b2..6dfe9e46c27c0 100644 --- a/src/materials/MeshPhongMaterial.js +++ b/src/materials/MeshPhongMaterial.js @@ -9,6 +9,8 @@ class MeshPhongMaterial extends Material { super(); + this.isMeshPhongMaterial = true; + this.type = 'MeshPhongMaterial'; this.color = new Color( 0xffffff ); // diffuse @@ -115,6 +117,4 @@ class MeshPhongMaterial extends Material { } -MeshPhongMaterial.prototype.isMeshPhongMaterial = true; - export { MeshPhongMaterial }; diff --git a/src/materials/MeshPhysicalMaterial.js b/src/materials/MeshPhysicalMaterial.js index b6e84da2cebdd..c26a30c5d75b8 100644 --- a/src/materials/MeshPhysicalMaterial.js +++ b/src/materials/MeshPhysicalMaterial.js @@ -9,6 +9,8 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { super(); + this.isMeshPhysicalMaterial = true; + this.defines = { 'STANDARD': '', @@ -163,6 +165,4 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { } -MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true; - export { MeshPhysicalMaterial }; diff --git a/src/materials/MeshStandardMaterial.js b/src/materials/MeshStandardMaterial.js index e64e8f4727ab2..1821cf2ffa446 100644 --- a/src/materials/MeshStandardMaterial.js +++ b/src/materials/MeshStandardMaterial.js @@ -9,6 +9,8 @@ class MeshStandardMaterial extends Material { super(); + this.isMeshStandardMaterial = true; + this.defines = { 'STANDARD': '' }; this.type = 'MeshStandardMaterial'; @@ -119,6 +121,4 @@ class MeshStandardMaterial extends Material { } -MeshStandardMaterial.prototype.isMeshStandardMaterial = true; - export { MeshStandardMaterial }; diff --git a/src/materials/MeshToonMaterial.js b/src/materials/MeshToonMaterial.js index 45a61338c8df0..2f9b2f9e273b5 100644 --- a/src/materials/MeshToonMaterial.js +++ b/src/materials/MeshToonMaterial.js @@ -9,6 +9,8 @@ class MeshToonMaterial extends Material { super(); + this.isMeshToonMaterial = true; + this.defines = { 'TOON': '' }; this.type = 'MeshToonMaterial'; @@ -97,6 +99,4 @@ class MeshToonMaterial extends Material { } -MeshToonMaterial.prototype.isMeshToonMaterial = true; - export { MeshToonMaterial }; diff --git a/src/materials/PointsMaterial.js b/src/materials/PointsMaterial.js index a671ee89dbebb..8ca5500d6ee12 100644 --- a/src/materials/PointsMaterial.js +++ b/src/materials/PointsMaterial.js @@ -7,6 +7,8 @@ class PointsMaterial extends Material { super(); + this.isPointsMaterial = true; + this.type = 'PointsMaterial'; this.color = new Color( 0xffffff ); @@ -45,6 +47,4 @@ class PointsMaterial extends Material { } -PointsMaterial.prototype.isPointsMaterial = true; - export { PointsMaterial }; diff --git a/src/materials/RawShaderMaterial.js b/src/materials/RawShaderMaterial.js index 0ab5bdf323204..e2ab4377aeb98 100644 --- a/src/materials/RawShaderMaterial.js +++ b/src/materials/RawShaderMaterial.js @@ -6,12 +6,12 @@ class RawShaderMaterial extends ShaderMaterial { super( parameters ); + this.isRawShaderMaterial = true; + this.type = 'RawShaderMaterial'; } } -RawShaderMaterial.prototype.isRawShaderMaterial = true; - export { RawShaderMaterial }; diff --git a/src/materials/ShaderMaterial.js b/src/materials/ShaderMaterial.js index ccc89b7b17dd0..378b4575f5055 100644 --- a/src/materials/ShaderMaterial.js +++ b/src/materials/ShaderMaterial.js @@ -10,6 +10,8 @@ class ShaderMaterial extends Material { super(); + this.isShaderMaterial = true; + this.type = 'ShaderMaterial'; this.defines = {}; @@ -181,6 +183,4 @@ class ShaderMaterial extends Material { } -ShaderMaterial.prototype.isShaderMaterial = true; - export { ShaderMaterial }; diff --git a/src/materials/ShadowMaterial.js b/src/materials/ShadowMaterial.js index da81b1b1d3cdf..deea305d9e633 100644 --- a/src/materials/ShadowMaterial.js +++ b/src/materials/ShadowMaterial.js @@ -7,6 +7,8 @@ class ShadowMaterial extends Material { super(); + this.isShadowMaterial = true; + this.type = 'ShadowMaterial'; this.color = new Color( 0x000000 ); @@ -32,6 +34,4 @@ class ShadowMaterial extends Material { } -ShadowMaterial.prototype.isShadowMaterial = true; - export { ShadowMaterial }; diff --git a/src/materials/SpriteMaterial.js b/src/materials/SpriteMaterial.js index 69751e98fce53..911e9abe75f37 100644 --- a/src/materials/SpriteMaterial.js +++ b/src/materials/SpriteMaterial.js @@ -7,6 +7,8 @@ class SpriteMaterial extends Material { super(); + this.isSpriteMaterial = true; + this.type = 'SpriteMaterial'; this.color = new Color( 0xffffff ); @@ -49,6 +51,4 @@ class SpriteMaterial extends Material { } -SpriteMaterial.prototype.isSpriteMaterial = true; - export { SpriteMaterial }; diff --git a/src/math/Box2.js b/src/math/Box2.js index 02dcaa92f3ce5..7f47e104bf167 100644 --- a/src/math/Box2.js +++ b/src/math/Box2.js @@ -6,6 +6,8 @@ class Box2 { constructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) { + this.isBox2 = true; + this.min = min; this.max = max; @@ -198,6 +200,4 @@ class Box2 { } -Box2.prototype.isBox2 = true; - export { Box2 }; diff --git a/src/math/Box3.js b/src/math/Box3.js index eb52f57b37726..1110d1c219102 100644 --- a/src/math/Box3.js +++ b/src/math/Box3.js @@ -4,6 +4,8 @@ class Box3 { constructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) { + this.isBox3 = true; + this.min = min; this.max = max; @@ -469,8 +471,6 @@ class Box3 { } -Box3.prototype.isBox3 = true; - const _points = [ /*@__PURE__*/ new Vector3(), /*@__PURE__*/ new Vector3(), diff --git a/src/math/Color.js b/src/math/Color.js index cc17c0b1937b7..e2c45f974fd38 100644 --- a/src/math/Color.js +++ b/src/math/Color.js @@ -56,6 +56,8 @@ class Color { constructor( r, g, b ) { + this.isColor = true; + this.r = 1; this.g = 1; this.b = 1; @@ -610,6 +612,4 @@ class Color { Color.NAMES = _colorKeywords; -Color.prototype.isColor = true; - export { Color, SRGBToLinear }; diff --git a/src/math/Euler.js b/src/math/Euler.js index 943923f830201..b7f8a971ab7b8 100644 --- a/src/math/Euler.js +++ b/src/math/Euler.js @@ -9,6 +9,8 @@ class Euler { constructor( x = 0, y = 0, z = 0, order = Euler.DefaultOrder ) { + this.isEuler = true; + this._x = x; this._y = y; this._z = z; @@ -316,8 +318,6 @@ class Euler { } -Euler.prototype.isEuler = true; - Euler.DefaultOrder = 'XYZ'; Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; diff --git a/src/math/Matrix3.js b/src/math/Matrix3.js index 9005740e2f082..898522dfd6ae2 100644 --- a/src/math/Matrix3.js +++ b/src/math/Matrix3.js @@ -2,6 +2,8 @@ class Matrix3 { constructor() { + this.isMatrix3 = true; + this.elements = [ 1, 0, 0, @@ -334,6 +336,4 @@ class Matrix3 { } -Matrix3.prototype.isMatrix3 = true; - export { Matrix3 }; diff --git a/src/math/Matrix4.js b/src/math/Matrix4.js index 5383e24c3f9d9..2c327f35faacf 100644 --- a/src/math/Matrix4.js +++ b/src/math/Matrix4.js @@ -1,9 +1,10 @@ import { Vector3 } from './Vector3.js'; - class Matrix4 { constructor() { + this.isMatrix4 = true; + this.elements = [ 1, 0, 0, 0, @@ -872,8 +873,6 @@ class Matrix4 { } -Matrix4.prototype.isMatrix4 = true; - const _v1 = /*@__PURE__*/ new Vector3(); const _m1 = /*@__PURE__*/ new Matrix4(); const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 ); diff --git a/src/math/Plane.js b/src/math/Plane.js index fc8a471b7e37f..795f9173f81cb 100644 --- a/src/math/Plane.js +++ b/src/math/Plane.js @@ -9,6 +9,8 @@ class Plane { constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) { + this.isPlane = true; + // normal is assumed to be normalized this.normal = normal; @@ -200,6 +202,4 @@ class Plane { } -Plane.prototype.isPlane = true; - export { Plane }; diff --git a/src/math/Quaternion.js b/src/math/Quaternion.js index 2e998856384f6..6f38435266c1e 100644 --- a/src/math/Quaternion.js +++ b/src/math/Quaternion.js @@ -4,6 +4,8 @@ class Quaternion { constructor( x = 0, y = 0, z = 0, w = 1 ) { + this.isQuaternion = true; + this._x = x; this._y = y; this._z = z; @@ -693,6 +695,4 @@ class Quaternion { } -Quaternion.prototype.isQuaternion = true; - export { Quaternion }; diff --git a/src/math/SphericalHarmonics3.js b/src/math/SphericalHarmonics3.js index 2d8796fba3a70..5ec3610534b07 100644 --- a/src/math/SphericalHarmonics3.js +++ b/src/math/SphericalHarmonics3.js @@ -14,6 +14,8 @@ class SphericalHarmonics3 { constructor() { + this.isSphericalHarmonics3 = true; + this.coefficients = []; for ( let i = 0; i < 9; i ++ ) { @@ -238,6 +240,4 @@ class SphericalHarmonics3 { } -SphericalHarmonics3.prototype.isSphericalHarmonics3 = true; - export { SphericalHarmonics3 }; diff --git a/src/math/Vector2.js b/src/math/Vector2.js index 88592aa34d087..8000533a7c1f3 100644 --- a/src/math/Vector2.js +++ b/src/math/Vector2.js @@ -2,6 +2,8 @@ class Vector2 { constructor( x = 0, y = 0 ) { + this.isVector2 = true; + this.x = x; this.y = y; @@ -479,6 +481,4 @@ class Vector2 { } -Vector2.prototype.isVector2 = true; - export { Vector2 }; diff --git a/src/math/Vector3.js b/src/math/Vector3.js index f88aa3e8feddf..8ab45747d6d8d 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -1,10 +1,11 @@ import * as MathUtils from './MathUtils.js'; import { Quaternion } from './Quaternion.js'; - class Vector3 { constructor( x = 0, y = 0, z = 0 ) { + this.isVector3 = true; + this.x = x; this.y = y; this.z = z; @@ -747,8 +748,6 @@ class Vector3 { } -Vector3.prototype.isVector3 = true; - const _vector = /*@__PURE__*/ new Vector3(); const _quaternion = /*@__PURE__*/ new Quaternion(); diff --git a/src/math/Vector4.js b/src/math/Vector4.js index c9af047ace0a1..d2edcf22df7db 100644 --- a/src/math/Vector4.js +++ b/src/math/Vector4.js @@ -2,6 +2,8 @@ class Vector4 { constructor( x = 0, y = 0, z = 0, w = 1 ) { + this.isVector4 = true; + this.x = x; this.y = y; this.z = z; @@ -659,6 +661,4 @@ class Vector4 { } -Vector4.prototype.isVector4 = true; - export { Vector4 }; diff --git a/src/objects/Bone.js b/src/objects/Bone.js index 01d87b5fb944b..a673aab3725c2 100644 --- a/src/objects/Bone.js +++ b/src/objects/Bone.js @@ -6,12 +6,12 @@ class Bone extends Object3D { super(); + this.isBone = true; + this.type = 'Bone'; } } -Bone.prototype.isBone = true; - export { Bone }; diff --git a/src/objects/Group.js b/src/objects/Group.js index 59a04edd45ec5..d4fee8425505f 100644 --- a/src/objects/Group.js +++ b/src/objects/Group.js @@ -6,12 +6,12 @@ class Group extends Object3D { super(); + this.isGroup = true; + this.type = 'Group'; } } -Group.prototype.isGroup = true; - export { Group }; diff --git a/src/objects/InstancedMesh.js b/src/objects/InstancedMesh.js index ade4d60d7596f..b37dc2257cdf4 100644 --- a/src/objects/InstancedMesh.js +++ b/src/objects/InstancedMesh.js @@ -15,6 +15,8 @@ class InstancedMesh extends Mesh { super( geometry, material ); + this.isInstancedMesh = true; + this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 ); this.instanceColor = null; @@ -121,6 +123,4 @@ class InstancedMesh extends Mesh { } -InstancedMesh.prototype.isInstancedMesh = true; - export { InstancedMesh }; diff --git a/src/objects/Line.js b/src/objects/Line.js index d2047c8c25a73..5ee17c2d65867 100644 --- a/src/objects/Line.js +++ b/src/objects/Line.js @@ -19,6 +19,8 @@ class Line extends Object3D { super(); + this.isLine = true; + this.type = 'Line'; this.geometry = geometry; @@ -247,7 +249,4 @@ class Line extends Object3D { } -Line.prototype.isLine = true; - - export { Line }; diff --git a/src/objects/LineLoop.js b/src/objects/LineLoop.js index aa34882084590..8c3ac94fee7c3 100644 --- a/src/objects/LineLoop.js +++ b/src/objects/LineLoop.js @@ -6,12 +6,12 @@ class LineLoop extends Line { super( geometry, material ); + this.isLineLoop = true; + this.type = 'LineLoop'; } } -LineLoop.prototype.isLineLoop = true; - export { LineLoop }; diff --git a/src/objects/LineSegments.js b/src/objects/LineSegments.js index 5e06c7954a18c..b28d3661f022e 100644 --- a/src/objects/LineSegments.js +++ b/src/objects/LineSegments.js @@ -11,6 +11,8 @@ class LineSegments extends Line { super( geometry, material ); + this.isLineSegments = true; + this.type = 'LineSegments'; } @@ -58,6 +60,4 @@ class LineSegments extends Line { } -LineSegments.prototype.isLineSegments = true; - export { LineSegments }; diff --git a/src/objects/Mesh.js b/src/objects/Mesh.js index fccbb035698a0..973dc10c2e1f3 100644 --- a/src/objects/Mesh.js +++ b/src/objects/Mesh.js @@ -38,6 +38,8 @@ class Mesh extends Object3D { super(); + this.isMesh = true; + this.type = 'Mesh'; this.geometry = geometry; @@ -286,8 +288,6 @@ class Mesh extends Object3D { } -Mesh.prototype.isMesh = true; - function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) { let intersect; diff --git a/src/objects/Points.js b/src/objects/Points.js index b25f38fb39fbd..61be0e6a4c57a 100644 --- a/src/objects/Points.js +++ b/src/objects/Points.js @@ -17,6 +17,8 @@ class Points extends Object3D { super(); + this.isPoints = true; + this.type = 'Points'; this.geometry = geometry; @@ -153,8 +155,6 @@ class Points extends Object3D { } -Points.prototype.isPoints = true; - function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) { const rayPointDistanceSq = _ray.distanceSqToPoint( point ); diff --git a/src/objects/SkinnedMesh.js b/src/objects/SkinnedMesh.js index eabba0d1111a2..602d1caa14750 100644 --- a/src/objects/SkinnedMesh.js +++ b/src/objects/SkinnedMesh.js @@ -17,6 +17,8 @@ class SkinnedMesh extends Mesh { super( geometry, material ); + this.isSkinnedMesh = true; + this.type = 'SkinnedMesh'; this.bindMode = 'attached'; @@ -146,6 +148,4 @@ class SkinnedMesh extends Mesh { } -SkinnedMesh.prototype.isSkinnedMesh = true; - export { SkinnedMesh }; diff --git a/src/objects/Sprite.js b/src/objects/Sprite.js index 93564674adbb7..39d69d4a68e11 100644 --- a/src/objects/Sprite.js +++ b/src/objects/Sprite.js @@ -32,6 +32,8 @@ class Sprite extends Object3D { super(); + this.isSprite = true; + this.type = 'Sprite'; if ( _geometry === undefined ) { @@ -149,8 +151,6 @@ class Sprite extends Object3D { } -Sprite.prototype.isSprite = true; - function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) { // compute position in camera space diff --git a/src/renderers/WebGL3DRenderTarget.js b/src/renderers/WebGL3DRenderTarget.js index 6c9e6a0a1f63a..5b78f42bc2ce0 100644 --- a/src/renderers/WebGL3DRenderTarget.js +++ b/src/renderers/WebGL3DRenderTarget.js @@ -7,6 +7,8 @@ class WebGL3DRenderTarget extends WebGLRenderTarget { super( width, height ); + this.isWebGL3DRenderTarget = true; + this.depth = depth; this.texture = new Data3DTexture( null, width, height, depth ); @@ -17,6 +19,4 @@ class WebGL3DRenderTarget extends WebGLRenderTarget { } -WebGL3DRenderTarget.prototype.isWebGL3DRenderTarget = true; - export { WebGL3DRenderTarget }; diff --git a/src/renderers/WebGLArrayRenderTarget.js b/src/renderers/WebGLArrayRenderTarget.js index 754a52a58804b..4f63411383b36 100644 --- a/src/renderers/WebGLArrayRenderTarget.js +++ b/src/renderers/WebGLArrayRenderTarget.js @@ -7,6 +7,8 @@ class WebGLArrayRenderTarget extends WebGLRenderTarget { super( width, height ); + this.isWebGLArrayRenderTarget = true; + this.depth = depth; this.texture = new DataArrayTexture( null, width, height, depth ); @@ -17,6 +19,4 @@ class WebGLArrayRenderTarget extends WebGLRenderTarget { } -WebGLArrayRenderTarget.prototype.isWebGLArrayRenderTarget = true; - export { WebGLArrayRenderTarget }; diff --git a/src/renderers/WebGLCubeRenderTarget.js b/src/renderers/WebGLCubeRenderTarget.js index 1e5fd1f6d8e11..a5a7dddc22f05 100644 --- a/src/renderers/WebGLCubeRenderTarget.js +++ b/src/renderers/WebGLCubeRenderTarget.js @@ -13,6 +13,8 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { super( size, size, options ); + this.isWebGLCubeRenderTarget = true; + const image = { width: size, height: size, depth: 1 }; const images = [ image, image, image, image, image, image ]; @@ -141,6 +143,4 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { } -WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true; - export { WebGLCubeRenderTarget }; diff --git a/src/renderers/WebGLMultipleRenderTargets.js b/src/renderers/WebGLMultipleRenderTargets.js index a0bff130049bf..01613215e95d5 100644 --- a/src/renderers/WebGLMultipleRenderTargets.js +++ b/src/renderers/WebGLMultipleRenderTargets.js @@ -6,6 +6,8 @@ class WebGLMultipleRenderTargets extends WebGLRenderTarget { super( width, height, options ); + this.isWebGLMultipleRenderTargets = true; + const texture = this.texture; this.texture = []; @@ -77,6 +79,4 @@ class WebGLMultipleRenderTargets extends WebGLRenderTarget { } -WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true; - export { WebGLMultipleRenderTargets }; diff --git a/src/renderers/WebGLRenderTarget.js b/src/renderers/WebGLRenderTarget.js index e286d2ccd66ce..346dc092aedf6 100644 --- a/src/renderers/WebGLRenderTarget.js +++ b/src/renderers/WebGLRenderTarget.js @@ -15,6 +15,8 @@ class WebGLRenderTarget extends EventDispatcher { super(); + this.isWebGLRenderTarget = true; + this.width = width; this.height = height; this.depth = 1; @@ -105,6 +107,4 @@ class WebGLRenderTarget extends EventDispatcher { } -WebGLRenderTarget.prototype.isWebGLRenderTarget = true; - export { WebGLRenderTarget }; diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index cbd21455882aa..696d68a47266f 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -56,6 +56,8 @@ function createCanvasElement() { function WebGLRenderer( parameters = {} ) { + this.isWebGLRenderer = true; + const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(), _context = parameters.context !== undefined ? parameters.context : null, @@ -2191,6 +2193,4 @@ function WebGLRenderer( parameters = {} ) { } -WebGLRenderer.prototype.isWebGLRenderer = true; - export { WebGLRenderer }; diff --git a/src/scenes/Fog.js b/src/scenes/Fog.js index ccd4bd706fc7d..03b89c71d824a 100644 --- a/src/scenes/Fog.js +++ b/src/scenes/Fog.js @@ -4,6 +4,8 @@ class Fog { constructor( color, near = 1, far = 1000 ) { + this.isFog = true; + this.name = ''; this.color = new Color( color ); @@ -32,6 +34,4 @@ class Fog { } -Fog.prototype.isFog = true; - export { Fog }; diff --git a/src/scenes/FogExp2.js b/src/scenes/FogExp2.js index 9cb28290866a5..3f60d0881e25c 100644 --- a/src/scenes/FogExp2.js +++ b/src/scenes/FogExp2.js @@ -4,6 +4,8 @@ class FogExp2 { constructor( color, density = 0.00025 ) { + this.isFogExp2 = true; + this.name = ''; this.color = new Color( color ); @@ -29,6 +31,4 @@ class FogExp2 { } -FogExp2.prototype.isFogExp2 = true; - export { FogExp2 }; diff --git a/src/scenes/Scene.js b/src/scenes/Scene.js index 2ca0ec5554cd8..2dc6785cb9d8b 100644 --- a/src/scenes/Scene.js +++ b/src/scenes/Scene.js @@ -6,6 +6,8 @@ class Scene extends Object3D { super(); + this.isScene = true; + this.type = 'Scene'; this.background = null; @@ -53,6 +55,4 @@ class Scene extends Object3D { } -Scene.prototype.isScene = true; - export { Scene }; diff --git a/src/textures/CanvasTexture.js b/src/textures/CanvasTexture.js index 35511ff133c82..61a58b3b34929 100644 --- a/src/textures/CanvasTexture.js +++ b/src/textures/CanvasTexture.js @@ -6,12 +6,12 @@ class CanvasTexture extends Texture { super( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); + this.isCanvasTexture = true; + this.needsUpdate = true; } } -CanvasTexture.prototype.isCanvasTexture = true; - export { CanvasTexture }; diff --git a/src/textures/CompressedTexture.js b/src/textures/CompressedTexture.js index cf0e37d017bd2..319a674da5f31 100644 --- a/src/textures/CompressedTexture.js +++ b/src/textures/CompressedTexture.js @@ -6,6 +6,8 @@ class CompressedTexture extends Texture { super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); + this.isCompressedTexture = true; + this.image = { width: width, height: height }; this.mipmaps = mipmaps; @@ -23,6 +25,4 @@ class CompressedTexture extends Texture { } -CompressedTexture.prototype.isCompressedTexture = true; - export { CompressedTexture }; diff --git a/src/textures/CubeTexture.js b/src/textures/CubeTexture.js index 84db191d0bdbd..0489f8225ab52 100644 --- a/src/textures/CubeTexture.js +++ b/src/textures/CubeTexture.js @@ -10,6 +10,8 @@ class CubeTexture extends Texture { super( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); + this.isCubeTexture = true; + this.flipY = false; } @@ -28,6 +30,4 @@ class CubeTexture extends Texture { } -CubeTexture.prototype.isCubeTexture = true; - export { CubeTexture }; diff --git a/src/textures/Data3DTexture.js b/src/textures/Data3DTexture.js index 763c058189119..36348cc1f04a1 100644 --- a/src/textures/Data3DTexture.js +++ b/src/textures/Data3DTexture.js @@ -15,6 +15,8 @@ class Data3DTexture extends Texture { super( null ); + this.isData3DTexture = true; + this.image = { data, width, height, depth }; this.magFilter = NearestFilter; @@ -30,6 +32,4 @@ class Data3DTexture extends Texture { } -Data3DTexture.prototype.isData3DTexture = true; - export { Data3DTexture }; diff --git a/src/textures/DataArrayTexture.js b/src/textures/DataArrayTexture.js index 72badd78b5712..759973df66378 100644 --- a/src/textures/DataArrayTexture.js +++ b/src/textures/DataArrayTexture.js @@ -7,6 +7,8 @@ class DataArrayTexture extends Texture { super( null ); + this.isDataArrayTexture = true; + this.image = { data, width, height, depth }; this.magFilter = NearestFilter; @@ -22,6 +24,4 @@ class DataArrayTexture extends Texture { } -DataArrayTexture.prototype.isDataArrayTexture = true; - export { DataArrayTexture }; diff --git a/src/textures/DataTexture.js b/src/textures/DataTexture.js index 3aabd2cc74e6a..9cefb13dc7b5d 100644 --- a/src/textures/DataTexture.js +++ b/src/textures/DataTexture.js @@ -7,6 +7,8 @@ class DataTexture extends Texture { super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ); + this.isDataTexture = true; + this.image = { data: data, width: width, height: height }; this.generateMipmaps = false; @@ -17,6 +19,4 @@ class DataTexture extends Texture { } -DataTexture.prototype.isDataTexture = true; - export { DataTexture }; diff --git a/src/textures/DepthTexture.js b/src/textures/DepthTexture.js index 79cb16e3c02c2..fba1630fd3326 100644 --- a/src/textures/DepthTexture.js +++ b/src/textures/DepthTexture.js @@ -18,6 +18,8 @@ class DepthTexture extends Texture { super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); + this.isDepthTexture = true; + this.image = { width: width, height: height }; this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; @@ -31,6 +33,4 @@ class DepthTexture extends Texture { } -DepthTexture.prototype.isDepthTexture = true; - export { DepthTexture }; diff --git a/src/textures/FramebufferTexture.js b/src/textures/FramebufferTexture.js index 3a8beb74c5dc2..322d74031c7ad 100644 --- a/src/textures/FramebufferTexture.js +++ b/src/textures/FramebufferTexture.js @@ -7,6 +7,8 @@ class FramebufferTexture extends Texture { super( { width, height } ); + this.isFramebufferTexture = true; + this.format = format; this.magFilter = NearestFilter; @@ -20,6 +22,4 @@ class FramebufferTexture extends Texture { } -FramebufferTexture.prototype.isFramebufferTexture = true; - export { FramebufferTexture }; diff --git a/src/textures/Source.js b/src/textures/Source.js index d17fab91856ac..659a1c74eb45e 100644 --- a/src/textures/Source.js +++ b/src/textures/Source.js @@ -5,6 +5,8 @@ class Source { constructor( data = null ) { + this.isSource = true; + this.uuid = MathUtils.generateUUID(); this.data = data; @@ -118,6 +120,4 @@ function serializeImage( image ) { } -Source.prototype.isSource = true; - export { Source }; diff --git a/src/textures/Texture.js b/src/textures/Texture.js index b03e055b69a65..b552e32062524 100644 --- a/src/textures/Texture.js +++ b/src/textures/Texture.js @@ -23,6 +23,8 @@ class Texture extends EventDispatcher { super(); + this.isTexture = true; + Object.defineProperty( this, 'id', { value: textureId ++ } ); this.uuid = MathUtils.generateUUID(); @@ -303,6 +305,4 @@ class Texture extends EventDispatcher { Texture.DEFAULT_IMAGE = null; Texture.DEFAULT_MAPPING = UVMapping; -Texture.prototype.isTexture = true; - export { Texture }; diff --git a/src/textures/VideoTexture.js b/src/textures/VideoTexture.js index b49d397cd87d1..9f6b7123513e5 100644 --- a/src/textures/VideoTexture.js +++ b/src/textures/VideoTexture.js @@ -7,6 +7,8 @@ class VideoTexture extends Texture { super( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ); + this.isVideoTexture = true; + this.minFilter = minFilter !== undefined ? minFilter : LinearFilter; this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; @@ -50,6 +52,4 @@ class VideoTexture extends Texture { } -VideoTexture.prototype.isVideoTexture = true; - export { VideoTexture }; diff --git a/test/unit/src/core/Object3D.tests.js b/test/unit/src/core/Object3D.tests.js index d500bb97dc9e2..a5330cb197166 100644 --- a/test/unit/src/core/Object3D.tests.js +++ b/test/unit/src/core/Object3D.tests.js @@ -301,11 +301,9 @@ export default QUnit.module( 'Core', () => { obj.translateOnAxis( new Vector3( 0, 1, 0 ), 1.23 ); obj.translateOnAxis( new Vector3( 0, 0, 1 ), - 4.56 ); - assert.propEqual( obj.position, { - x: 1, - y: 1.23, - z: - 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' ); } );