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

Maya Collada expoter used "name" instead of "Name". Supporting both cases now.

上级 d7c99de5
......@@ -581,14 +581,14 @@ n[k],source=na[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.pa
D.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ka(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};F.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ka(b,"count",0);this.stride=ka(b,"stride",0);for(var c=
0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new N).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
"");this.set=ka(b,"set",-1);this.offset=ka(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};Q.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=la(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=ta(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=
aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=la(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new F).parse(e.childNodes[f]);break}}}return this};Q.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=this.data.slice(c,
c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new P).parse(b.childNodes[c]);break}return this};H.prototype.isColor=function(){return this.texture==
null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ta(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};M.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];
if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new H).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=Y.evaluate(".//dae:float",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};M.prototype.create=function(){var b={},c=this.transparency!==
void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=va[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=
f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ga;return this.material=new THREE.MeshLambertMaterial(b)};X.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};
C.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};O.prototype.create=
function(){if(this.shader==null)return null};O.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};O.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=la(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new F).parse(e.childNodes[f]);break}}}return this};Q.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=
this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new P).parse(b.childNodes[c]);break}return this};H.prototype.isColor=
function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=ta(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};M.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=
b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new H).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=Y.evaluate(".//dae:float",e,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};M.prototype.create=function(){var b=
{},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=va[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=
f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ga;return this.material=new THREE.MeshLambertMaterial(b)};X.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+
e.nodeName)}}return this};C.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};
O.prototype.create=function(){if(this.shader==null)return null};O.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};O.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
(new X(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new C(this)).parse(f);this.sampler.sid=c;break;case "extra":break;default:console.log(f.nodeName)}}};O.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};
O.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new M(e.nodeName,this)).parse(e)}}};P.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};U.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=
(new Q).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new V(this)).parse(e))}}return this};V.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=
......
......@@ -238,8 +238,8 @@ k[h],source=X[l.source],m=g[e+f*k.length+l.offset],numParams=source.accessor.par
y.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new C).parse(a.childNodes[c]));break;case "vcount":this.vcount=O(b.textContent);break;case "p":this.p=O(b.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=V(a,"stride",0);for(var c=
0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new C).parse(a.childNodes[c]),this.input[input.semantic]=input);return this};C.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=U(b.textContent).split(/\s+/),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=b.nodeName;break;case "float_array":this.data=S(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=
O(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new w).parse(b.childNodes[e]);break}}}return this};F.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=
this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[c]);break}return this};I.prototype.isColor=
O(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=U(b.textContent).split(/\s+/);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new w).parse(b.childNodes[e]);break}}}return this};F.prototype.read=function(){var a=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=
16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[c]);break}return this};I.prototype.isColor=
function(){return this.texture==null};I.prototype.isTexture=function(){return this.texture!=null};I.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=S(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),this.texcoord=b.getAttribute("texcoord")}}return this};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=
a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new I).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=Q.evaluate(".//dae:float",b,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a=
{},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=Y[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=
......
......@@ -2226,7 +2226,7 @@ THREE.ColladaLoader = function () {
switch ( param.type ) {
case 'IDREF':
case 'Name':
case 'Name': case 'name':
case 'float':
return this.data;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册