Преглед на файлове

Updated ColladaLoader to geometry.materials-less setup.

Mr.doob преди 12 години
родител
ревизия
4d31056f51
променени са 2 файла, в които са добавени 8 реда и са изтрити 11 реда
  1. 1 2
      examples/js/loaders/ColladaLoader.js
  2. 7 9
      examples/webgl_geometry_text.html

+ 1 - 2
examples/js/loaders/ColladaLoader.js

@@ -782,8 +782,7 @@ THREE.ColladaLoader = function () {
 
 				if ( num_materials > 1 ) {
 
-					material = new THREE.MeshFaceMaterial();
-					geom.materials = used_materials_array;
+					material = new THREE.MeshFaceMaterial( used_materials_array );
 
 					for ( j = 0; j < geom.faces.length; j ++ ) {
 

+ 7 - 9
examples/webgl_geometry_text.html

@@ -81,7 +81,7 @@
 			var composer;
 			var effectFXAA;
 
-			var textMesh1, textMesh2, textGeo, faceMaterial, textMaterialFront, textMaterialSide, parent;
+			var textMesh1, textMesh2, textGeo, material, parent;
 
 			var firstLetter = true;
 
@@ -222,10 +222,10 @@
 
 				}
 
-				faceMaterial = new THREE.MeshFaceMaterial();
-
-				textMaterialFront = new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
-				textMaterialSide = new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } );
+				material = new THREE.MeshFaceMaterial( [ 
+					new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } ), // front
+					new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) // side
+				] );
 
 				parent = new THREE.Object3D();
 				parent.position.y = 100;
@@ -463,8 +463,6 @@
 
 				});
 
-				textGeo.materials = [ textMaterialFront, textMaterialSide ];
-
 				textGeo.computeBoundingBox();
 				textGeo.computeVertexNormals();
 
@@ -512,7 +510,7 @@
 
 				var centerOffset = -0.5 * ( textGeo.boundingBox.max.x - textGeo.boundingBox.min.x );
 
-				textMesh1 = new THREE.Mesh( textGeo, faceMaterial );
+				textMesh1 = new THREE.Mesh( textGeo, material );
 
 				textMesh1.position.x = centerOffset;
 				textMesh1.position.y = hover;
@@ -525,7 +523,7 @@
 
 				if ( mirror ) {
 
-					textMesh2 = new THREE.Mesh( textGeo, faceMaterial );
+					textMesh2 = new THREE.Mesh( textGeo, material );
 
 					textMesh2.position.x = centerOffset;
 					textMesh2.position.y = -hover;