Browse Source

Merge pull request #6081 from fraguada/fraguada-ObjectLoader-Textures

additional ObjectLoader.js texture maps
Mr.doob 10 years ago
parent
commit
97b599345b
1 changed files with 94 additions and 1 deletions
  1. 94 1
      src/loaders/ObjectLoader.js

+ 94 - 1
src/loaders/ObjectLoader.js

@@ -229,11 +229,83 @@ THREE.ObjectLoader.prototype = {
 
 						console.warn( 'THREE.ObjectLoader: Undefined texture', data.map );
 
-				}
+					}
 
 					material.map = textures[ data.map ];
 
 				}
+				
+				if ( data.bumpMap ) {	
+			
+					if ( !textures[data.bumpMap] ) {
+						
+						console.warn( 'THREE.ObjectLoader: Undefined texture', data.bumpMap );
+					
+					}
+					
+					material.bumpMap = textures[data.bumpMap];
+					
+				}
+				
+				if ( data.alphaMap ) {
+					
+					if ( !textures[data.alphaMap] ) {
+						
+						console.warn( 'THREE.ObjectLoader: Undefined texture', data.alphaMap );
+						
+					}
+					
+					material.alphaMap = textures[data.alphaMap];
+					
+				}
+				
+				if ( data.envMap ) {
+				
+					if ( !textures[data.envMap] ) {
+						
+						console.warn( 'THREE.ObjectLoader: Undefined texture', data.envMap );
+						
+					}
+					
+					material.envMap = textures[data.envMap];
+					
+				}
+				
+				if ( data.normalMap ) {
+				
+					if ( !textures[data.normalMap] ) {
+						
+						console.warn( 'THREE.ObjectLoader: Undefined texture', data.normalMap );
+						
+					}
+					
+					material.normalMap = textures[data.normalMap];
+					
+				}
+				
+				if ( data.lightMap ) {
+				
+					if ( !textures[data.lightMap] ) {
+						
+						console.warn( 'THREE.ObjectLoader: Undefined texture', data.lightMap );
+						
+					}
+					
+					material.lightMap = textures[data.lightMap];
+					
+				}
+				
+				if ( data.specularMap ) {
+				
+					if ( !textures[data.specularMap] ) {
+						
+						console.warn( 'THREE.ObjectLoader: Undefined texture', data.specularMap );
+						
+					}
+					
+					material.specularMap = textures[data.specularMap];
+					
+				}
 
 				materials[ data.uuid ] = material;
 
@@ -437,6 +509,27 @@ THREE.ObjectLoader.prototype = {
 					object = new THREE.Line( geometry, material );
 
 					break;
+					
+				case 'PointCloud':
+
+					var geometry = geometries[ data.geometry ];
+					var material = materials[ data.material ];
+
+					if ( geometry === undefined ) {
+
+						console.warn( 'THREE.ObjectLoader: Undefined geometry', data.geometry );
+
+					}
+
+					if ( material === undefined ) {
+
+						console.warn( 'THREE.ObjectLoader: Undefined material', data.material );
+
+					}
+
+					object = new THREE.PointCloud( geometry, material );
+
+					break;
 
 				case 'Sprite':