瀏覽代碼

Simplified mipmaps a bit more and returning copy of array when cloning.

Mr.doob 12 年之前
父節點
當前提交
4d1c1edabf
共有 3 個文件被更改,包括 4 次插入5 次删除
  1. 0 1
      examples/webgl_materials_texture_manualmipmap.html
  2. 2 2
      src/renderers/WebGLRenderer.js
  3. 2 2
      src/textures/Texture.js

+ 0 - 1
examples/webgl_materials_texture_manualmipmap.html

@@ -122,7 +122,6 @@
 				var canvas = mipmap( 128, '#f00' );
 				var textureCanvas1 = new THREE.Texture( canvas, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping );
 				textureCanvas1.repeat.set( 1000, 1000 );
-				textureCanvas1.mipmaps = [];
 				textureCanvas1.mipmaps[ 0 ] = canvas;
 				textureCanvas1.mipmaps[ 1 ] = mipmap( 64, '#0f0' );
 				textureCanvas1.mipmaps[ 2 ] = mipmap( 32, '#00f' );

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -6639,7 +6639,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				// if there are no manual mipmaps
 				// set 0 level mipmap and then use GL to generate other mipmap levels
 
-				if ( mipmaps && isImagePowerOfTwo ) {
+				if ( mipmaps.length > 0 && isImagePowerOfTwo ) {
 
 					for ( var i = 0, il = mipmaps.length; i < il; i ++ ) {
 
@@ -6674,7 +6674,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				// if there are no manual mipmaps
 				// set 0 level mipmap and then use GL to generate other mipmap levels
 
-				if ( mipmaps && isImagePowerOfTwo ) {
+				if ( mipmaps.length > 0 && isImagePowerOfTwo ) {
 
 					for ( var i = 0, il = mipmaps.length; i < il; i ++ ) {
 

+ 2 - 2
src/textures/Texture.js

@@ -13,7 +13,7 @@ THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, f
 	this.name = '';
 
 	this.image = image;
-	this.mipmaps = null;
+	this.mipmaps = [];
 
 	this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping();
 
@@ -50,7 +50,7 @@ THREE.Texture.prototype = {
 		if ( texture === undefined ) texture = new THREE.Texture();
 
 		texture.image = this.image;
-		texture.mipmaps = this.mipmaps;
+		texture.mipmaps = this.mipmaps.slice(0);
 
 		texture.mapping = this.mapping;