diff --git a/build/three.js b/build/three.js index ad50e3d3b62be898843daaf95a4ab43f97d5d3dc..efce5bcea055feb16f4ba00bd41100916f9916c8 100644 --- a/build/three.js +++ b/build/three.js @@ -11563,16 +11563,14 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { function parseSkin() { - var i, l, x, y, z, w, a, b, c, d; - if ( json.skinWeights ) { - for ( i = 0, l = json.skinWeights.length; i < l; i += 2 ) { + for ( var i = 0, l = json.skinWeights.length; i < l; i += 2 ) { - x = json.skinWeights[ i ]; - y = json.skinWeights[ i + 1 ]; - z = 0; - w = 0; + var x = json.skinWeights[ i ]; + var y = json.skinWeights[ i + 1 ]; + var z = 0; + var w = 0; geometry.skinWeights.push( new THREE.Vector4( x, y, z, w ) ); @@ -11582,12 +11580,12 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { if ( json.skinIndices ) { - for ( i = 0, l = json.skinIndices.length; i < l; i += 2 ) { + for ( var i = 0, l = json.skinIndices.length; i < l; i += 2 ) { - a = json.skinIndices[ i ]; - b = json.skinIndices[ i + 1 ]; - c = 0; - d = 0; + var a = json.skinIndices[ i ]; + var b = json.skinIndices[ i + 1 ]; + var c = 0; + var d = 0; geometry.skinIndices.push( new THREE.Vector4( a, b, c, d ) ); @@ -11596,9 +11594,20 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) { } geometry.bones = json.bones; + + if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) { + + console.warn( 'When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' + + geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' ); + + } + + // could change this to json.animations[0] or remove completely + geometry.animation = json.animation; geometry.animations = json.animations; + }; function parseMorphing( scale ) { diff --git a/build/three.min.js b/build/three.min.js index 57a08090b6ed8b5cb00251f35fd3a0ae9292d610..e94efde3e70deefdbdb65dc88f45e564b7ef1689 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -229,10 +229,10 @@ b+'" ('+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseH THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,n,q,s,u,t,p,v,w,r=a.faces;n=a.vertices;var x=a.normals,A=a.colors,F=0;if(void 0!==a.uvs){for(d=0;dg;g++)s=r[k++],w=v[2*s],s=v[2*s+1],w=new THREE.Vector2(w,s),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*r[k++],u.normal.set(x[q++],x[q++],x[q]),p.normal.copy(u.normal));if(t)for(d=0;4>d;d++)q=3*r[k++],t=new THREE.Vector3(x[q++], x[q++],x[q]),2!==d&&u.vertexNormals.push(t),0!==d&&p.vertexNormals.push(t);n&&(n=r[k++],n=A[n],u.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=r[k++],n=A[n],2!==d&&u.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(u);c.faces.push(p)}else{u=new THREE.Face3;u.a=r[k++];u.b=r[k++];u.c=r[k++];h&&(h=r[k++],u.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)s=r[k++],w=v[2*s],s=v[2*s+1], -w=new THREE.Vector2(w,s),c.faceVertexUvs[d][h].push(w);q&&(q=3*r[k++],u.normal.set(x[q++],x[q++],x[q]));if(t)for(d=0;3>d;d++)q=3*r[k++],t=new THREE.Vector3(x[q++],x[q++],x[q]),u.vertexNormals.push(t);n&&(n=r[k++],u.color.setHex(A[n]));if(b)for(d=0;3>d;d++)n=r[k++],u.vertexColors.push(new THREE.Color(A[n]));c.faces.push(u)}})(d);(function(){var b,d,g,h;if(a.skinWeights)for(b=0,d=a.skinWeights.length;bd;d++)q=3*r[k++],t=new THREE.Vector3(x[q++],x[q++],x[q]),u.vertexNormals.push(t);n&&(n=r[k++],u.color.setHex(A[n]));if(b)for(d=0;3>d;d++)n=r[k++],u.vertexColors.push(new THREE.Color(A[n]));c.faces.push(u)}})(d);(function(){if(a.skinWeights)for(var b=0,d=a.skinWeights.length;b