提交 6569f63f 编写于 作者: M Mr.doob

Updated builds.

上级 cb10b10f
......@@ -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 ) {
......
......@@ -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;d<a.uvs.length;d++)a.uvs[d].length&&F++;for(d=0;d<F;d++)c.faceVertexUvs[d]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=r.length;k<l;)if(b=r[k++],u=b&1,h=b&2,d=b&8,q=b&16,t=b&32,n=b&64,b&=128,u){u=new THREE.Face3;
u.a=r[k];u.b=r[k+1];u.c=r[k+3];p=new THREE.Face3;p.a=r[k+1];p.b=r[k+2];p.c=r[k+3];k+=4;h&&(h=r[k++],u.materialIndex=h,p.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;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;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;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;b<d;b+=2)g=a.skinWeights[b],h=a.skinWeights[b+1],c.skinWeights.push(new THREE.Vector4(g,h,0,0));if(a.skinIndices)for(b=
0,d=a.skinIndices.length;b<d;b+=2)g=a.skinIndices[b],h=a.skinIndices[b+1],c.skinIndices.push(new THREE.Vector4(g,h,0,0));c.bones=a.bones;c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,g,h,k,l,n;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],l=c.morphTargets[d].vertices,n=a.morphTargets[d].vertices,h=0,k=n.length;h<k;h+=3){var q=new THREE.Vector3;q.x=n[h]*
b;q.y=n[h+1]*b;q.z=n[h+2]*b;l.push(q)}}if(void 0!==a.morphColors)for(d=0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,l=a.morphColors[d].colors,b=0,h=l.length;b<h;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)})(d);c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&
c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
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(){if(a.skinWeights)for(var b=0,d=a.skinWeights.length;b<d;b+=2)c.skinWeights.push(new THREE.Vector4(a.skinWeights[b],a.skinWeights[b+1],0,0));if(a.skinIndices)for(b=
0,d=a.skinIndices.length;b<d;b+=2)c.skinIndices.push(new THREE.Vector4(a.skinIndices[b],a.skinIndices[b+1],0,0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.");c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,
g,h,k,l,n;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],l=c.morphTargets[d].vertices,n=a.morphTargets[d].vertices,h=0,k=n.length;h<k;h+=3){var q=new THREE.Vector3;q.x=n[h]*b;q.y=n[h+1]*b;q.z=n[h+2]*b;l.push(q)}}if(void 0!==a.morphColors)for(d=0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,l=a.morphColors[d].colors,
b=0,h=l.length;b<h;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)})(d);c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b,c,d){var e=this;c=new THREE.XHRLoader;c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){b(e.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d=a.offsets;a=a.boundingSphere;for(var e in c){var f=c[e];b.attributes[e]={itemSize:f.itemSize,array:new self[f.type](f.array)}}void 0!==d&&(b.offsets=JSON.parse(JSON.stringify(d)));
void 0!==a&&(b.boundingSphere=new THREE.Sphere((new THREE.Vector3).fromArray(void 0!==a.center?a.center:[0,0,0]),a.radius));return b}};THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b,c,d){var e=this;c=new THREE.XHRLoader;c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){b(e.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b,c,d){var e=this;c=new THREE.XHRLoader;c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){b(e.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册