text: THREE.ColladaLoader=function(){function T(e,t,n){var i=0;if(document.implementation&&document.implementation.createDocument){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(s.readyState==4){if(s.status==0||s.status==200){if(s.responseXML){r=t;N(s.responseXML,undefined,e)}else if(s.responseText){r=t;var o=new DOMParser;var u=o.parseFromString(s.responseText,"application/xml");N(u,undefined,e)}else{console.error("ColladaLoader: Empty or non-existing file ("+e+")")}}}else if(s.readyState==3){if(n){if(i==0){i=s.getResponseHeader("Content-Length")}n({total:i,loaded:s.responseText.length})}}};s.open("GET",e,true);s.send(null)}else{alert("Don't know how to parse XML!")}}function N(i,y,b){e=i;y=y||r;if(b!==undefined){var w=b.split("/");w.pop();v=(w.length<1?".":w.join("/"))+"/"}k();zt();s=L("//dae:library_images/dae:image",Q,"image");f=L("//dae:library_materials/dae:material",vt,"material");l=L("//dae:library_effects/dae:effect",wt,"effect");a=L("//dae:library_geometries/dae:geometry",ot,"geometry");c=L(".//dae:library_cameras/dae:camera",Ct,"camera");h=L(".//dae:library_lights/dae:light",Lt,"light");u=L("//dae:library_controllers/dae:controller",G,"controller");o=L("//dae:library_animations/dae:animation",St,"animation");d=L(".//dae:library_visual_scenes/dae:visual_scene",et,"visual_scene");m=[];g=[];n=A();t=new THREE.Object3D;for(var S=0;S<n.nodes.length;S++){t.add(F(n.nodes[S]))}t.scale.multiplyScalar(E);O();var x={scene:t,morphs:m,skins:g,animations:p,dae:{images:s,materials:f,cameras:c,lights:h,effects:l,geometries:a,controllers:u,animations:o,visualScenes:d,scene:n}};if(y){y(x)}return x}function C(e){b=e}function k(){var t=e.evaluate("//dae:asset",e,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var n=t.iterateNext();if(n&&n.childNodes){for(var r=0;r<n.childNodes.length;r++){var i=n.childNodes[r];switch(i.nodeName){case"unit":var s=i.getAttribute("meter");if(s){E=parseFloat(s)}break;case"up_axis":S=i.textContent.charAt(0);break}}}}function L(t,n,r){var i=e.evaluate(t,e,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var s={};var o=i.iterateNext();var u=0;while(o){var a=(new n).parse(o);if(!a.id||a.id.length==0)a.id=r+u++;s[a.id]=a;o=i.iterateNext()}return s}function A(){var t=e.evaluate(".//dae:scene/dae:instance_visual_scene",e,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext();if(t){var n=t.getAttribute("url").replace(/^#/,"");return d[n.length>0?n:"visual_scene0"]}else{return null}}function O(){p=[];M(t)}function M(e){var t=n.getChildById(e.name,true),r=null;if(t&&t.keys){r={fps:60,hierarchy:[{node:t,keys:t.keys,sids:t.sids}],node:e,name:"animation_"+e.name,length:0};p.push(r);for(var i=0,s=t.keys.length;i<s;i++){r.length=Math.max(r.length,t.keys[i].time)}}else{r={hierarchy:[{keys:[],sids:[]}]}}for(var i=0,s=e.children.length;i<s;i++){var o=M(e.children[i]);for(var u=0,a=o.hierarchy.length;u<a;u++){r.hierarchy.push({keys:[],sids:[]})}}return r}function _(){var e=1e6;var t=-e;var n=0;for(var r in o){var i=o[r];for(var s=0;s<i.sampler.length;s++){var u=i.sampler[s];u.create();e=Math.min(e,u.startTime);t=Math.max(t,u.endTime);n=Math.max(n,u.input.length)}}return{start:e,end:t,frames:n}}function D(e,t){var n=t instanceof rt?u[t.url]:t;if(!n||!n.morph){console.log("could not find morph controller!");return}var r=n.morph;for(var i=0;i<r.targets.length;i++){var s=r.targets[i];var o=a[s];if(!o.mesh||!o.mesh.primitives||!o.mesh.primitives.length){continue}var f=o.mesh.primitives[0].geometry;if(f.vertices.length===e.vertices.length){e.morphTargets.push({name:"target_1",vertices:f.vertices})}}e.morphTargets.push({name:"target_Z",vertices:e.vertices})}function P(e,t,r){var i=u[t.url];if(!i||!i.skin){console.log("could not find skin controller!");return}if(!t.skeleton||!t.skeleton.length){console.log("could not find the skeleton for the skin!");return}var s=i.skin;var o=n.getChildById(t.skeleton[0]);var a=[];r=r!==undefined?r:true;var f=[];e.skinWeights=[];e.skinIndices=[];if(r){for(var l=0;l<e.vertices.length;l++){e.vertices[l].applyMatrix4(s.bindShapeMatrix)}}}function H(e,t,n,r){e.world=e.world||new THREE.Matrix4;e.world.copy(e.matrix);if(e.channels&&e.channels.length){var i=e.channels[0];var s=i.sampler.output[n];if(s instanceof THREE.Matrix4){e.world.copy(s)}}if(r){e.world.multiplyMatrices(r,e.world)}t.push(e);for(var o=0;o<e.nodes.length;o++){H(e.nodes[o],t,n,e.world)}}function B(e,t){for(var n=0;n<e.length;n++){var r=e[n];var i=-1;if(r.type!="JOINT")continue;for(var s=0;s<t.joints.length;s++){if(r.sid==t.joints[s]){i=s;break}}if(i>=0){var o=t.invBindMatrices[i];r.invBindMatrix=o;r.skinningMatrix=new THREE.Matrix4;r.skinningMatrix.multiplyMatrices(r.world,o);r.weights=[];for(var s=0;s<t.weights.length;s++){for(var u=0;u<t.weights[s].length;u++){var a=t.weights[s][u];if(a.joint==i){r.weights.push(a)}}}}else{throw"ColladaLoader: Could not find joint '"+r.sid+"'."}}}function j(e,t,r){var i=u[t.url];r=r!==undefined?r:40;if(!i||!i.skin){console.log("ColladaLoader: Could not find skin controller.");return}if(!t.skeleton||!t.skeleton.length){console.log("ColladaLoader: Could not find the skeleton for the skin. ");return}var s=_();var o=n.getChildById(t.skeleton[0],true)||n.getChildBySid(t.skeleton[0],true);var a,f,l,c,h;var p=new THREE.Vector3,d,v;for(a=0;a<e.vertices.length;a++){e.vertices[a].applyMatrix4(i.skin.bindShapeMatrix)}for(r=0;r<s.frames;r++){var m=[];var g=[];for(a=0;a<e.vertices.length;a++){g.push(new THREE.Vector3)}H(o,m,r);B(m,i.skin);for(a=0;a<m.length;a++){if(m[a].type!="JOINT")continue;for(f=0;f<m[a].weights.length;f++){l=m[a].weights[f];c=l.index;h=l.weight;d=e.vertices[c];v=g[c];p.x=d.x;p.y=d.y;p.z=d.z;p.applyMatrix4(m[a].skinningMatrix);v.x+=p.x*h;v.y+=p.y*h;v.z+=p.z*h}}e.morphTargets.push({name:"target_"+r,vertices:g})}}function F(e,t){var n=new THREE.Object3D;var r=false;var i;var s;var o,p;for(o=0;o<e.controllers.length;o++){var d=u[e.controllers[o].url];switch(d.type){case"skin":if(a[d.skin.source]){var v=new st;v.url=d.skin.source;v.instance_material=e.controllers[o].instance_material;e.geometries.push(v);r=true;i=e.controllers[o]}else if(u[d.skin.source]){var y=u[d.skin.source];s=y;if(y.morph&&a[y.morph.source]){var v=new st;v.url=y.morph.source;v.instance_material=e.controllers[o].instance_material;e.geometries.push(v)}}break;case"morph":if(a[d.morph.source]){var v=new st;v.url=d.morph.source;v.instance_material=e.controllers[o].instance_material;e.geometries.push(v);s=e.controllers[o]}console.log("ColladaLoader: Morph-controller partially supported.");default:break}}var b={};for(o=0;o<e.geometries.length;o++){var E=e.geometries[o];var S=E.instance_material;var x=a[E.url];var T={};var N=[];var C=0;var k;if(x){if(!x.mesh||!x.mesh.primitives)continue;if(n.name.length==0){n.name=x.id}if(S){for(p=0;p<S.length;p++){var L=S[p];var A=f[L.target];var O=A.instance_effect.url;var M=l[O].shader;var _=M.material;if(x.doubleSided){if(!(L.symbol in b)){var P=_.clone();P.side=THREE.DoubleSide;b[L.symbol]=P}_=b[L.symbol]}_.opacity=!_.opacity?1:_.opacity;T[L.symbol]=C;N.push(_);k=_;k.name=A.name==null||A.name===""?A.id:A.name;C++}}var H;var B=k||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading,side:x.doubleSided?THREE.DoubleSide:THREE.FrontSide});var I=x.mesh.geometry3js;if(C>1){B=new THREE.MeshFaceMaterial(N);for(p=0;p<I.faces.length;p++){var q=I.faces[p];q.materialIndex=T[q.daeMaterial]}}if(i!==undefined){j(I,i);B.morphTargets=true;H=new THREE.SkinnedMesh(I,B,false);H.skeleton=i.skeleton;H.skinController=u[i.url];H.skinInstanceController=i;H.name="skin_"+g.length;g.push(H)}else if(s!==undefined){D(I,s);B.morphTargets=true;H=new THREE.Mesh(I,B);H.name="morph_"+m.length;m.push(H)}else{H=new THREE.Mesh(I,B)}e.geometries.length>1?n.add(H):n=H}}for(o=0;o<e.cameras.length;o++){var R=e.cameras[o];var U=c[R.url];n=new THREE.PerspectiveCamera(U.fov,parseFloat(U.aspect_ratio),parseFloat(U.znear),parseFloat(U.zfar))}for(o=0;o<e.lights.length;o++){var z=e.lights[o];var W=h[z.url];if(W&&W.technique){var X=W.color.getHex();var V=W.intensity;var $=0;var J=W.falloff_angle;var K;switch(W.technique){case"directional":n=new THREE.DirectionalLight(X,V,$);break;case"point":n=new THREE.PointLight(X,V,$);break;case"spot":n=new THREE.SpotLight(X,V,$,J,K);break;case"ambient":n=new THREE.AmbientLight(X);break}}}n.name=e.name||e.id||"";n.matrix=e.matrix;n.matrix.decompose(n.position,n.quaternion,n.scale);if(w.centerGeometry&&n.geometry){var Q=THREE.GeometryUtils.center(n.geometry);Q.multiply(n.scale);Q.applyQuaternion(n.quaternion);n.position.sub(Q)}for(o=0;o<e.nodes.length;o++){n.add(F(e.nodes[o],e))}return n}function I(e,t){for(var n=0;n<e.joints.length;n++){if(e.joints[n]==t){return n}}}function q(t){return e.evaluate(".//dae:library_nodes//dae:node[@id='"+t+"']",e,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext()}function R(e){var t=[];var n=1e6;var r=-1e6;for(var i in o){var s=o[i];for(var u=0;u<s.channel.length;u++){var a=s.channel[u];var f=s.sampler[u];var i=a.target.split("/")[0];if(i==e.id){f.create();a.sampler=f;n=Math.min(n,f.startTime);r=Math.max(r,f.endTime);t.push(a)}}}if(t.length){e.startTime=n;e.endTime=r}return t}function U(e){var t=1e7;for(var n=0;n<e.channels.length;n++){var r=e.channels[n].sampler;for(var i=0;i<r.input.length-1;i++){var s=r.input[i];var o=r.input[i+1];t=Math.min(t,o-s)}}return t}function z(e,t){var n={};var r,i;for(r=0;r<e.channels.length;r++){var s=e.channels[r];n[s.sid]=s}var o=new THREE.Matrix4;for(r=0;r<e.transforms.length;r++){var u=e.transforms[r];var s=n[u.sid];if(s!==undefined){var a=s.sampler;var f;for(i=0;i<a.input.length-1;i++){if(a.input[i+1]>t){f=a.output[i];break}}if(f!==undefined){if(f instanceof THREE.Matrix4){o.multiplyMatrices(o,f)}else{o.multiplyMatrices(o,u.matrix)}}else{o.multiplyMatrices(o,u.matrix)}}else{o.multiplyMatrices(o,u.matrix)}}return o}function W(e){if(e.channels&&e.channels.length){var t=[],n=[];for(var r=0,i=e.channels.length;r<i;r++){var s=e.channels[r],o=s.fullSid,u=s.sampler,a=u.input,f=e.getTransformBySid(s.sid),l;if(s.arrIndices){l=[];for(var c=0,h=s.arrIndices.length;c<h;c++){l[c]=$t(s.arrIndices[c])}}else{l=Jt(s.member)}if(f){if(n.indexOf(o)===-1){n.push(o)}for(var c=0,h=a.length;c<h;c++){var p=a[c],d=u.getData(f.type,c),v=X(t,p);if(!v){v=new Nt(p);var m=V(t,p);t.splice(m==-1?t.length:m,0,v)}v.addTarget(o,f,l,d)}}else{console.log('Could not find transform "'+s.sid+'" in node '+e.id)}}for(var r=0;r<n.length;r++){var g=n[r];for(var c=0;c<t.length;c++){var v=t[c];if(!v.hasTarget(g)){$(t,v,c,g)}}}e.keys=t;e.sids=n}}function X(e,t){var n=null;for(var r=0,i=e.length;r<i&&n==null;r++){var s=e[r];if(s.time===t){n=s}else if(s.time>t){break}}return n}function V(e,t){var n=-1;for(var r=0,i=e.length;r<i&&n==-1;r++){var s=e[r];if(s.time>=t){n=r}}return n}function $(e,t,n,r){var i=K(e,r,n?n-1:0),s=J(e,r,n+1);if(i&&s){var o=(t.time-i.time)/(s.time-i.time),u=i.getTarget(r),a=s.getTarget(r).data,f=u.data,l;if(u.type==="matrix"){l=f}else if(f.length){l=[];for(var c=0;c<f.length;++c){l[c]=f[c]+(a[c]-f[c])*o}}else{l=f+(a-f)*o}t.addTarget(r,u.transform,u.member,l)}}function J(e,t,n){for(;n<e.length;n++){var r=e[n];if(r.hasTarget(t)){return r}}return null}function K(e,t,n){n=n>=0?n:n+e.length;for(;n>=0;n--){var r=e[n];if(r.hasTarget(t)){return r}}return null}function Q(){this.id="";this.init_from=""}function G(){this.id="";this.name="";this.type="";this.skin=null;this.morph=null}function Y(){this.method=null;this.source=null;this.targets=null;this.weights=null}function Z(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function et(){this.id="";this.name="";this.nodes=[];this.scene=new THREE.Object3D}function tt(){this.id="";this.name="";this.sid="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function nt(){this.sid="";this.type="";this.data=[];this.obj=null}function rt(){this.url="";this.skeleton=[];this.instance_material=[]}function it(){this.symbol="";this.target=""}function st(){this.url="";this.instance_material=[]}function ot(){this.id="";this.mesh=null}function ut(e){this.geometry=e.id;this.primitives=[];this.vertices=null;this.geometry3js=null}function at(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function ft(){at.call(this);this.vcount=[]}function lt(){at.call(this);this.vcount=3}function ct(){this.source="";this.count=0;this.stride=0;this.params=[]}function ht(){this.input={}}function pt(){this.semantic="";this.offset=0;this.source="";this.set=0}function dt(e){this.id=e;this.type=null}function vt(){this.id="";this.name="";this.instance_effect=null}function mt(){this.color=new THREE.Color;this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texture=null;this.texcoord=null;this.texOpts=null}function gt(e,t){this.type=e;this.effect=t;this.material=null}function yt(e){this.effect=e;this.init_from=null;this.format=null}function bt(e){this.effect=e;this.source=null;this.wrap_s=null;this.wrap_t=null;this.minfilter=null;this.magfilter=null;this.mipfilter=null}function wt(){this.id="";this.name="";this.shader=null;this.surface={};this.sampler={}}function Et(){this.url=""}function St(){this.id="";this.name="";this.source={};this.sampler=[];this.channel=[]}function xt(e){this.animation=e;this.source="";this.target="";this.fullSid=null;this.sid=null;this.dotSyntax=null;this.arrSyntax=null;this.arrIndices=null;this.member=null}function Tt(e){this.id="";this.animation=e;this.inputs=[];this.input=null;this.output=null;this.strideOut=null;this.interpolation=null;this.startTime=null;this.endTime=null;this.duration=0}function Nt(e){this.targets=[];this.time=e}function Ct(){this.id="";this.name="";this.technique=""}function kt(){this.url=""}function Lt(){this.id="";this.name="";this.technique=""}function At(){this.url=""}function Ot(e){var t=e.getAttribute("id");if(i[t]!=undefined){return i[t]}i[t]=(new dt(t)).parse(e);return i[t]}function Mt(e){if(e=="dae"){return"http://www.collada.org/2005/11/COLLADASchema"}return null}function _t(e){var t=Ht(e);var n=[];for(var r=0,i=t.length;r<i;r++){n.push(t[r]=="true"||t[r]=="1"?true:false)}return n}function Dt(e){var t=Ht(e);var n=[];for(var r=0,i=t.length;r<i;r++){n.push(parseFloat(t[r]))}return n}function Pt(e){var t=Ht(e);var n=[];for(var r=0,i=t.length;r<i;r++){n.push(parseInt(t[r],10))}return n}function Ht(e){return e.length>0?Bt(e).split(/\s+/):[]}function Bt(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function jt(e,t,n){if(e.hasAttribute(t)){return parseFloat(e.getAttribute(t))}else{return n}}function Ft(e,t,n){if(e.hasAttribute(t)){return parseInt(e.getAttribute(t),10)}else{return n}}function It(e,t,n){if(e.hasAttribute(t)){return e.getAttribute(t)}else{return n}}function qt(e,t){if(e===undefined){var n="0.";while(n.length<t+2){n+="0"}return n}t=t||2;var r=e.toString().split(".");r[1]=r.length>1?r[1].substr(0,t):"0";while(r[1].length<t){r[1]+="0"}return r.join(".")}function Rt(t,n){var r=e.evaluate(n,t,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var i=r.iterateNext();var s=[];while(i){s.push(i);i=r.iterateNext()}return s}function Ut(t,n){t.doubleSided=false;var r=e.evaluate(".//dae:extra//dae:double_sided",n,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);if(r){r=r.iterateNext();if(r&&parseInt(r.textContent,10)===1){t.doubleSided=true}}}function zt(){if(!w.convertUpAxis||S===w.upAxis){x=null}else{switch(S){case"X":x=w.upAxis==="Y"?"XtoY":"XtoZ";break;case"Y":x=w.upAxis==="X"?"YtoX":"YtoZ";break;case"Z":x=w.upAxis==="X"?"ZtoX":"ZtoY";break}}}function Wt(e,t){if(!w.convertUpAxis||S===w.upAxis){return}switch(x){case"XtoY":var n=e[0];e[0]=t*e[1];e[1]=n;break;case"XtoZ":var n=e[2];e[2]=e[1];e[1]=e[0];e[0]=n;break;case"YtoX":var n=e[0];e[0]=e[1];e[1]=t*n;break;case"YtoZ":var n=e[1];e[1]=t*e[2];e[2]=n;break;case"ZtoX":var n=e[0];e[0]=e[1];e[1]=e[2];e[2]=n;break;case"ZtoY":var n=e[1];e[1]=e[2];e[2]=t*n;break}}function Xt(e,t){var n=[e[t],e[t+1],e[t+2]];Wt(n,-1);return new THREE.Vector3(n[0],n[1],n[2])}function Vt(e){if(w.convertUpAxis){var t=[e[0],e[4],e[8]];Wt(t,-1);e[0]=t[0];e[4]=t[1];e[8]=t[2];t=[e[1],e[5],e[9]];Wt(t,-1);e[1]=t[0];e[5]=t[1];e[9]=t[2];t=[e[2],e[6],e[10]];Wt(t,-1);e[2]=t[0];e[6]=t[1];e[10]=t[2];t=[e[0],e[1],e[2]];Wt(t,-1);e[0]=t[0];e[1]=t[1];e[2]=t[2];t=[e[4],e[5],e[6]];Wt(t,-1);e[4]=t[0];e[5]=t[1];e[6]=t[2];t=[e[8],e[9],e[10]];Wt(t,-1);e[8]=t[0];e[9]=t[1];e[10]=t[2];t=[e[3],e[7],e[11]];Wt(t,-1);e[3]=t[0];e[7]=t[1];e[11]=t[2]}return new THREE.Matrix4(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])}function $t(e){if(e>-1&&e<3){var t=["X","Y","Z"],n={X:0,Y:1,Z:2};e=Jt(t[e]);e=n[e]}return e}function Jt(e){if(w.convertUpAxis){switch(e){case"X":switch(x){case"XtoY":case"XtoZ":case"YtoX":e="Y";break;case"ZtoX":e="Z";break}break;case"Y":switch(x){case"XtoY":case"YtoX":case"ZtoX":e="X";break;case"XtoZ":case"YtoZ":case"ZtoY":e="Z";break}break;case"Z":switch(x){case"XtoZ":e="X";break;case"YtoZ":case"ZtoX":case"ZtoY":e="Y";break}break}}return e}var e=null;var t=null;var n;var r=null;var i={};var s={};var o={};var u={};var a={};var f={};var l={};var c={};var h={};var p;var d;var v;var m;var g;var y=true;var b=THREE.SmoothShading;var w={centerGeometry:false,convertUpAxis:false,subdivideFaces:true,upAxis:"Y",defaultEnvMap:null};var E=1;var S="Y";var x=null;Q.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeName=="init_from"){this.init_from=n.textContent}}return this};G.prototype.parse=function(e){this.id=e.getAttribute("id");this.name=e.getAttribute("name");this.type="none";for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];switch(n.nodeName){case"skin":this.skin=(new Z).parse(n);this.type=n.nodeName;break;case"morph":this.morph=(new Y).parse(n);this.type=n.nodeName;break;default:break}}return this};Y.prototype.parse=function(e){var t={};var n=[];var r;this.method=e.getAttribute("method");this.source=e.getAttribute("source").replace(/^#/,"");for(r=0;r<e.childNodes.length;r++){var i=e.childNodes[r];if(i.nodeType!=1)continue;switch(i.nodeName){case"source":var s=(new dt).parse(i);t[s.id]=s;break;case"targets":n=this.parseInputs(i);break;default:console.log(i.nodeName);break}}for(r=0;r<n.length;r++){var o=n[r];var s=t[o.source];switch(o.semantic){case"MORPH_TARGET":this.targets=s.read();break;case"MORPH_WEIGHT":this.weights=s.read();break;default:break}}return this};Y.prototype.parseInputs=function(e){var t=[];for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(r.nodeType!=1)continue;switch(r.nodeName){case"input":t.push((new pt).parse(r));break;default:break}}return t};Z.prototype.parse=function(e){var t={};var n,r;this.source=e.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(s.nodeType!=1)continue;switch(s.nodeName){case"bind_shape_matrix":var o=Dt(s.textContent);this.bindShapeMatrix=Vt(o);break;case"source":var u=(new dt).parse(s);t[u.id]=u;break;case"joints":n=s;break;case"vertex_weights":r=s;break;default:console.log(s.nodeName);break}}this.parseJoints(n,t);this.parseWeights(r,t);return this};Z.prototype.parseJoints=function(e,t){for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(r.nodeType!=1)continue;switch(r.nodeName){case"input":var i=(new pt).parse(r);var s=t[i.source];if(i.semantic=="JOINT"){this.joints=s.read()}else if(i.semantic=="INV_BIND_MATRIX"){this.invBindMatrices=s.read()}break;default:break}}};Z.prototype.parseWeights=function(e,t){var n,r,i=[];for(var s=0;s<e.childNodes.length;s++){var o=e.childNodes[s];if(o.nodeType!=1)continue;switch(o.nodeName){case"input":i.push((new pt).parse(o));break;case"v":n=Pt(o.textContent);break;case"vcount":r=Pt(o.textContent);break;default:break}}var u=0;for(var s=0;s<r.length;s++){var a=r[s];var f=[];for(var l=0;l<a;l++){var c={};for(var h=0;h<i.length;h++){var p=i[h];var d=n[u+p.offset];switch(p.semantic){case"JOINT":c.joint=d;break;case"WEIGHT":c.weight=t[p.source].data[d];break;default:break}}f.push(c);u+=i.length}for(var l=0;l<f.length;l++){f[l].index=s}this.weights.push(f)}};et.prototype.getChildById=function(e,t){for(var n=0;n<this.nodes.length;n++){var r=this.nodes[n].getChildById(e,t);if(r){return r}}return null};et.prototype.getChildBySid=function(e,t){for(var n=0;n<this.nodes.length;n++){var r=this.nodes[n].getChildBySid(e,t);if(r){return r}}return null};et.prototype.parse=function(e){this.id=e.getAttribute("id");this.name=e.getAttribute("name");this.nodes=[];for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"node":this.nodes.push((new tt).parse(n));break;default:break}}return this};tt.prototype.getChannelForTransform=function(e){for(var t=0;t<this.channels.length;t++){var n=this.channels[t];var r=n.target.split("/");var i=r.shift();var s=r.shift();var o=s.indexOf(".")>=0;var u=s.indexOf("(")>=0;var a;var f;if(o){r=s.split(".");s=r.shift();f=r.shift()}else if(u){a=s.split("(");s=a.shift();for(var l=0;l<a.length;l++){a[l]=parseInt(a[l].replace(/\)/,""))}}if(s==e){n.info={sid:s,dotSyntax:o,arrSyntax:u,arrIndices:a};return n}}return null};tt.prototype.getChildById=function(e,t){if(this.id==e){return this}if(t){for(var n=0;n<this.nodes.length;n++){var r=this.nodes[n].getChildById(e,t);if(r){return r}}}return null};tt.prototype.getChildBySid=function(e,t){if(this.sid==e){return this}if(t){for(var n=0;n<this.nodes.length;n++){var r=this.nodes[n].getChildBySid(e,t);if(r){return r}}}return null};tt.prototype.getTransformBySid=function(e){for(var t=0;t<this.transforms.length;t++){if(this.transforms[t].sid==e)return this.transforms[t]}return null};tt.prototype.parse=function(e){var t;this.id=e.getAttribute("id");this.sid=e.getAttribute("sid");this.name=e.getAttribute("name");this.type=e.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.lights=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(r.nodeType!=1)continue;switch(r.nodeName){case"node":this.nodes.push((new tt).parse(r));break;case"instance_camera":this.cameras.push((new kt).parse(r));break;case"instance_controller":this.controllers.push((new rt).parse(r));break;case"instance_geometry":this.geometries.push((new st).parse(r));break;case"instance_light":this.lights.push((new At).parse(r));break;case"instance_node":t=r.getAttribute("url").replace(/^#/,"");var i=q(t);if(i){this.nodes.push((new tt).parse(i))}break;case"rotate":case"translate":case"scale":case"matrix":case"lookat":case"skew":this.transforms.push((new nt).parse(r));break;case"extra":break;default:console.log(r.nodeName);break}}this.channels=R(this);W(this);this.updateMatrix();return this};tt.prototype.updateMatrix=function(){this.matrix.identity();for(var e=0;e<this.transforms.length;e++){this.transforms[e].apply(this.matrix)}};nt.prototype.parse=function(e){this.sid=e.getAttribute("sid");this.type=e.nodeName;this.data=Dt(e.textContent);this.convert();return this};nt.prototype.convert=function(){switch(this.type){case"matrix":this.obj=Vt(this.data);break;case"rotate":this.angle=THREE.Math.degToRad(this.data[3]);case"translate":Wt(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case"scale":Wt(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type);break}};nt.prototype.apply=function(){var e=new THREE.Matrix4;return function(t){switch(this.type){case"matrix":t.multiply(this.obj);break;case"translate":t.multiply(e.makeTranslation(this.obj.x,this.obj.y,this.obj.z));break;case"rotate":t.multiply(e.makeRotationAxis(this.obj,this.angle));break;case"scale":t.scale(this.obj);break}}}();nt.prototype.update=function(e,t){var n=["X","Y","Z","ANGLE"];switch(this.type){case"matrix":if(!t){this.obj.copy(e)}else if(t.length===1){switch(t[0]){case 0:this.obj.n11=e[0];this.obj.n21=e[1];this.obj.n31=e[2];this.obj.n41=e[3];break;case 1:this.obj.n12=e[0];this.obj.n22=e[1];this.obj.n32=e[2];this.obj.n42=e[3];break;case 2:this.obj.n13=e[0];this.obj.n23=e[1];this.obj.n33=e[2];this.obj.n43=e[3];break;case 3:this.obj.n14=e[0];this.obj.n24=e[1];this.obj.n34=e[2];this.obj.n44=e[3];break}}else if(t.length===2){var r="n"+(t[0]+1)+(t[1]+1);this.obj[r]=e}else{console.log("Incorrect addressing of matrix in transform.")}break;case"translate":case"scale":if(Object.prototype.toString.call(t)==="[object Array]"){t=n[t[0]]}switch(t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;default:this.obj.x=e[0];this.obj.y=e[1];this.obj.z=e[2];break}break;case"rotate":if(Object.prototype.toString.call(t)==="[object Array]"){t=n[t[0]]}switch(t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;case"ANGLE":this.angle=THREE.Math.degToRad(e);break;default:this.obj.x=e[0];this.obj.y=e[1];this.obj.z=e[2];this.angle=THREE.Math.degToRad(e[3]);break}break}};rt.prototype.parse=function(t){this.url=t.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var n=0;n<t.childNodes.length;n++){var r=t.childNodes[n];if(r.nodeType!==1)continue;switch(r.nodeName){case"skeleton":this.skeleton.push(r.textContent.replace(/^#/,""));break;case"bind_material":var i=e.evaluate(".//dae:instance_material",r,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);if(i){var s=i.iterateNext();while(s){this.instance_material.push((new it).parse(s));s=i.iterateNext()}}break;case"extra":break;default:break}}return this};it.prototype.parse=function(e){this.symbol=e.getAttribute("symbol");this.target=e.getAttribute("target").replace(/^#/,"");return this};st.prototype.parse=function(t){this.url=t.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var n=0;n<t.childNodes.length;n++){var r=t.childNodes[n];if(r.nodeType!=1)continue;if(r.nodeName=="bind_material"){var i=e.evaluate(".//dae:instance_material",r,Mt,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);if(i){var s=i.iterateNext();while(s){this.instance_material.push((new it).parse(s));s=i.iterateNext()}}break}}return this};ot.prototype.parse=function(e){this.id=e.getAttribute("id");Ut(this,e);for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];switch(n.nodeName){case"mesh":this.mesh=(new ut(this)).parse(n);break;case"extra":break;default:break}}return this};ut.prototype.parse=function(e){this.primitives=[];var t,n;for(t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"source":Ot(r);break;case"vertices":this.vertices=(new ht).parse(r);break;case"triangles":this.primitives.push((new lt).parse(r));break;case"polygons":this.primitives.push((new at).parse(r));break;case"polylist":this.primitives.push((new ft).parse(r));break;default:break}}this.geometry3js=new THREE.Geometry;var s=i[this.vertices.input["POSITION"].source].data;for(t=0;t<s.length;t+=3){this.geometry3js.vertices.push(Xt(s,t).clone())}for(t=0;t<this.primitives.length;t++){var o=this.primitives[t];o.setVertices(this.vertices);this.handlePrimitive(o,this.geometry3js)}this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();if(this.geometry3js.calcNormals){this.geometry3js.computeVertexNormals();delete this.geometry3js.calcNormals}return this};ut.prototype.handlePrimitive=function(e,t){var n,r,s=e.p,o=e.inputs;var u,a,f;var l,c;var h=0,p=3,d=0;var v=[];for(n=0;n<o.length;n++){u=o[n];var m=u.offset+1;d=d<m?m:d;switch(u.semantic){case"TEXCOORD":v.push(u.set);break}}for(var g=0;g<s.length;++g){var y=s[g],b=0;while(b<y.length){var E=[];var S=[];var x=null;var T=[];if(e.vcount){p=e.vcount.length?e.vcount[h++]:e.vcount}else{p=y.length/d}for(n=0;n<p;n++){for(r=0;r<o.length;r++){u=o[r];l=i[u.source];a=y[b+n*d+u.offset];c=l.accessor.params.length;f=a*c;switch(u.semantic){case"VERTEX":E.push(a);break;case"NORMAL":S.push(Xt(l.data,f));break;case"TEXCOORD":x=x||{};if(x[u.set]===undefined)x[u.set]=[];x[u.set].push(new THREE.Vector2(l.data[f],l.data[f+1]));break;case"COLOR":T.push((new THREE.Color).setRGB(l.data[f],l.data[f+1],l.data[f+2]));break;default:break}}}if(S.length==0){u=this.vertices.input.NORMAL;if(u){l=i[u.source];c=l.accessor.params.length;for(var N=0,C=E.length;N<C;N++){S.push(Xt(l.data,E[N]*c))}}else{t.calcNormals=true}}if(!x){x={};u=this.vertices.input.TEXCOORD;if(u){v.push(u.set);l=i[u.source];c=l.accessor.params.length;for(var N=0,C=E.length;N<C;N++){f=E[N]*c;if(x[u.set]===undefined)x[u.set]=[];x[u.set].push(new THREE.Vector2(l.data[f],1-l.data[f+1]))}}}if(T.length==0){u=this.vertices.input.COLOR;if(u){l=i[u.source];c=l.accessor.params.length;for(var N=0,C=E.length;N<C;N++){f=E[N]*c;T.push((new THREE.Color).setRGB(l.data[f],l.data[f+1],l.data[f+2]))}}}var k=null,L=[],A,O;if(p===3){L.push(new THREE.Face3(E[0],E[1],E[2],S,T.length?T:new THREE.Color))}else if(p===4){L.push(new THREE.Face3(E[0],E[1],E[3],[S[0],S[1],S[3]],T.length?[T[0],T[1],T[3]]:new THREE.Color));L.push(new THREE.Face3(E[1],E[2],E[3],[S[1],S[2],S[3]],T.length?[T[1],T[2],T[3]]:new THREE.Color))}else if(p>4&&w.subdivideFaces){var M=T.length?T:new THREE.Color,_,D,P,H,B,j;for(r=1;r<p-1;){L.push(new THREE.Face3(E[0],E[r],E[r+1],[S[0],S[r++],S[r]],M))}}if(L.length){for(var N=0,C=L.length;N<C;N++){k=L[N];k.daeMaterial=e.material;t.faces.push(k);for(r=0;r<v.length;r++){A=x[v[r]];if(p>4){O=[A[0],A[N+1],A[N+2]]}else if(p===4){if(N===0){O=[A[0],A[1],A[3]]}else{O=[A[1].clone(),A[2],A[3].clone()]}}else{O=[A[0],A[1],A[2]]}if(t.faceVertexUvs[r]===undefined){t.faceVertexUvs[r]=[]}t.faceVertexUvs[r].push(O)}}}else{console.log("dropped face with vcount "+p+" for geometry with id: "+t.id)}b+=d*p}}};at.prototype.setVertices=function(e){for(var t=0;t<this.inputs.length;t++){if(this.inputs[t].source==e.id){this.inputs[t].source=e.input["POSITION"].source}}};at.prototype.parse=function(e){this.material=e.getAttribute("material");this.count=Ft(e,"count",0);for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];switch(n.nodeName){case"input":this.inputs.push((new pt).parse(e.childNodes[t]));break;case"vcount":this.vcount=Pt(n.textContent);break;case"p":this.p.push(Pt(n.textContent));break;case"ph":console.warn("polygon holes not yet supported!");break;default:break}}return this};ft.prototype=Object.create(at.prototype);lt.prototype=Object.create(at.prototype);ct.prototype.parse=function(e){this.params=[];this.source=e.getAttribute("source");this.count=Ft(e,"count",0);this.stride=Ft(e,"stride",0);for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeName=="param"){var r={};r["name"]=n.getAttribute("name");r["type"]=n.getAttribute("type");this.params.push(r)}}return this};ht.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){if(e.childNodes[t].nodeName=="input"){var n=(new pt).parse(e.childNodes[t]);this.input[n.semantic]=n}}return this};pt.prototype.parse=function(e){this.semantic=e.getAttribute("semantic");this.source=e.getAttribute("source").replace(/^#/,"");this.set=Ft(e,"set",-1);this.offset=Ft(e,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0){this.set=0}return this};dt.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];switch(n.nodeName){case"bool_array":this.data=_t(n.textContent);this.type=n.nodeName;break;case"float_array":this.data=Dt(n.textContent);this.type=n.nodeName;break;case"int_array":this.data=Pt(n.textContent);this.type=n.nodeName;break;case"IDREF_array":case"Name_array":this.data=Ht(n.textContent);this.type=n.nodeName;break;case"technique_common":for(var r=0;r<n.childNodes.length;r++){if(n.childNodes[r].nodeName=="accessor"){this.accessor=(new ct).parse(n.childNodes[r]);break}}break;default:break}}return this};dt.prototype.read=function(){var e=[];var t=this.accessor.params[0];switch(t.type){case"IDREF":case"Name":case"name":case"float":return this.data;case"float4x4":for(var n=0;n<this.data.length;n+=16){var r=this.data.slice(n,n+16);var i=Vt(r);e.push(i)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+t.type+".");break}return e};vt.prototype.parse=function(e){this.id=e.getAttribute("id");this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){if(e.childNodes[t].nodeName=="instance_effect"){this.instance_effect=(new Et).parse(e.childNodes[t]);break}}return this};mt.prototype.isColor=function(){return this.texture==null};mt.prototype.isTexture=function(){return this.texture!=null};mt.prototype.parse=function(e){if(e.nodeName=="transparent"){this.opaque=e.getAttribute("opaque")}for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"color":var r=Dt(n.textContent);this.color=new THREE.Color;this.color.setRGB(r[0],r[1],r[2]);this.color.a=r[3];break;case"texture":this.texture=n.getAttribute("texture");this.texcoord=n.getAttribute("texcoord");this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1};this.parseTexture(n);break;default:break}}return this};mt.prototype.parseTexture=function(e){if(!e.childNodes)return this;if(e.childNodes[1]&&e.childNodes[1].nodeName==="extra"){e=e.childNodes[1];if(e.childNodes[1]&&e.childNodes[1].nodeName==="technique"){e=e.childNodes[1]}}for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];switch(n.nodeName){case"offsetU":case"offsetV":case"repeatU":case"repeatV":this.texOpts[n.nodeName]=parseFloat(n.textContent);break;case"wrapU":case"wrapV":this.texOpts[n.nodeName]=parseInt(n.textContent);break;default:this.texOpts[n.nodeName]=n.textContent;break}}return this};gt.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"ambient":case"emission":case"diffuse":case"specular":case"transparent":this[n.nodeName]=(new mt).parse(n);break;case"shininess":case"reflectivity":case"index_of_refraction":case"transparency":var r=Rt(n,".//dae:float");if(r.length>0)this[n.nodeName]=parseFloat(r[0].textContent);break;default:break}}this.create();return this};gt.prototype.create=function(){var e={};var t=false;if(this["transparency"]!==undefined&&this["transparent"]!==undefined){var n=this["transparent"];var r=(this.transparent.color.r+this.transparent.color.g+this.transparent.color.b)/3*this.transparency;if(r>0){t=true;e["transparent"]=true;e["opacity"]=1-r}}for(var i in this){switch(i){case"ambient":case"emission":case"diffuse":case"specular":var o=this[i];if(o instanceof mt){if(o.isTexture()){var u=o.texture;var a=this.effect.sampler[u];if(a!==undefined&&a.source!==undefined){var f=this.effect.surface[a.source];var l=s[f.init_from];if(l){var c=THREE.ImageUtils.loadTexture(v+l.init_from);c.wrapS=o.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;c.wrapT=o.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;c.offset.x=o.texOpts.offsetU;c.offset.y=o.texOpts.offsetV;c.repeat.x=o.texOpts.repeatU;c.repeat.y=o.texOpts.repeatV;e["map"]=c;if(i==="emission")e["emissive"]=16777215}}}else if(i==="diffuse"||!t){if(i==="emission"){e["emissive"]=o.color.getHex()}else{e[i]=o.color.getHex()}}}break;case"shininess":e[i]=this[i];break;case"reflectivity":e[i]=this[i];if(e[i]>0)e["envMap"]=w.defaultEnvMap;e["combine"]=THREE.MixOperation;break;case"index_of_refraction":e["refractionRatio"]=this[i];if(this[i]!==1)e["envMap"]=w.defaultEnvMap;break;case"transparency":break;default:break}}e["shading"]=b;e["side"]=this.effect.doubleSided?THREE.DoubleSide:THREE.FrontSide;switch(this.type){case"constant":if(e.emissive!=undefined)e.color=e.emissive;this.material=new THREE.MeshBasicMaterial(e);break;case"phong":case"blinn":if(e.diffuse!=undefined)e.color=e.diffuse;this.material=new THREE.MeshPhongMaterial(e);break;case"lambert":default:if(e.diffuse!=undefined)e.color=e.diffuse;this.material=new THREE.MeshLambertMaterial(e);break}return this.material};yt.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"init_from":this.init_from=n.textContent;break;case"format":this.format=n.textContent;break;default:console.log("unhandled Surface prop: "+n.nodeName);break}}return this};bt.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"source":this.source=n.textContent;break;case"minfilter":this.minfilter=n.textContent;break;case"magfilter":this.magfilter=n.textContent;break;case"mipfilter":this.mipfilter=n.textContent;break;case"wrap_s":this.wrap_s=n.textContent;break;case"wrap_t":this.wrap_t=n.textContent;break;default:console.log("unhandled Sampler2D prop: "+n.nodeName);break}}return this};wt.prototype.create=function(){if(this.shader==null){return null}};wt.prototype.parse=function(e){this.id=e.getAttribute("id");this.name=e.getAttribute("name");Ut(this,e);this.shader=null;for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(n));break;default:break}}return this};wt.prototype.parseNewparam=function(e){var t=e.getAttribute("sid");for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(r.nodeType!=1)continue;switch(r.nodeName){case"surface":this.surface[t]=(new yt(this)).parse(r);break;case"sampler2D":this.sampler[t]=(new bt(this)).parse(r);break;case"extra":break;default:console.log(r.nodeName);break}}};wt.prototype.parseProfileCOMMON=function(e){var t;for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(r.nodeType!=1)continue;switch(r.nodeName){case"profile_COMMON":this.parseProfileCOMMON(r);break;case"technique":t=r;break;case"newparam":this.parseNewparam(r);break;case"image":var i=(new Q).parse(r);s[i.id]=i;break;case"extra":break;default:console.log(r.nodeName);break}}return t};wt.prototype.parseTechnique=function(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"constant":case"lambert":case"blinn":case"phong":this.shader=(new gt(n.nodeName,this)).parse(n);break;default:break}}};Et.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,"");return this};St.prototype.parse=function(e){this.id=e.getAttribute("id");this.name=e.getAttribute("name");this.source={};for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"animation":var r=(new St).parse(n);for(var i in r.source){this.source[i]=r.source[i]}for(var s=0;s<r.channel.length;s++){this.channel.push(r.channel[s]);this.sampler.push(r.sampler[s])}break;case"source":var i=(new dt).parse(n);this.source[i.id]=i;break;case"sampler":this.sampler.push((new Tt(this)).parse(n));break;case"channel":this.channel.push((new xt(this)).parse(n));break;default:break}}return this};xt.prototype.parse=function(e){this.source=e.getAttribute("source").replace(/^#/,"");this.target=e.getAttribute("target");var t=this.target.split("/");var n=t.shift();var r=t.shift();var i=r.indexOf(".")>=0;var s=r.indexOf("(")>=0;if(i){t=r.split(".");this.sid=t.shift();this.member=t.shift()}else if(s){var o=r.split("(");this.sid=o.shift();for(var u=0;u<o.length;u++){o[u]=parseInt(o[u].replace(/\)/,""))}this.arrIndices=o}else{this.sid=r}this.fullSid=r;this.dotSyntax=i;this.arrSyntax=s;return this};Tt.prototype.parse=function(e){this.id=e.getAttribute("id");this.inputs=[];for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"input":this.inputs.push((new pt).parse(n));break;default:break}}return this};Tt.prototype.create=function(){for(var e=0;e<this.inputs.length;e++){var t=this.inputs[e];var n=this.animation.source[t.source];switch(t.semantic){case"INPUT":this.input=n.read();break;case"OUTPUT":this.output=n.read();this.strideOut=n.accessor.stride;break;case"INTERPOLATION":this.interpolation=n.read();break;case"IN_TANGENT":break;case"OUT_TANGENT":break;default:console.log(t.semantic);break}}this.startTime=0;this.endTime=0;this.duration=0;if(this.input.length){this.startTime=1e8;this.endTime=-1e8;for(var e=0;e<this.input.length;e++){this.startTime=Math.min(this.startTime,this.input[e]);this.endTime=Math.max(this.endTime,this.input[e])}this.duration=this.endTime-this.startTime}};Tt.prototype.getData=function(e,t){var n;if(e==="matrix"&&this.strideOut===16){n=this.output[t]}else if(this.strideOut>1){n=[];t*=this.strideOut;for(var r=0;r<this.strideOut;++r){n[r]=this.output[t+r]}if(this.strideOut===3){switch(e){case"rotate":case"translate":Wt(n,-1);break;case"scale":Wt(n,1);break}}else if(this.strideOut===4&&e==="matrix"){Wt(n,-1)}}else{n=this.output[t]}return n};Nt.prototype.addTarget=function(e,t,n,r){this.targets.push({sid:e,member:n,transform:t,data:r})};Nt.prototype.apply=function(e){for(var t=0;t<this.targets.length;++t){var n=this.targets[t];if(!e||n.sid===e){n.transform.update(n.data,n.member)}}};Nt.prototype.getTarget=function(e){for(var t=0;t<this.targets.length;++t){if(this.targets[t].sid===e){return this.targets[t]}}return null};Nt.prototype.hasTarget=function(e){for(var t=0;t<this.targets.length;++t){if(this.targets[t].sid===e){return true}}return false};Nt.prototype.interpolate=function(e,t){for(var n=0;n<this.targets.length;++n){var r=this.targets[n],i=e.getTarget(r.sid),s;if(r.transform.type!=="matrix"&&i){var o=(t-this.time)/(e.time-this.time),u=i.data,a=r.data;if(o<0||o>1){console.log("Key.interpolate: Warning! Scale out of bounds:"+o);o=o<0?0:1}if(a.length){s=[];for(var f=0;f<a.length;++f){s[f]=a[f]+(u[f]-a[f])*o}}else{s=a+(u-a)*o}}else{s=r.data}r.transform.update(s,r.member)}};Ct.prototype.parse=function(e){this.id=e.getAttribute("id");this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"optics":this.parseOptics(n);break;default:break}}return this};Ct.prototype.parseOptics=function(e){for(var t=0;t<e.childNodes.length;t++){if(e.childNodes[t].nodeName=="technique_common"){var n=e.childNodes[t];for(var r=0;r<n.childNodes.length;r++){this.technique=n.childNodes[r].nodeName;if(this.technique=="perspective"){var i=n.childNodes[r];for(var s=0;s<i.childNodes.length;s++){var o=i.childNodes[s];switch(o.nodeName){case"yfov":this.yfov=o.textContent;break;case"xfov":this.xfov=o.textContent;break;case"znear":this.znear=o.textContent;break;case"zfar":this.zfar=o.textContent;break;case"aspect_ratio":this.aspect_ratio=o.textContent;break}}}else if(this.technique=="orthographic"){var u=n.childNodes[r];for(var s=0;s<u.childNodes.length;s++){var o=u.childNodes[s];switch(o.nodeName){case"xmag":this.xmag=o.textContent;break;case"ymag":this.ymag=o.textContent;break;case"znear":this.znear=o.textContent;break;case"zfar":this.zfar=o.textContent;break;case"aspect_ratio":this.aspect_ratio=o.textContent;break}}}}}}return this};kt.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,"");return this};Lt.prototype.parse=function(e){this.id=e.getAttribute("id");this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(n.nodeType!=1)continue;switch(n.nodeName){case"technique_common":this.parseCommon(n);break;case"technique":this.parseTechnique(n);break;default:break}}return this};Lt.prototype.parseCommon=function(e){for(var t=0;t<e.childNodes.length;t++){switch(e.childNodes[t].nodeName){case"directional":case"point":case"spot":case"ambient":this.technique=e.childNodes[t].nodeName;var n=e.childNodes[t];for(var r=0;r<n.childNodes.length;r++){var i=n.childNodes[r];switch(i.nodeName){case"color":var s=Dt(i.textContent);this.color=new THREE.Color(0);this.color.setRGB(s[0],s[1],s[2]);this.color.a=s[3];break;case"falloff_angle":this.falloff_angle=parseFloat(i.textContent);break}}}}return this};Lt.prototype.parseTechnique=function(e){this.profile=e.getAttribute("profile");for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];switch(n.nodeName){case"intensity":this.intensity=parseFloat(n.textContent);break}}return this};At.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,"");return this};return{load:T,parse:N,setPreferredShading:C,applySkin:j,geometries:a,options:w}}