Explorar o código

Always init true, default data to null

Elias Hasle %!s(int64=5) %!d(string=hai) anos
pai
achega
bf8383d0d4
Modificáronse 1 ficheiros con 2 adicións e 5 borrados
  1. 2 5
      src/textures/DataTexture.js

+ 2 - 5
src/textures/DataTexture.js

@@ -9,7 +9,7 @@ function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT,
 
 	Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
 
-	this.image = { data: data, width: width, height: height };
+	this.image = { data: data || null, width: width || 1, height: height || 1 };
 
 	this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
 	this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
@@ -18,11 +18,8 @@ function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT,
 	this.flipY = false;
 	this.unpackAlignment = 1;
 
-	if ( data ) {
+	this.needsUpdate = true;
 
-		this.needsUpdate = true;
-
-	}
 }
 
 DataTexture.prototype = Object.create( Texture.prototype );