Browse Source

reintroduce class.prototype.is* properties

DefinitelyMaybe 4 years ago
parent
commit
a45af3159b

+ 2 - 2
src/textures/CanvasTexture.js

@@ -6,12 +6,12 @@ class CanvasTexture extends Texture {
 
 		super( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
-		Object.defineProperty( this, 'isCanvasTexture', { value: true } );
-
 		this.needsUpdate = true;
 
 	}
 
 }
 
+CanvasTexture.prototype.isCanvasTexture = true;
+
 export { CanvasTexture };

+ 2 - 2
src/textures/CompressedTexture.js

@@ -6,8 +6,6 @@ class CompressedTexture extends Texture {
 
 		super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
 
-		Object.defineProperty( this, 'isCompressedTexture', { value: true } );
-
 		this.image = { width: width, height: height };
 		this.mipmaps = mipmaps;
 
@@ -25,4 +23,6 @@ class CompressedTexture extends Texture {
 
 }
 
+CompressedTexture.prototype.isCompressedTexture = true;
+
 export { CompressedTexture };

+ 2 - 2
src/textures/CubeTexture.js

@@ -11,8 +11,6 @@ class CubeTexture extends Texture {
 
 		super( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
 
-		Object.defineProperty( this, 'isCubeTexture', { value: true } );
-
 		// Why CubeTexture._needsFlipEnvMap is necessary:
 		//
 		// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
@@ -43,4 +41,6 @@ class CubeTexture extends Texture {
 
 }
 
+CubeTexture.prototype.isCubeTexture = true;
+
 export { CubeTexture };

+ 2 - 2
src/textures/DataTexture.js

@@ -7,8 +7,6 @@ class DataTexture extends Texture {
 
 		super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
 
-		Object.defineProperty( this, 'isDataTexture', { value: true } );
-
 		this.image = { data: data || null, width: width || 1, height: height || 1 };
 
 		this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
@@ -24,4 +22,6 @@ class DataTexture extends Texture {
 
 }
 
+DataTexture.prototype.isDataTexture = true;
+
 export { DataTexture };

+ 2 - 2
src/textures/DataTexture2DArray.js

@@ -7,8 +7,6 @@ class DataTexture2DArray extends Texture {
 
 		super( null );
 
-		Object.defineProperty( this, 'isDataTexture2DArray', { value: true } );
-
 		this.image = { data, width, height, depth };
 
 		this.magFilter = NearestFilter;
@@ -25,4 +23,6 @@ class DataTexture2DArray extends Texture {
 
 }
 
+DataTexture2DArray.prototype.isDataTexture2DArray = true;
+
 export { DataTexture2DArray };

+ 2 - 2
src/textures/DataTexture3D.js

@@ -15,8 +15,6 @@ class DataTexture3D extends Texture {
 
 		super( null );
 
-		Object.defineProperty( this, 'isDataTexture3D', { value: true } );
-
 		this.image = { data, width, height, depth };
 
 		this.magFilter = NearestFilter;
@@ -33,4 +31,6 @@ class DataTexture3D extends Texture {
 
 }
 
+DataTexture3D.prototype.isDataTexture3D = true;
+
 export { DataTexture3D };

+ 2 - 2
src/textures/DepthTexture.js

@@ -18,8 +18,6 @@ class DepthTexture extends Texture {
 
 		super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
-		Object.defineProperty( this, 'isDepthTexture', { value: true } );
-
 		this.image = { width: width, height: height };
 
 		this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
@@ -33,4 +31,6 @@ class DepthTexture extends Texture {
 
 }
 
+DepthTexture.prototype.isDepthTexture = true;
+
 export { DepthTexture };

+ 2 - 2
src/textures/VideoTexture.js

@@ -7,8 +7,6 @@ class VideoTexture extends Texture {
 
 		super( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
-		Object.defineProperty( this, 'isVideoTexture', { value: true } );
-
 		this.format = format !== undefined ? format : RGBFormat;
 
 		this.minFilter = minFilter !== undefined ? minFilter : LinearFilter;
@@ -54,4 +52,6 @@ class VideoTexture extends Texture {
 
 }
 
+VideoTexture.prototype.isVideoTexture = true;
+
 export { VideoTexture };