1 |
- !function e(t,r,n){function a(o,s){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(i)return i(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[o]={exports:{}};t[o][0].call(l.exports,function(e){var r=t[o][1][e];return a(r||e)},l,l.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)a(n[o]);return a}({1:[function(e,t,r){"use strict";e("./src/loaders")},{"./src/loaders":8}],2:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)};THREE.LoaderUtils={extractUrlBase:THREE.Loader.prototype.extractUrlBase,decodeText:function(e){return(new TextDecoder).decode(e)}},function(){function e(e){var t={},r={};if("Video"in e.Objects){var n=e.Objects.Video;for(var a in n){var i=n[a];if(t[u=parseInt(a)]=i.Filename,"Content"in i){var o=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,s="string"==typeof i.Content&&""!==i.Content;if(o||s){var c=function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,a=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(a){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;default:return void console.warn('FBXLoader: Image type "'+a+'" is not supported.')}if("string"==typeof r)return"data:"+t+";base64,"+r;var i=new Uint8Array(r);return window.URL.createObjectURL(new Blob([i],{type:t}))}(n[a]);r[i.Filename]=c}}}}for(var u in t){var l=t[u];void 0!==r[l]?t[u]=r[l]:t[u]=t[u].split("\\").pop()}return t}function r(e,t,r,n){var a=new Map;if("Texture"in e.Objects){var i=e.Objects.Texture;for(var o in i){var s=function(e,t,r,n){var a=function(e,t,r,n){var a,i=t.path,o=n.get(e.id).children;void 0!==o&&o.length>0&&void 0!==r[o[0].ID]&&(0!==(a=r[o[0].ID]).indexOf("blob:")&&0!==a.indexOf("data:")||t.setPath(void 0));var s=t.load(a);return t.setPath(i),s}(e,t,r,n);a.ID=e.id,a.name=e.attrName;var i=e.WrapModeU,o=e.WrapModeV,s=void 0!==i?i.value:0,c=void 0!==o?o.value:0;if(a.wrapS=0===s?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,a.wrapT=0===c?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,"Scaling"in e){var u=e.Scaling.value;a.repeat.x=u[0],a.repeat.y=u[1]}return a}(i[o],t,r,n);a.set(parseInt(o),s)}}return a}function n(e,t,r){var n=new Map;if("Material"in e.Objects){var o=e.Objects.Material;for(var s in o){var c=function(e,t,r,n){var o=t.id,s=t.attrName,c=t.ShadingModel;"object"===(void 0===c?"undefined":a(c))&&(c=c.value);if(!n.has(o))return null;var u,l=function(e,t,r,n,a){var o={};t.BumpFactor&&(o.bumpScale=t.BumpFactor.value);t.Diffuse&&(o.color=(new THREE.Color).fromArray(t.Diffuse.value));t.DisplacementFactor&&(o.displacementScale=t.DisplacementFactor.value);t.ReflectionFactor&&(o.reflectivity=t.ReflectionFactor.value);t.Specular&&(o.specular=(new THREE.Color).fromArray(t.Specular.value));t.Shininess&&(o.shininess=t.Shininess.value);t.Emissive&&(o.emissive=(new THREE.Color).fromArray(t.Emissive.value));t.EmissiveFactor&&(o.emissiveIntensity=parseFloat(t.EmissiveFactor.value));t.Opacity&&(o.opacity=parseFloat(t.Opacity.value));o.opacity<1&&(o.transparent=!0);return a.get(n).children.forEach(function(t){var n=t.relationship;switch(n){case"Bump":o.bumpMap=r.get(t.ID);break;case"DiffuseColor":o.map=i(e,r,t.ID,a);break;case"DisplacementColor":o.displacementMap=i(e,r,t.ID,a);break;case"EmissiveColor":o.emissiveMap=i(e,r,t.ID,a);break;case"NormalMap":o.normalMap=i(e,r,t.ID,a);break;case"ReflectionColor":o.envMap=i(e,r,t.ID,a),o.envMap.mapping=THREE.EquirectangularReflectionMapping;break;case"SpecularColor":o.specularMap=i(e,r,t.ID,a);break;case"TransparentColor":o.alphaMap=i(e,r,t.ID,a),o.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}}),o}(e,t,r,o,n);switch(c.toLowerCase()){case"phong":u=new THREE.MeshPhongMaterial;break;case"lambert":u=new THREE.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',c),u=new THREE.MeshPhongMaterial({color:3342591})}return u.setValues(l),u.name=s,u}(e,o[s],t,r);null!==c&&n.set(parseInt(s),c)}}return n}function i(e,t,r,n){return"LayeredTexture"in e.Objects&&r in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=n.get(r).children[0].ID),t.get(r)}function o(e,t){var r={};if("Deformer"in e.Objects){var n=e.Objects.Deformer;for(var a in n){if("Skin"===n[a].attrType){var i=t.get(parseInt(a)),o=function(e,t){var r=[];return e.children.forEach(function(e){var n=t[e.ID];if("Cluster"===n.attrType){var a={ID:e.ID,indices:[],weights:[],transform:(new THREE.Matrix4).fromArray(n.Transform.a),transformLink:(new THREE.Matrix4).fromArray(n.TransformLink.a),linkMode:n.Mode};"Indexes"in n&&(a.indices=n.Indexes.a,a.weights=n.Weights.a),r.push(a)}}),{rawBones:r,bones:[]}}(i,n);o.ID=a,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=i.parents[0].ID,r[a]=o}}}return r}function s(e,t,r){var n=new Map;if("Geometry"in e.Objects){var a=e.Objects.Geometry;for(var i in a){var o=function(e,t,r,n){switch(r.attrType){case"Mesh":return function(e,t,r,n){var a=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(0===a.length)return;var i=t.children.reduce(function(e,t){return void 0!==n[t.ID]&&(e=n[t.ID]),e},null),o=new THREE.Matrix4,s=a[0];if("GeometricRotation"in s){var u=s.GeometricRotation.value.map(THREE.Math.degToRad);u[3]="ZYX",o.makeRotationFromEuler((new THREE.Euler).fromArray(u))}"GeometricTranslation"in s&&o.setPosition((new THREE.Vector3).fromArray(s.GeometricTranslation.value));return function(e,t,r,n,a){var i=r.Vertices.a,o=r.PolygonVertexIndex.a,s=[],u=[],l=[],f=[],p=[],d=[],h=[];if(r.LayerElementColor)var m=function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Colors.a,a=[];"IndexToDirect"===r&&(a=e.ColorIndex.a);return{dataSize:4,buffer:n,indices:a,mappingType:t,referenceType:r}}(r.LayerElementColor[0]);if(r.LayerElementMaterial)var v=function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,a=[],i=0;i<n.length;++i)a.push(i);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:r}}(r.LayerElementMaterial[0]);if(r.LayerElementNormal)var E=function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,a=[];"IndexToDirect"===r&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a));return{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:r}}(r.LayerElementNormal[0]);if(r.LayerElementUV)for(var g=[],y=0;r.LayerElementUV[y];)g.push(function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.UV.a,a=[];"IndexToDirect"===r&&(a=e.UVIndex.a);return{dataSize:2,buffer:n,indices:a,mappingType:t,referenceType:r}}(r.LayerElementUV[y])),y++;var T={};null!==n&&n.rawBones.forEach(function(e,t){e.indices.forEach(function(r,n){void 0===T[r]&&(T[r]=[]),T[r].push({id:t,weight:e.weights[n]})})});var b=0,R=0,w=!1,I=[],L=[],H=[],A=[],S=[],x=[];o.forEach(function(e,t){var r=!1;e<0&&(e^=-1,o[t]=e,r=!0);var a=[],y=[];if(I.push(3*e,3*e+1,3*e+2),m){D=c(t,b,e,m);H.push(D[0],D[1],D[2])}if(n){if(void 0!==T[e]&&T[e].forEach(function(e){y.push(e.weight),a.push(e.id)}),y.length>4){w||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),w=!0);var F=[0,0,0,0],C=[0,0,0,0];y.forEach(function(e,t){var r=e,n=a[t];C.forEach(function(e,t,a){if(r>e){a[t]=r,r=e;var i=F[t];F[t]=n,n=i}})}),a=F,y=C}for(;y.length<4;)y.push(0),a.push(0);for(N=0;N<4;++N)S.push(y[N]),x.push(a[N])}if(E){var D=c(t,b,e,E);L.push(D[0],D[1],D[2])}if(v&&"AllSame"!==v.mappingType)var O=c(t,b,e,v)[0];if(g&&g.forEach(function(r,n){var a=c(t,b,e,r);void 0===A[n]&&(A[n]=[]),A[n].push(a[0]),A[n].push(a[1])}),R++,r){for(var N=2;N<R;N++)s.push(i[I[0]]),s.push(i[I[1]]),s.push(i[I[2]]),s.push(i[I[3*(N-1)]]),s.push(i[I[3*(N-1)+1]]),s.push(i[I[3*(N-1)+2]]),s.push(i[I[3*N]]),s.push(i[I[3*N+1]]),s.push(i[I[3*N+2]]),n&&(d.push(S[0]),d.push(S[1]),d.push(S[2]),d.push(S[3]),d.push(S[4*(N-1)]),d.push(S[4*(N-1)+1]),d.push(S[4*(N-1)+2]),d.push(S[4*(N-1)+3]),d.push(S[4*N]),d.push(S[4*N+1]),d.push(S[4*N+2]),d.push(S[4*N+3]),h.push(x[0]),h.push(x[1]),h.push(x[2]),h.push(x[3]),h.push(x[4*(N-1)]),h.push(x[4*(N-1)+1]),h.push(x[4*(N-1)+2]),h.push(x[4*(N-1)+3]),h.push(x[4*N]),h.push(x[4*N+1]),h.push(x[4*N+2]),h.push(x[4*N+3])),m&&(l.push(H[0]),l.push(H[1]),l.push(H[2]),l.push(H[3*(N-1)]),l.push(H[3*(N-1)+1]),l.push(H[3*(N-1)+2]),l.push(H[3*N]),l.push(H[3*N+1]),l.push(H[3*N+2])),v&&"AllSame"!==v.mappingType&&(p.push(O),p.push(O),p.push(O)),E&&(u.push(L[0]),u.push(L[1]),u.push(L[2]),u.push(L[3*(N-1)]),u.push(L[3*(N-1)+1]),u.push(L[3*(N-1)+2]),u.push(L[3*N]),u.push(L[3*N+1]),u.push(L[3*N+2])),g&&g.forEach(function(e,t){void 0===f[t]&&(f[t]=[]),f[t].push(A[t][0]),f[t].push(A[t][1]),f[t].push(A[t][2*(N-1)]),f[t].push(A[t][2*(N-1)+1]),f[t].push(A[t][2*N]),f[t].push(A[t][2*N+1])});b++,R=0,I=[],L=[],H=[],A=[],S=[],x=[]}});var F=new THREE.BufferGeometry;F.name=r.name;var C=new THREE.Float32BufferAttribute(s,3);a.applyToBufferAttribute(C),F.addAttribute("position",C),l.length>0&&F.addAttribute("color",new THREE.Float32BufferAttribute(l,3));n&&(F.addAttribute("skinIndex",new THREE.Float32BufferAttribute(h,4)),F.addAttribute("skinWeight",new THREE.Float32BufferAttribute(d,4)),F.FBX_Deformer=n);if(u.length>0){var D=new THREE.Float32BufferAttribute(u,3);(new THREE.Matrix3).getNormalMatrix(a).applyToBufferAttribute(D),F.addAttribute("normal",D)}if(f.forEach(function(e,t){var r="uv"+(t+1).toString();0===t&&(r="uv"),F.addAttribute(r,new THREE.Float32BufferAttribute(f[t],2))}),v&&"AllSame"!==v.mappingType){var O=p[0],N=0;if(p.forEach(function(e,t){e!==O&&(F.addGroup(N,t-N,O),O=e,N=t)}),F.groups.length>0){var M=F.groups[F.groups.length-1],B=M.start+M.count;B!==p.length&&F.addGroup(B,p.length-B,O)}0===F.groups.length&&F.addGroup(0,p.length,p[0])}return F}(0,0,r,i,o)}(e,t,r,n);case"NurbsCurve":return function(e){if(void 0===THREE.NURBSCurve)return console.error("THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new THREE.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new THREE.BufferGeometry;for(var r=t-1,n=e.KnotVector.a,a=[],i=e.Points.a,o=0,s=i.length;o<s;o+=4)a.push((new THREE.Vector4).fromArray(i,o));var c,u;if("Closed"===e.Form)a.push(a[0]);else if("Periodic"===e.Form){c=r,u=n.length-1-c;for(o=0;o<r;++o)a.push(a[o])}var l=new THREE.NURBSCurve(r,n,a,c,u).getPoints(7*a.length),f=new Float32Array(3*l.length);l.forEach(function(e,t){e.toArray(f,3*t)});var p=new THREE.BufferGeometry;return p.addAttribute("position",new THREE.BufferAttribute(f,3)),p}(r)}}(e,t.get(parseInt(i)),a[i],r);n.set(parseInt(i),o)}}return n}function c(e,t,r,n){return w[n.mappingType][n.referenceType](e,t,r,n)}function u(e,t,r,n,a){var i=new THREE.Group,o=function(e,t,r,n,a){var i=new Map,o=e.Objects.Model;for(var s in o){var c=parseInt(s),u=o[s],l=a.get(c),f=function(e,t,r,n){var a=null;return e.parents.forEach(function(e){for(var i in t){var o=t[i];o.rawBones.forEach(function(t,i){if(t.ID===e.ID){var s=a;(a=new THREE.Bone).matrixWorld.copy(t.transformLink),a.name=THREE.PropertyBinding.sanitizeNodeName(n),a.ID=r,o.bones[i]=a,null!==s&&a.add(s)}})}}),a}(l,t,c,u.attrName);if(!f){switch(u.attrType){case"Camera":f=function(e,t){var r,n;if(t.children.forEach(function(t){var r=e.Objects.NodeAttribute[t.ID];void 0!==r&&(n=r)}),void 0===n)r=new THREE.Object3D;else{var a=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(a=1);var i=1;void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3);var o=1e3;void 0!==n.FarPlane&&(o=n.FarPlane.value/1e3);var s=window.innerWidth,c=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,c=n.AspectHeight.value);var u=s/c,l=45;void 0!==n.FieldOfView&&(l=n.FieldOfView.value);var f=n.FocalLength?n.FocalLength.value:null;switch(a){case 0:r=new THREE.PerspectiveCamera(l,u,i,o),null!==f&&r.setFocalLength(f);break;case 1:r=new THREE.OrthographicCamera(-s/2,s/2,c/2,-c/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+a+"."),r=new THREE.Object3D}}return r}(e,l);break;case"Light":f=function(e,t){var r,n;if(t.children.forEach(function(t){var r=e.Objects.NodeAttribute[t.ID];void 0!==r&&(n=r)}),void 0===n)r=new THREE.Object3D;else{var a;a=void 0===n.LightType?0:n.LightType.value;var i=16777215;void 0!==n.Color&&(i=(new THREE.Color).fromArray(n.Color.value));var o=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(o=0);var s=0;void 0!==n.FarAttenuationEnd&&(s=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value/1e3);switch(a){case 0:r=new THREE.PointLight(i,o,s,1);break;case 1:r=new THREE.DirectionalLight(i,o);break;case 2:var c=Math.PI/3;void 0!==n.InnerAngle&&(c=THREE.Math.degToRad(n.InnerAngle.value));var u=0;void 0!==n.OuterAngle&&(u=THREE.Math.degToRad(n.OuterAngle.value),u=Math.max(u,1)),r=new THREE.SpotLight(i,o,s,c,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a THREE.PointLight."),r=new THREE.PointLight(i,o)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(r.castShadow=!0)}return r}(e,l);break;case"Mesh":f=function(e,t,r,n){var a,i=null,o=null,s=[];t.children.forEach(function(e){r.has(e.ID)&&(i=r.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))}),s.length>1?o=s:s.length>0?o=s[0]:(o=new THREE.MeshPhongMaterial({color:13421772}),s.push(o));"color"in i.attributes&&s.forEach(function(e){e.vertexColors=THREE.VertexColors});i.FBX_Deformer?(s.forEach(function(e){e.skinning=!0}),a=new THREE.SkinnedMesh(i,o)):a=new THREE.Mesh(i,o);return a}(0,l,r,n);break;case"NurbsCurve":f=function(e,t){var r=e.children.reduce(function(e,r){return t.has(r.ID)&&(e=t.get(r.ID)),e},null),n=new THREE.LineBasicMaterial({color:3342591,linewidth:1});return new THREE.Line(r,n)}(l,r);break;case"LimbNode":case"Null":default:f=new THREE.Group}f.name=THREE.PropertyBinding.sanitizeNodeName(u.attrName),f.ID=c}!function(e,t,r){if("RotationOrder"in r){var n=["XYZ","XZY","YZX","ZXY","YXZ","ZYX","SphericXYZ"],a=parseInt(r.RotationOrder.value,10);a>0&&a<6?console.warn("THREE.FBXLoader: unsupported Euler Order: %s. Currently only XYZ order is supported. Animations and rotations may be incorrect.",n[a]):6===a&&console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.")}"Lcl_Translation"in r&&t.position.fromArray(r.Lcl_Translation.value);if("Lcl_Rotation"in r){var i=r.Lcl_Rotation.value.map(THREE.Math.degToRad);i.push("ZYX"),t.rotation.fromArray(i)}"Lcl_Scaling"in r&&t.scale.fromArray(r.Lcl_Scaling.value);if("PreRotation"in r){var o=r.PreRotation.value.map(THREE.Math.degToRad);o[3]="ZYX";var s=(new THREE.Euler).fromArray(o);s=(new THREE.Quaternion).setFromEuler(s);var c=(new THREE.Quaternion).setFromEuler(t.rotation);s.multiply(c),t.rotation.setFromQuaternion(s,"ZYX")}}(0,f,u),i.set(c,f)}return i}(e,r,n,a,t),s=e.Objects.Model;return o.forEach(function(r){var n=s[r.ID];!function(e,t,r,n,a){if("LookAtProperty"in r){n.get(t.ID).children.forEach(function(r){if("LookAtProperty"===r.relationship){var n=e.Objects.Model[r.ID];if("Lcl_Translation"in n){var i=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(i),a.add(t.target)):t.lookAt((new THREE.Vector3).fromArray(i))}}})}}(e,r,n,t,i);t.get(r.ID).parents.forEach(function(e){var t=o.get(e.ID);void 0!==t&&t.add(r)}),null===r.parent&&i.add(r)}),function(e,t,r,n,a){var i=function(e){var t={};if("Pose"in e.Objects){var r=e.Objects.Pose;for(var n in r)if("BindPose"===r[n].attrType){var a=r[n].PoseNode;Array.isArray(a)?a.forEach(function(e){t[e.Node]=(new THREE.Matrix4).fromArray(e.Matrix.a)}):t[a.Node]=(new THREE.Matrix4).fromArray(a.Matrix.a)}}return t}(e);for(var o in t){var s=t[o];a.get(parseInt(s.ID)).parents.forEach(function(e){if(r.has(e.ID)){var t=e.ID;a.get(t).parents.forEach(function(e){if(n.has(e.ID)){n.get(e.ID).bind(new THREE.Skeleton(s.bones),i[e.ID])}})}})}}(e,r,n,o,t),function(e,t,r){r.animations=[];var n=function(e,t){if(void 0===e.Objects.AnimationCurve)return;var r=function(e){var t=e.Objects.AnimationCurveNode,r=new Map;for(var n in t){var a=t[n];if(null!==a.attrName.match(/S|R|T/)){var i={id:a.id,attr:a.attrName,curves:{}};r.set(i.id,i)}}return r}(e);!function(e,t,r){var n=e.Objects.AnimationCurve;for(var a in n){var i={id:n[a].id,times:n[a].KeyTime.a.map(g),values:n[a].KeyValueFloat.a},o=t.get(i.id);if(void 0!==o){var s=o.parents[0].ID,c=o.parents[0].relationship,u="";if(c.match(/X/))u="x";else if(c.match(/Y/))u="y";else{if(!c.match(/Z/))continue;u="z"}r.get(s).curves[u]=i}}}(e,t,r);var n=function(e,t,r){var n=e.Objects.AnimationLayer,a=new Map;for(var i in n){var o=[],s=t.get(parseInt(i));if(void 0!==s){s.children.forEach(function(n,a){if(r.has(n.ID)){var i=r.get(n.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===o[a]){var s;t.get(n.ID).parents.forEach(function(e){void 0!==e.relationship&&(s=e.ID)});var c=e.Objects.Model[s.toString()],u={modelName:THREE.PropertyBinding.sanitizeNodeName(c.attrName),initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};"Lcl_Translation"in c&&(u.initialPosition=c.Lcl_Translation.value),"Lcl_Rotation"in c&&(u.initialRotation=c.Lcl_Rotation.value),"Lcl_Scaling"in c&&(u.initialScale=c.Lcl_Scaling.value),"PreRotation"in c&&(u.preRotations=c.PreRotation.value),o[a]=u}o[a][i.attr]=i}}}),a.set(parseInt(i),o)}}return a}(e,t,r);return function(e,t,r){var n=e.Objects.AnimationStack,a={};for(var i in n){var o=t.get(parseInt(i)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var s=r.get(o[0].ID);a[i]={name:n[i].attrName,layer:s}}return a}(e,t,n)}(e,t);if(void 0===n)return;for(var a in n){var i=function(e){var t=[];return e.layer.forEach(function(e){t=t.concat(function(e){var t=[];if(void 0!==e.T&&Object.keys(e.T.curves).length>0){var r=l(e.modelName,e.T.curves,e.initialPosition,"position");void 0!==r&&t.push(r)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var n=function(e,t,r,n){void 0!==t.x&&(t.x.values=t.x.values.map(THREE.Math.degToRad)),void 0!==t.y&&(t.y.values=t.y.values.map(THREE.Math.degToRad)),void 0!==t.z&&(t.z.values=t.z.values.map(THREE.Math.degToRad));var a=p(t),i=f(a,t,r);void 0!==n&&((n=n.map(THREE.Math.degToRad)).push("ZYX"),n=(new THREE.Euler).fromArray(n),n=(new THREE.Quaternion).setFromEuler(n));for(var o=new THREE.Quaternion,s=new THREE.Euler,c=[],u=0;u<i.length;u+=3)s.set(i[u],i[u+1],i[u+2],"ZYX"),o.setFromEuler(s),void 0!==n&&o.premultiply(n),o.toArray(c,u/3*4);return new THREE.QuaternionKeyframeTrack(e+".quaternion",a,c)}(e.modelName,e.R.curves,e.initialRotation,e.preRotations);void 0!==n&&t.push(n)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var a=l(e.modelName,e.S.curves,e.initialScale,"scale");void 0!==a&&t.push(a)}return t}(e))}),new THREE.AnimationClip(e.name,-1,t)}(n[a]);r.animations.push(i)}}(e,t,i),function(e,t){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var r=e.GlobalSettings.AmbientColor.value,n=r[0],a=r[1],i=r[2];if(0!==n||0!==a||0!==i){var o=new THREE.Color(n,a,i);t.add(new THREE.AmbientLight(o,1))}}}(e,i),i}function l(e,t,r,n){var a=p(t),i=f(a,t,r);return new THREE.VectorKeyframeTrack(e+"."+n,a,i)}function f(e,t,r){var n=r,a=[],i=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(i=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==i){var r=t.x.values[i];a.push(r),n[0]=r}else a.push(n[0]);if(-1!==o){var c=t.y.values[o];a.push(c),n[1]=c}else a.push(n[1]);if(-1!==s){var u=t.z.values[s];a.push(u),n[2]=u}else a.push(n[2])}),a}function p(e){var t=[];return void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}).filter(function(e,t,r){return r.indexOf(e)==t})}function d(){}function h(){}function m(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function v(){}function E(e){var t=e.match(/FBXVersion: (\d+)/);if(t){return parseInt(t[1])}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function g(e){return e/46186158e3}function y(e){return e.split(",").map(function(e){return parseFloat(e)})}function T(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),THREE.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function b(e,t,r,n){for(var a=r,i=0;a<n;a++,i++)e[i]=t[a];return e}t.exports=THREE.FBXLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},Object.assign(THREE.FBXLoader.prototype,{load:function(e,t,r,n){var a=this,i=THREE.LoaderUtils.extractUrlBase(e),o=new THREE.FileLoader(this.manager);o.setResponseType("arraybuffer"),o.load(e,function(r){try{var o=a.parse(r,i);t(o)}catch(t){window.setTimeout(function(){n&&n(t),a.manager.itemError(e)},0)}},r,n)},parse:function(t,a){var i;if(function(e){var t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===T(e,0,t.length)}(t))i=(new h).parse(t);else{var c=T(t);if(!function(e){function t(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var r=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0,a=0;a<r.length;++a)if(t(1)===r[a])return!1;return!0}(c))throw new Error("THREE.FBXLoader: Unknown format.");if(E(c)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+E(c));i=(new d).parse(c)}var l=function(e){var t=new Map;"Connections"in e&&e.Connections.connections.forEach(function(e){var r=e[0],n=e[1],a=e[2];t.has(r)||t.set(r,{parents:[],children:[]});var i={ID:n,relationship:a};t.get(r).parents.push(i),t.has(n)||t.set(n,{parents:[],children:[]});var o={ID:r,relationship:a};t.get(n).children.push(o)});return t}(i),f=e(i),p=n(i,r(i,new THREE.TextureLoader(this.manager).setPath(a),f,l),l),m=o(i,l);return u(i,l,m,s(i,l,m),p)}});var R=[],w={ByPolygonVertex:{Direct:function(e,t,r,n){var a=e*n.dataSize,i=e*n.dataSize+n.dataSize;return b(R,n.buffer,a,i)},IndexToDirect:function(e,t,r,n){var a=n.indices[e],i=a*n.dataSize,o=a*n.dataSize+n.dataSize;return b(R,n.buffer,i,o)}},ByPolygon:{Direct:function(e,t,r,n){var a=t*n.dataSize,i=t*n.dataSize+n.dataSize;return b(R,n.buffer,a,i)},IndexToDirect:function(e,t,r,n){var a=n.indices[t],i=a*n.dataSize,o=a*n.dataSize+n.dataSize;return b(R,n.buffer,i,o)}},ByVertice:{Direct:function(e,t,r,n){var a=r*n.dataSize,i=r*n.dataSize+n.dataSize;return b(R,n.buffer,a,i)}},AllSame:{IndexToDirect:function(e,t,r,n){var a=n.indices[0]*n.dataSize,i=n.indices[0]*n.dataSize+n.dataSize;return b(R,n.buffer,a,i)}}};Object.assign(d.prototype,{getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,this.allNodes=new v,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split("\n");return r.forEach(function(e,n){var a=e.match(/^[\s\t]*;/),i=e.match(/^[\s\t]*$/);if(!a&&!i){var o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),c=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,r[++n]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}}),this.allNodes},parseNodeBegin:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")}),a={name:r},i=this.parseNodeAttr(n),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,a):r in o?("PoseNode"===r?o.PoseNode.push(a):void 0!==o[r].id&&(o[r]={},o[r][o[r].id]=o[r]),""!==i.id&&(o[r][i.id]=a)):"number"==typeof i.id?(o[r]={},o[r][i.id]=a):"Properties70"!==r&&(o[r]="PoseNode"===r?[a]:a),"number"==typeof i.id&&(a.id=i.id),""!==i.name&&(a.attrName=i.name),""!==i.type&&(a.attrType=i.type),this.pushStack(a)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var r="",n="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}},parseNodeProperty:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),a=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===n&&","===a&&(a=r.replace(/"/g,"").replace(/,$/,"").trim());var i=this.getCurrentNode();if("Properties70"!==i.name){if("C"===n){var o=a.split(",").slice(1),s=parseInt(o[0]),c=parseInt(o[1]),u=a.split(",").slice(3);n="connections",function(e,t){for(var r=0,n=e.length,a=t.length;r<a;r++,n++)e[n]=t[r]}(a=[s,c],u=u.map(function(e){return e.trim().replace(/^"/,"")})),void 0===i[n]&&(i[n]=[])}"Node"===n&&(i.id=a),n in i&&Array.isArray(i[n])?i[n].push(a):"a"!==n?i[n]=a:i.a=a,this.setCurrentProp(i,n),"a"===n&&","!==a.slice(-1)&&(i.a=y(a))}else this.parseNodeSpecialProperty(e,n,a)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=y(t.a))},parseNodeSpecialProperty:function(e,t,r){var n=r.split('",').map(function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}),a=n[0],i=n[1],o=n[2],s=n[3],c=n[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=y(c)}this.getPrevNode()[a]={type:i,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),a)}}),Object.assign(h.prototype,{parse:function(e){var t=new m(e);t.skip(23);var r=t.getUint32();console.log("THREE.FBXLoader: FBX binary version: "+r);for(var n=new v;!this.endOfContent(t);){var a=this.parseNode(t,r);null!==a&&n.add(a.name,a)}return n},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var r={},n=t>=7500?e.getUint64():e.getUint32(),a=t>=7500?e.getUint64():e.getUint32(),i=(t>=7500?e.getUint64():e.getUint32(),e.getUint8()),o=e.getString(i);if(0===n)return null;for(var s=[],c=0;c<a;c++)s.push(this.parseProperty(e));var u=s.length>0?s[0]:"",l=s.length>1?s[1]:"",f=s.length>2?s[2]:"";for(r.singleProperty=1===a&&e.getOffset()===n;n>e.getOffset();){var p=this.parseNode(e,t);null!==p&&this.parseSubNode(o,r,p)}return r.propertyList=s,"number"==typeof u&&(r.id=u),""!==l&&(r.attrName=l),""!==f&&(r.attrType=f),""!==o&&(r.name=o),r},parseSubNode:function(e,t,r){if(!0===r.singleProperty){var n=r.propertyList[0];Array.isArray(n)?(t[r.name]=r,r.a=n):t[r.name]=n}else if("Connections"===e&&"C"===r.name){var a=[];r.propertyList.forEach(function(e,t){0!==t&&a.push(e)}),void 0===t.connections&&(t.connections=[]),t.connections.push(a)}else if("Properties70"===r.name){Object.keys(r).forEach(function(e){t[e]=r[e]})}else if("Properties70"===e&&"P"===r.name){var i,o=r.propertyList[0],s=r.propertyList[1],c=r.propertyList[2],u=r.propertyList[3];0===o.indexOf("Lcl ")&&(o=o.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),i="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[o]={type:s,type2:c,flag:u,value:i}}else void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":r=e.getUint32();return e.getArrayBuffer(r);case"S":var r=e.getUint32();return e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=e.getUint32(),a=e.getUint32(),i=e.getUint32();if(0===a)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}void 0===window.Zlib&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var o=new m(new Zlib.Inflate(new Uint8Array(e.getArrayBuffer(i))).decompress().buffer);switch(t){case"b":case"c":return o.getBooleanArray(n);case"d":return o.getFloat64Array(n);case"f":return o.getFloat32Array(n);case"i":return o.getInt32Array(n);case"l":return o.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}),Object.assign(m.prototype,{getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),e=e+1&4294967295,-(4294967296*t+e)):4294967296*t+e},getInt64Array:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=new Uint8Array(e),r=0;r<e;r++)t[r]=this.getUint8();var n=t.indexOf(0);return n>=0&&(t=t.slice(0,n)),THREE.LoaderUtils.decodeText(t)}}),Object.assign(v.prototype,{add:function(e,t){this[e]=t}})}()},{}],3:[function(e,t,r){"use strict";t.exports=THREE.PLYLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.propertyNameMapping={}},THREE.PLYLoader.prototype={constructor:THREE.PLYLoader,load:function(e,t,r,n){var a=this,i=new THREE.XHRLoader(this.manager);i.setResponseType("arraybuffer"),i.load(e,function(e){t(a.parse(e))},r,n)},setPropertyNameMapping:function(e){this.propertyNameMapping=e},bin2str:function(e){for(var t=new Uint8Array(e),r="",n=0;n<e.byteLength;n++)r+=String.fromCharCode(t[n]);return r},isASCII:function(e){return"ascii"===this.parseHeader(this.bin2str(e)).format},parse:function(e){return e instanceof ArrayBuffer?this.isASCII(e)?this.parseASCII(this.bin2str(e)):this.parseBinary(e):this.parseASCII(e)},parseHeader:function(e){function t(e,t){var r={type:e[0]};return"list"===r.type?(r.name=e[3],r.countType=e[1],r.itemType=e[2]):r.name=e[1],r.name in t&&(r.name=t[r.name]),r}var r="",n=0,a=/ply([\s\S]*)end_header\s/.exec(e);null!==a&&(r=a[1],n=a[0].length);for(var i,o,s={comments:[],elements:[],headerLength:n},c=r.split("\n"),u=void 0,l=0;l<c.length;l++){var f=c[l];if(""!==(f=f.trim()))switch(o=f.split(/\s+/),i=o.shift(),f=o.join(" "),i){case"format":s.format=o[0],s.version=o[1];break;case"comment":s.comments.push(f);break;case"element":void 0!==u&&s.elements.push(u),(u=Object()).name=o[0],u.count=parseInt(o[1]),u.properties=[];break;case"property":u.properties.push(t(o,this.propertyNameMapping));break;default:console.log("unhandled",i,o)}}return void 0!==u&&s.elements.push(u),s},parseASCIINumber:function(e,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(e);case"float":case"double":case"float32":case"float64":return parseFloat(e)}},parseASCIIElement:function(e,t){for(var r=t.split(/\s+/),n=Object(),a=0;a<e.length;a++)if("list"===e[a].type){for(var i=[],o=this.parseASCIINumber(r.shift(),e[a].countType),s=0;s<o;s++)i.push(this.parseASCIINumber(r.shift(),e[a].itemType));n[e[a].name]=i}else n[e[a].name]=this.parseASCIINumber(r.shift(),e[a].type);return n},parseASCII:function(e){var t,r=new THREE.Geometry,n=this.parseHeader(e),a="";null!==(t=/end_header\s([\s\S]*)$/.exec(e))&&(a=t[1]);var i=a.split("\n"),o=0,s=0;r.useColor=!1;for(var c=0;c<i.length;c++){var u=i[c];if(""!==(u=u.trim())){s>=n.elements[o].count&&(o++,s=0);var l=this.parseASCIIElement(n.elements[o].properties,u);this.handleElement(r,n.elements[o].name,l),s++}}return this.postProcess(r)},postProcess:function(e){if(e.useColor){for(var t=0;t<e.faces.length;t++)e.faces[t].vertexColors=[e.colors[e.faces[t].a],e.colors[e.faces[t].b],e.colors[e.faces[t].c]];e.elementsNeedUpdate=!0}return e.computeBoundingSphere(),e},handleElement:function(e,t,r){if("vertex"===t){if(e.vertices.push(new THREE.Vector3(r.x,r.y,r.z)),"red"in r&&"green"in r&&"blue"in r){e.useColor=!0;var n=new THREE.Color;n.setRGB(r.red/255,r.green/255,r.blue/255),e.colors.push(n)}}else if("face"===t){var a=r.vertex_indices||r.vertex_index;3===a.length?e.faces.push(new THREE.Face3(a[0],a[1],a[2])):4===a.length&&e.faces.push(new THREE.Face3(a[0],a[1],a[3]),new THREE.Face3(a[1],a[2],a[3]))}},binaryRead:function(e,t,r,n){switch(r){case"int8":case"char":return[e.getInt8(t),1];case"uint8":case"uchar":return[e.getUint8(t),1];case"int16":case"short":return[e.getInt16(t,n),2];case"uint16":case"ushort":return[e.getUint16(t,n),2];case"int32":case"int":return[e.getInt32(t,n),4];case"uint32":case"uint":return[e.getUint32(t,n),4];case"float32":case"float":return[e.getFloat32(t,n),4];case"float64":case"double":return[e.getFloat64(t,n),8]}},binaryReadElement:function(e,t,r,n){for(var a,i=Object(),o=0,s=0;s<r.length;s++)if("list"===r[s].type){var c=[],u=(a=this.binaryRead(e,t+o,r[s].countType,n))[0];o+=a[1];for(var l=0;l<u;l++)a=this.binaryRead(e,t+o,r[s].itemType,n),c.push(a[0]),o+=a[1];i[r[s].name]=c}else a=this.binaryRead(e,t+o,r[s].type,n),i[r[s].name]=a[0],o+=a[1];return[i,o]},parseBinary:function(e){for(var t,r=new THREE.Geometry,n=this.parseHeader(this.bin2str(e)),a="binary_little_endian"===n.format,i=new DataView(e,n.headerLength),o=0,s=0;s<n.elements.length;s++)for(var c=0;c<n.elements[s].count;c++){o+=(t=this.binaryReadElement(i,o,n.elements[s].properties,a))[1];var u=t[0];this.handleElement(r,n.elements[s].name,u)}return this.postProcess(r)}}},{}],4:[function(e,t,r){"use strict";function n(e){var t=document.getElementById(e),r=t.parentNode;try{r&&r.removeChild(t)}catch(e){}}function a(e,t,r){return new r(function(r,a){var i=t.timeout||5e3,o="script_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),s=function(e,t){var r=document.createElement("script");return r.type="text/javascript",r.async=!0,r.id=t,r.src=e,r}(e,o),c=setTimeout(function(){a(new Error("Script request to "+e+" timed out")),n(o)},i),u=function(e){clearTimeout(e)};s.addEventListener("load",function(e){r({ok:!0}),u(c),n(o)}),s.addEventListener("error",function(t){a(new Error("Script request to "+e+" failed "+t)),u(c),n(o)}),function(e){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}(s)})}t.exports=function(e){return e=e||{},function(t,r){return r=r||{},a(t,r,e.Promise||Promise)}}},{}],5:[function(e,t,r){"use strict";function n(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}var a={once:THREE.LoopOnce,repeat:THREE.LoopRepeat,pingpong:THREE.LoopPingPong};t.exports=AFRAME.registerComponent("animation-mixer",{schema:{clip:{default:"*"},duration:{default:0},crossFadeDuration:{default:0},loop:{default:"repeat",oneOf:Object.keys(a)},repetitions:{default:1/0,min:0}},init:function(){var e=this;this.model=null,this.mixer=null,this.activeActions=[];var t=this.el.getObject3D("mesh");t?this.load(t):this.el.addEventListener("model-loaded",function(t){e.load(t.detail.model)})},load:function(e){var t=this.el;this.model=e,this.mixer=new THREE.AnimationMixer(e),this.mixer.addEventListener("loop",function(e){t.emit("animation-loop",{action:e.action,loopDelta:e.loopDelta})}),this.mixer.addEventListener("finished",function(e){t.emit("animation-finished",{action:e.action,direction:e.direction})}),this.data.clip&&this.update({})},remove:function(){this.mixer&&this.mixer.stopAllAction()},update:function(e){e&&(this.stopAction(),this.data.clip&&this.playAction())},stopAction:function(){for(var e=this.data,t=0;t<this.activeActions.length;t++)e.crossFadeDuration?this.activeActions[t].fadeOut(e.crossFadeDuration):this.activeActions[t].stop();this.activeActions.length=0},playAction:function(){if(this.mixer){var e=this.model,t=this.data,r=e.animations||(e.geometry||{}).animations||[];if(r.length)for(var i,o=function(e){return new RegExp("^"+e.split(/\*+/).map(n).join(".*")+"$")}(t.clip),s=0;i=r[s];s++)if(i.name.match(o)){var c=this.mixer.clipAction(i,e);c.enabled=!0,t.duration&&c.setDuration(t.duration),c.setLoop(a[t.loop],t.repetitions).fadeIn(t.crossFadeDuration).play(),this.activeActions.push(c)}}},tick:function(e,t){this.mixer&&!isNaN(t)&&this.mixer.update(t/1e3)}})},{}],6:[function(e,t,r){"use strict";THREE.FBXLoader=e("../../lib/FBXLoader"),t.exports=AFRAME.registerComponent("fbx-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){var e=this.data;if(e.src){this.remove();var t=new THREE.FBXLoader;e.crossorigin&&t.setCrossOrigin(e.crossorigin),t.load(e.src,this.load.bind(this))}},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"fbx",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{"../../lib/FBXLoader":2}],7:[function(e,t,r){"use strict";var n=e("../../lib/fetch-script")(),a=function(){var e=void 0;return function(){return e=e||n("https://rawgit.com/mrdoob/three.js/r86/examples/js/loaders/GLTFLoader.js")}}();t.exports=AFRAME.registerComponent("gltf-model-legacy",{schema:{type:"model"},init:function(){var e=this;this.model=null,this.loader=null,this.loaderPromise=a().then(function(){e.loader=new THREE.GLTFLoader,e.loader.setCrossOrigin("Anonymous")})},update:function(){var e=this,t=this,r=this.el,n=this.data;n&&(this.remove(),this.loaderPromise.then(function(){e.loader.load(n,function(e){t.model=e.scene,t.model.animations=e.animations,r.setObject3D("mesh",t.model),r.emit("model-loaded",{format:"gltf",model:t.model})})}))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{"../../lib/fetch-script":4}],8:[function(e,t,r){"use strict";e("./animation-mixer"),e("./fbx-model"),e("./gltf-model-legacy"),e("./json-model"),e("./object-model"),e("./ply-model")},{"./animation-mixer":5,"./fbx-model":6,"./gltf-model-legacy":7,"./json-model":9,"./object-model":10,"./ply-model":11}],9:[function(e,t,r){"use strict";t.exports=AFRAME.registerComponent("json-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){var e=this,t=void 0,r=this.data;r.src&&(this.remove(),t=new THREE.JSONLoader,r.crossorigin&&(t.crossOrigin=r.crossorigin),t.load(r.src,function(t,r){r.forEach(function(e){e.vertexColors=(t.faces[0]||{}).color?THREE.FaceColors:THREE.NoColors,e.skinning=!!(t.bones||[]).length,e.morphTargets=!!(t.morphTargets||[]).length,e.morphNormals=!!(t.morphNormals||[]).length});var n=(t.bones||[]).length?new THREE.SkinnedMesh(t,new THREE.MultiMaterial(r)):new THREE.Mesh(t,new THREE.MultiMaterial(r));e.load(n)}))},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"json",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{}],10:[function(e,t,r){"use strict";t.exports=AFRAME.registerComponent("object-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){var e=this,t=void 0,r=this.data;r.src&&(this.remove(),t=new THREE.ObjectLoader,r.crossorigin&&t.setCrossOrigin(r.crossorigin),t.load(r.src,function(t){t.traverse(function(e){e instanceof THREE.SkinnedMesh&&e.material&&(e.material.skinning=!!(e.geometry&&e.geometry.bones||[]).length)}),e.load(t)}))},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"json",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{}],11:[function(e,t,r){"use strict";THREE.PLYLoader=e("../../lib/PLYLoader"),t.exports.System=AFRAME.registerSystem("ply-model",{init:function(){this.cache={}},getOrLoadGeometry:function(e,t){var r=this.cache,n=r[e];return!t&&n?n:(r[e]=new Promise(function(t){(new THREE.PLYLoader).load(e,function(e){t(e)})}),r[e])}}),t.exports.Component=AFRAME.registerComponent("ply-model",{schema:{skipCache:{type:"boolean",default:!1},src:{type:"asset"}},init:function(){this.model=null},update:function(){var e=this.data,t=this.el;e.src?this.system.getOrLoadGeometry(e.src,e.skipCache).then(function(e){var r=function(e){return new THREE.Mesh(e,new THREE.MeshPhongMaterial({color:16777215,shading:THREE.FlatShading,vertexColors:THREE.VertexColors,shininess:0}))}(e);t.setObject3D("mesh",r),t.emit("model-loaded",{format:"ply",model:r})}):console.warn("[%s] `src` property is required.",this.name)},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{"../../lib/PLYLoader":3}]},{},[1]);
|