Browse Source

Added CanvasTexture.

Mr.doob 10 years ago
parent
commit
5d3f840805
3 changed files with 16 additions and 1 deletions
  1. 14 0
      src/textures/CanvasTexture.js
  2. 1 1
      src/textures/Texture.js
  3. 1 0
      utils/build/includes/common.json

+ 14 - 0
src/textures/CanvasTexture.js

@@ -0,0 +1,14 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.CanvasTexture = function ( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
+
+	THREE.Texture.call( this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
+
+	this.needsUpdate = true;
+
+};
+
+THREE.CanvasTexture.prototype = Object.create( THREE.Texture.prototype );
+THREE.CanvasTexture.prototype.constructor = THREE.CanvasTexture;

+ 1 - 1
src/textures/Texture.js

@@ -76,7 +76,7 @@ THREE.Texture.prototype = {
 
 		this.anisotropy = source.anisotropy;
 
-		this.format = source.format;		
+		this.format = source.format;
 		this.type = source.type;
 
 		this.offset.copy( source.offset );

+ 1 - 0
utils/build/includes/common.json

@@ -71,6 +71,7 @@
 	"src/materials/RawShaderMaterial.js",
 	"src/materials/SpriteMaterial.js",
 	"src/textures/Texture.js",
+	"src/textures/CanvasTexture.js",
 	"src/textures/CubeTexture.js",
 	"src/textures/CompressedTexture.js",
 	"src/textures/DataTexture.js",