Browse Source

Merge pull request #8326 from bhouston/cubeTextureAlias

Clean up of CubeTexture.images
Mr.doob 9 years ago
parent
commit
e6a25c3c81

+ 1 - 1
examples/js/loaders/HDRCubeTextureLoader.js

@@ -12,7 +12,7 @@ THREE.HDRCubeTextureLoader = function (manager) {
 }
 }
 
 
 THREE.HDRCubeTextureLoader.prototype.load = function(type, urls, onLoad, onProgress, onError) {
 THREE.HDRCubeTextureLoader.prototype.load = function(type, urls, onLoad, onProgress, onError) {
-  var texture = new THREE.CubeTexture( [] );
+  var texture = new THREE.CubeTexture();
 
 
   texture.type = type;
   texture.type = type;
   texture.encoding = (type === THREE.UnsignedByteType) ? THREE.RGBEEncoding : THREE.LinearEncoding;
   texture.encoding = (type === THREE.UnsignedByteType) ? THREE.RGBEEncoding : THREE.LinearEncoding;

+ 1 - 1
src/loaders/CubeTextureLoader.js

@@ -14,7 +14,7 @@ THREE.CubeTextureLoader.prototype = {
 
 
 	load: function ( urls, onLoad, onProgress, onError ) {
 	load: function ( urls, onLoad, onProgress, onError ) {
 
 
-		var texture = new THREE.CubeTexture( [] );
+		var texture = new THREE.CubeTexture();
 
 
 		var loader = new THREE.ImageLoader( this.manager );
 		var loader = new THREE.ImageLoader( this.manager );
 		loader.setCrossOrigin( this.crossOrigin );
 		loader.setCrossOrigin( this.crossOrigin );

+ 10 - 10
src/textures/CubeTexture.js

@@ -4,11 +4,11 @@
 
 
 THREE.CubeTexture = function ( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
 THREE.CubeTexture = function ( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
 
 
+	images = images !== undefined ? images : [];
 	mapping = mapping !== undefined ? mapping : THREE.CubeReflectionMapping;
 	mapping = mapping !== undefined ? mapping : THREE.CubeReflectionMapping;
 
 
 	THREE.Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 	THREE.Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
 
-	this.images = images;
 	this.flipY = false;
 	this.flipY = false;
 
 
 };
 };
@@ -16,12 +16,12 @@ THREE.CubeTexture = function ( images, mapping, wrapS, wrapT, magFilter, minFilt
 THREE.CubeTexture.prototype = Object.create( THREE.Texture.prototype );
 THREE.CubeTexture.prototype = Object.create( THREE.Texture.prototype );
 THREE.CubeTexture.prototype.constructor = THREE.CubeTexture;
 THREE.CubeTexture.prototype.constructor = THREE.CubeTexture;
 
 
-THREE.CubeTexture.prototype.copy = function ( source ) {
-
-	THREE.Texture.prototype.copy.call( this, source );
-
-	this.images = source.images;
-
-	return this;
-
-};
+Object.defineProperty(THREE.CubeTexture.prototype, "images", {
+		  get: function() {
+				return this.image;
+		  },
+			set: function( value ) {
+				this.image = value;
+			}
+		}
+);