浏览代码

Projector: Support THREE.FaceColors.

Don McCurdy 7 年之前
父节点
当前提交
f0d3d639d0
共有 2 个文件被更改,包括 19 次插入0 次删除
  1. 1 0
      examples/canvas_morphtargets_horse.html
  2. 18 0
      examples/js/renderers/Projector.js

+ 1 - 0
examples/canvas_morphtargets_horse.html

@@ -70,6 +70,7 @@
 
 
 					var mesh = gltf.scene.children[ 0 ];
 					var mesh = gltf.scene.children[ 0 ];
 					mesh.material.overdraw = 0.5;
 					mesh.material.overdraw = 0.5;
+					mesh.material.vertexColors = THREE.FaceColors;
 					mesh.scale.set( 1.5, 1.5, 1.5 );
 					mesh.scale.set( 1.5, 1.5, 1.5 );
 					scene.add( mesh );
 					scene.add( mesh );
 
 

+ 18 - 0
examples/js/renderers/Projector.js

@@ -322,6 +322,12 @@ THREE.Projector = function () {
 
 
 				_face.material = material;
 				_face.material = material;
 
 
+				if ( material.vertexColors === THREE.FaceColors ) {
+
+					_face.color.fromArray( colors, a * 3 );
+
+				}
+
 				_renderData.elements.push( _face );
 				_renderData.elements.push( _face );
 
 
 			}
 			}
@@ -473,6 +479,18 @@ THREE.Projector = function () {
 
 
 					}
 					}
 
 
+					if ( attributes.color !== undefined ) {
+
+						var colors = attributes.color.array;
+
+						for ( var i = 0, l = colors.length; i < l; i += 3 ) {
+
+							renderList.pushColor( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] );
+
+						}
+
+					}
+
 					if ( attributes.uv !== undefined ) {
 					if ( attributes.uv !== undefined ) {
 
 
 						var uvs = attributes.uv.array;
 						var uvs = attributes.uv.array;