浏览代码

GLTFExporter: Morph Target weights support

Takahiro 7 年之前
父节点
当前提交
268c22fc5b
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      examples/js/exporters/GLTFExporter.js

+ 5 - 0
examples/js/exporters/GLTFExporter.js

@@ -792,6 +792,7 @@ THREE.GLTFExporter.prototype = {
 			// Morph targets
 			if ( mesh.morphTargetInfluences !== undefined && mesh.morphTargetInfluences.length > 0 ) {
 
+				var weights = [];
 				gltfMesh.primitives[ 0 ].targets = [];
 
 				for ( var i = 0; i < mesh.morphTargetInfluences.length; ++ i ) {
@@ -808,8 +809,12 @@ THREE.GLTFExporter.prototype = {
 
 					gltfMesh.primitives[ 0 ].targets.push( target );
 
+					weights.push( mesh.morphTargetInfluences[ i ] );
+
 				}
 
+				gltfMesh.weights = weights;
+
 			}
 
 			outputJSON.meshes.push( gltfMesh );