PageSourceSearch

https://3drweb.netlify.app/assets/ModelExporter-B6joB6hP.js

js 3drweb.netlify.app collected 2026-10-03 10:23:57 UTC 49,342 bytes, 1 lines download raw bytes

vendor: 33,659 bytes, line 1
1import{C as le,M as ue,V as G,Q as fe,B as C,R as de,a as V,S as xe,N as X,b as J,c as ge,I as me,D as ye,P as z,d as Me,e as se,f as Z,g as Te,h as we,i as Ee,L as Q,j as Ae,k as $,l as be,m as ee,n as Re,o as Ie,_ as Se,p as j,q as M,r as ne,t as b,s as Le,u as _e,G as k,v as D,w as Ce,T as Ne,x as W,K as Ue,y as Fe,W as ve,z as K}from"./index-eeV-2cpd.js";const re={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class B{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(e){return new We(e)}),this.register(function(e){return new Ke(e)}),this.register(function(e){return new Je(e)}),this.register(function(e){return new Ze(e)}),this.register(function(e){return new Qe(e)}),this.register(function(e){return new $e(e)}),this.register(function(e){return new Ye(e)}),this.register(function(e){return new qe(e)}),this.register(function(e){return new Xe(e)}),this.register(function(e){return new et(e)}),this.register(function(e){return new tt(e)}),this.register(function(e){return new st(e)}),this.register(function(e){return new nt(e)}),this.register(function(e){return new rt(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,s,n,t){const r=new je,o=[];for(let a=0,c=this.pluginCallbacks.length;a<c;a++)o.push(this.pluginCallbacks[a](r));r.setPlugins(o),r.setTextureUtils(this.textureUtils),r.writeAsync(e,s,t).catch(n)}parseAsync(e,s){const n=this;return new Promise(function(t,r){n.parse(e,t,r,s)})}}const m={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Y="KHR_mesh_quantization",S={};S[Te]=m.NEAREST;S[we]=m.NEAREST_MIPMAP_NEAREST;S[Ee]=m.NEAREST_MIPMAP_LINEAR;S[Q]=m.LINEAR;S[Ae]=m.LINEAR_MIPMAP_NEAREST;S[$]=m.LINEAR_MIPMAP_LINEAR;S[be]=m.CLAMP_TO_EDGE;S[ee]=m.REPEAT;S[Re]=m.MIRRORED_REPEAT;const oe={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Pe=new le,ie=12,Oe=1179937895,ke=2,ae=8,De=1313821514,Ge=5130562;function P(i,e){return i.length===e.length&&i.every(function(s,n){return s===e[n]})}function ze(i){return new TextEncoder().encode(i).buffer}function Be(i){return P(i.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function He(i,e,s){const n={min:new Array(i.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(i.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let t=e;t<e+s;t++)for(let r=0;r<i.itemSize;r++){let o;i.itemSize>4?o=i.array[t*i.itemSize+r]:(r===0?o=i.getX(t):r===1?o=i.getY(t):r===2?o=i.getZ(t):r===3&&(o=i.getW(t)),i.normalized===!0&&(o=J.normalize(o,i.array))),n.min[r]=Math.min(n.min[r],o),n.max[r]=Math.max(n.max[r],o)}return n}function pe(i){return Math.ceil(i/4)*4}function q(i,e=0){const s=pe(i.byteLength);if(s!==i.byteLength){const n=new Uint8Array(s);if(n.set(new Uint8Array(i)),e!==0)for(let t=i.byteLength;t<s;t++)n[t]=e;return n.buffer}return i}function ce(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function Ve(i,e){if(typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas){let s;return e==="image/jpeg"?s=.92:e==="image/webp"&&(s=.8),i.convertToBlob({type:e,quality:s})}else return new Promise(s=>i.toBlob(s,e))}class je{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+de}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,s,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);const t=this,r=t.buffers,o=t.json;n=t.options;const a=t.extensionsUsed,c=t.extensionsRequired,l=new Blob(r,{type:"application/octet-stream"}),h=Object.keys(a),u=Object.keys(c);if(h.length>0&&(o.extensionsUsed=h),u.length>0&&(o.extensionsRequired=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=l.size),n.binary===!0){const y=new FileReader;y.readAsArrayBuffer(l),y.onloadend=function(){const p=q(y.result),d=new DataView(new ArrayBuffer(ae));d.setUint32(0,p.byteLength,!0),d.setUint32(4,Ge,!0);const x=q(ze(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(ae));g.setUint32(0,x.byteLength,!0),g.setUint32(4,De,!0);const E=new ArrayBuffer(ie),L=new DataView(E);L.setUint32(0,Oe,!0),L.setUint32(4,ke,!0);const O=ie+g.byteLength+x.byteLength+d.byteLength+p.byteLength;L.setUint32(8,O,!0);const f=new Blob([E,g,x,d,p],{type:"application/octet-stream"}),T=new FileReader;T.readAsArrayBuffer(f),T.onloadend=function(){s(T.result)}}}else if(o.buffers&&o.buffers.length>0){const y=new FileReader;y.readAsDataURL(l),y.onloadend=function(){const p=y.result;o.buffers[0].uri=p,s(o)}}else s(o)}serializeUserData(e,s){if(Object.keys(e.userData).length===0)return;const n=this.options,t=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&r.gltfExtensions){s.extensions===void 0&&(s.extensions={});for(const o in r.gltfExtensions)s.extensions[o]=r.gltfExtensions[o],t[o]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(s.extras=r)}catch(r){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+r.message)}}getUID(e,s=!1){if(this.uids.has(e)===!1){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(s)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new G;for(let t=0,r=e.count;t<r;t++)if(Math.abs(n.fromBufferAttribute(e,t).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const s=this.cache;if(s.attributesNormalized.has(e))return s.attributesNormalized.get(e);const n=e.clone(),t=new G;for(let r=0,o=n.count;r<o;r++)t.fromBufferAttribute(n,r),t.x===0&&t.y===0&&t.z===0?t.setX(1):t.normalize(),n.setXYZ(r,t.x,t.y,t.z);return s.attributesNormalized.set(e,n),n}applyTextureTransform(e,s){let n=!1;const t={};(s.offset.x!==0||s.offset.y!==0)&&(t.offset=s.offset.toArray(),n=!0),s.rotation!==0&&(t.rotation=s.rotation,n=!0),(s.repeat.x!==1||s.repeat.y!==1)&&(t.scale=s.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=t,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,s){if(e===s)return e;function n(p){return p.colorSpace===Z?function(x){return x<.04045?x*.0773993808:Math.pow(x*.9478672986+.0521327014,2.4)}:function(x){return x}}e instanceof V&&(e=await this.decompressTextureAsync(e)),s instanceof V&&(s=await this.decompressTextureAsync(s));const t=e?e.image:null,r=s?s.image:null,o=Math.max(t?t.width:0,r?r.width:0),a=Math.max(t?t.height:0,r?r.height:0),c=ce();c.width=o,c.height=a;const l=c.getContext("2d",{willReadFrequently:!0});l.fillStyle="#00ffff",l.fillRect(0,0,o,a);const h=l.getImageData(0,0,o,a);if(t){l.drawImage(t,0,0,o,a);const p=n(e),d=l.getImageData(0,0,o,a).data;for(let x=2;x<d.length;x+=4)h.data[x]=p(d[x]/256)*256}if(r){l.drawImage(r,0,0,o,a);const p=n(s),d=l.getImageData(0,0,o,a).data;for(let x=1;x<d.length;x+=4)h.data[x]=p(d[x]/256)*256}l.putImageData(h,0,0);const y=(e||s).clone();return y.source=new xe(c),y.colorSpace=X,y.channel=(e||s).channel,e&&s&&e.channel!==s.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),y}async decompressTextureAsync(e,s=1/0){if(this.textureUtils===null)throw new Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(e,s)}processBuffer(e){const s=this.json,n=this.buffers;return s.buffers||(s.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,s,n,t,r){const o=this.json;o.bufferViews||(o.bufferViews=[]);let a;switch(s){case m.BYTE:case m.UNSIGNED_BYTE:a=1;break;case m.SHORT:case m.UNSIGNED_SHORT:a=2;break;default:a=4}let c=e.itemSize*a;r===m.ARRAY_BUFFER&&(c=Math.ceil(c/4)*4);const l=pe(t*c),h=new DataView(new ArrayBuffer(l));let u=0;for(let d=n;d<n+t;d++){for(let x=0;x<e.itemSize;x++){let g;e.itemSize>4?g=e.array[d*e.itemSize+x]:(x===0?g=e.getX(d):x===1?g=e.getY(d):x===2?g=e.getZ(d):x===3&&(g=e.getW(d)),e.normalized===!0&&(g=J.normalize(g,e.array))),s===m.FLOAT?h.setFloat32(u,g,!0):s===m.INT?h.setInt32(u,g,!0):s===m.UNSIGNED_INT?h.setUint32(u,g,!0):s===m.SHORT?h.setInt16(u,g,!0):s===m.UNSIGNED_SHORT?h.setUint16(u,g,!0):s===m.BYTE?h.setInt8(u,g):s===m.UNSIGNED_BYTE&&h.setUint8(u,g),u+=a}u%c!==0&&(u+=c-u%c)}const y={buffer:this.processBuffer(h.buffer),byteOffset:this.byteOffset,byteLength:l};return r!==void 0&&(y.target=r),r===m.ARRAY_BUFFER&&(y.byteStride=c),this.byteOffset+=l,o.bufferViews.push(y),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const s=this,n=s.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(t){const r=new FileReader;r.readAsArrayBuffer(e),r.onloadend=function(){const o=q(r.result),a={buffer:s.processBuffer(o),byteOffset:s.byteOffset,byteLength:o.byteLength};s.byteOffset+=o.byteLength,t(n.bufferViews.push(a)-1)}})}processAccessor(e,s,n,t){const r=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=m.FLOAT;else if(e.array.constructor===Int32Array)a=m.INT;else if(e.array.constructor===Uint32Array)a=m.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=m.SHORT;else if(e.array.constructor===Uint16Array)a=m.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=m.BYTE;else if(e.array.constructor===Uint8Array)a=m.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),(t===void 0||t===1/0)&&(t=e.count),t===0)return null;const c=He(e,n,t);let l;s!==void 0&&(l=e===s.index?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER);const h=this.processBufferView(e,a,n,t,l),u={bufferView:h.id,byteOffset:h.byteOffset,componentType:a,count:t,max:c.max,min:c.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),r.accessors||(r.accessors=[]),r.accessors.push(u)-1}processImage(e,s,n,t="image/png"){if(e!==null){const r=this,o=r.cache,a=r.json,c=r.options,l=r.pending;o.images.has(e)||o.images.set(e,{});const h=o.images.get(e),u=t+":flipY/"+n.toString();if(h[u]!==void 0)return h[u];a.images||(a.images=[]);const y={mimeType:t},p=ce();p.width=Math.min(e.width,c.maxTextureSize),p.height=Math.min(e.height,c.maxTextureSize);const d=p.getContext("2d",{willReadFrequently:!0});if(n===!0&&(d.translate(0,p.height),d.scale(1,-1)),e.data!==void 0){s!==ge&&console.error("GLTFExporter: Only RGBAFormat is supported.",s),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const g=new Uint8ClampedArray(e.height*e.width*4);for(let E=0;E<g.length;E+=4)g[E+0]=e.data[E+0],g[E+1]=e.data[E+1],g[E+2]=e.data[E+2],g[E+3]=e.data[E+3];d.putImageData(new ImageData(g,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)d.drawImage(e,0,0,p.width,p.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");c.binary===!0?l.push(Ve(p,t).then(g=>r.processBufferViewImage(g)).then(g=>{y.bufferView=g})):y.uri=me.getDataURL(p,t);const x=a.images.push(y)-1;return h[u]=x,x}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const s=this.json;s.samplers||(s.samplers=[]);const n={magFilter:S[e.magFilter],minFilter:S[e.minFilter],wrapS:S[e.wrapS],wrapT:S[e.wrapT]};return s.samplers.push(n)-1}async processTextureAsync(e){const n=this.options,t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]),e instanceof V&&(e=await this.decompressTextureAsync(e,n.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),await this._invokeAllAsync(async function(l){l.writeTexture&&await l.writeTexture(e,a)});const c=r.textures.push(a)-1;return t.textures.set(e,c),c}async processMaterialAsync(e){const s=this.cache,n=this.json;if(s.materials.has(e))return s.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const t={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=e.color.toArray().concat([e.opacity]);if(P(r,[1,1,1,1])||(t.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(t.pbrMetallicRoughness.metallicFactor=e.metalness,t.pbrMetallicRoughness.roughnessFactor=e.roughness):(t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){const a=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),c={index:await this.processTextureAsync(a),texCoord:a.channel};this.applyTextureTransform(c,a),t.pbrMetallicRoughness.metallicRoughnessTexture=c}if(e.map){const a={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),t.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(t.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),t.emissiveTexture=l}}if(e.normalMap){const a={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),t.normalTexture=a}if(e.aoMap){const a={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),t.occlusionTexture=a}e.transparent?t.alphaMode="BLEND":e.alphaTest>0&&(t.alphaMode="MASK",t.alphaCutoff=e.alphaTest),e.side===ye&&(t.doubleSided=!0),e.name!==""&&(t.name=e.name),this.serializeUserData(e,t),await this._invokeAllAsync(async function(a){a.writeMaterialAsync&&await a.writeMaterialAsync(e,t)});const o=n.materials.push(t)-1;return s.materials.set(e,o),o}async processMeshAsync(e){const s=this.cache,n=this.json,t=[e.geometry.uuid];if(Array.isArray(e.material))for(let f=0,T=e.material.length;f<T;f++)t.push(e.material[f].uuid);else t.push(e.material.uuid);const r=t.join(":");if(s.meshes.has(r))return s.meshes.get(r);const o=e.geometry;let a;e.isLineSegments?a=m.LINES:e.isLineLoop?a=m.LINE_LOOP:e.isLine?a=m.LINE_STRIP:e.isPoints?a=m.POINTS:a=e.material.wireframe?m.LINES:m.TRIANGLES;const c={},l={},h=[],u=[],y={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},p=o.getAttribute("normal");p!==void 0&&!this.isNormalizedNormalAttribute(p)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(p)));let d=null;for(let f in o.attributes){if(f.slice(0,5)==="morph")continue;const T=o.attributes[f];if(f=y[f]||f.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(f)||(f="_"+f),s.attributes.has(this.getUID(T))){l[f]=s.attributes.get(this.getUID(T));continue}d=null;const w=T.array;f==="JOINTS_0"&&!(w instanceof Uint16Array)&&!(w instanceof Uint8Array)?(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),d=new C(new Uint16Array(w),T.itemSize,T.normalized)):(w instanceof Uint32Array||w instanceof Int32Array)&&!f.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${f}" converted to type FLOAT.`),d=B.Utils.toFloat32BufferAttribute(T));const I=this.processAccessor(d||T,o);I!==null&&(f.startsWith("_")||this.detectMeshQuantization(f,T),l[f]=I,s.attributes.set(this.getUID(T),I))}if(p!==void 0&&o.setAttribute("normal",p),Object.keys(l).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const f=[],T=[],A={};if(e.morphTargetDictionary!==void 0)for(const w in e.morphTargetDictionary)A[e.morphTargetDictionary[w]]=w;for(let w=0;w<e.morphTargetInfluences.length;++w){const I={};let te=!1;for(const U in o.morphAttributes){if(U!=="position"&&U!=="normal"){te||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),te=!0);continue}const _=o.morphAttributes[U][w],H=U.toUpperCase(),F=o.attributes[U];if(s.attributes.has(this.getUID(_,!0))){I[H]=s.attributes.get(this.getUID(_,!0));continue}const v=_.clone();if(!o.morphTargetsRelative)for(let R=0,he=_.count;R<he;R++)for(let N=0;N<_.itemSize;N++)N===0&&v.setX(R,_.getX(R)-F.getX(R)),N===1&&v.setY(R,_.getY(R)-F.getY(R)),N===2&&v.setZ(R,_.getZ(R)-F.getZ(R)),N===3&&v.setW(R,_.getW(R)-F.getW(R));I[H]=this.processAccessor(v,o),s.attributes.set(this.getUID(F,!0),I[H])}u.push(I),f.push(e.morphTargetInfluences[w]),e.morphTargetDictionary!==void 0&&T.push(A[w])}c.weights=f,T.length>0&&(c.extras={},c.extras.targetNames=T)}const x=Array.isArray(e.material);if(x&&o.groups.length===0)return null;let g=!1;if(x&&o.index===null){const f=[];for(let T=0,A=o.attributes.position.count;T<A;T++)f[T]=T;o.setIndex(f),g=!0}const E=x?e.material:[e.material],L=x?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let f=0,T=L.length;f<T;f++){const A={mode:a,attributes:l};if(this.serializeUserData(o,A),u.length>0&&(A.targets=u),o.index!==null){let I=this.getUID(o.index);(L[f].start!==void 0||L[f].count!==void 0)&&(I+=":"+L[f].start+":"+L[f].count),s.attributes.has(I)?A.indices=s.attributes.get(I):(A.indices=this.processAccessor(o.index,o,L[f].start,L[f].count),s.attributes.set(I,A.indices)),A.indices===null&&delete A.indices}const w=await this.processMaterialAsync(E[L[f].materialIndex]);w!==null&&(A.material=w),h.push(A)}g===!0&&o.setIndex(null),c.primitives=h,n.meshes||(n.meshes=[]),await this._invokeAllAsync(function(f){f.writeMesh&&f.writeMesh(e,c)});const O=n.meshes.push(c)-1;return s.meshes.set(r,O),O}detectMeshQuantization(e,s){if(this.extensionsUsed[Y])return;let n;switch(s.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}s.normalized&&(n+=" normalized");const t=e.split("_",1)[0];re[t]&&re[t].includes(n)&&(this.extensionsUsed[Y]=!0,this.extensionsRequired[Y]=!0)}processCamera(e){const s=this.json;s.cameras||(s.cameras=[]);const n=e.isOrthographicCamera,t={type:n?"orthographic":"perspective"};return n?t.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:t.perspective={aspectRatio:e.aspect,yfov:J.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(t.name=e.type),s.cameras.push(t)-1}processAnimation(e,s){const n=this.json,t=this.nodeMap;n.animations||(n.animations=[]),e=B.Utils.mergeMorphTargetTracks(e.clone(),s);const r=e.tracks,o=[],a=[];for(let l=0;l<r.length;++l){const h=r[l],u=z.parseTrackName(h.name);let y=z.findNode(s,u.nodeName);const p=oe[u.propertyName];if(u.objectName==="bones"&&(y.isSkinnedMesh===!0?y=y.skeleton.getBoneByName(u.objectIndex):y=void 0),!y||!p){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',h.name);continue}const d=1;let x=h.values.length/h.times.length;p===oe.morphTargetInfluences&&(x/=y.morphTargetInfluences.length);let g;h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(g="CUBICSPLINE",x/=3):h.getInterpolation()===Me?g="STEP":g="LINEAR",a.push({input:this.processAccessor(new C(h.times,d)),output:this.processAccessor(new C(h.values,x)),interpolation:g}),o.push({sampler:a.length-1,target:{node:t.get(y),path:p}})}const c={name:e.name||"clip_"+n.animations.length,samplers:a,channels:o};return this.serializeUserData(e,c),n.animations.push(c),n.animations.length-1}processSkin(e){const s=this.json,n=this.nodeMap,t=s.nodes[n.get(e)],r=e.skeleton;if(r===void 0)return null;const o=e.skeleton.bones[0];if(o===void 0)return null;const a=[],c=new Float32Array(r.bones.length*16),l=new ue;for(let u=0;u<r.bones.length;++u)a.push(n.get(r.bones[u])),l.copy(r.boneInverses[u]),l.multiply(e.bindMatrix).toArray(c,u*16);return s.skins===void 0&&(s.skins=[]),s.skins.push({inverseBindMatrices:this.processAccessor(new C(c,16)),joints:a,skeleton:n.get(o)}),t.skin=s.skins.length-1}async processNodeAsync(e){const s=this.json,n=this.options,t=this.nodeMap;s.nodes||(s.nodes=[]);const r={};if(n.trs){const a=e.quaternion.toArray(),c=e.position.toArray(),l=e.scale.toArray();P(a,[0,0,0,1])||(r.rotation=a),P(c,[0,0,0])||(r.translation=c),P(l,[1,1,1])||(r.scale=l)}else e.matrixAutoUpdate&&e.updateMatrix(),Be(e.matrix)===!1&&(r.matrix=e.matrix.elements);if(e.name!==""&&(r.name=String(e.name)),this.serializeUserData(e,r),e.isMesh||e.isLine||e.isPoints){const a=await this.processMeshAsync(e);a!==null&&(r.mesh=a)}else e.isCamera&&(r.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const o=s.nodes.push(r)-1;if(t.set(e,o),e.children.length>0){const a=[];for(let c=0,l=e.children.length;c<l;c++){const h=e.children[c];if(h.visible||n.onlyVisible===!1){const u=await this.processNodeAsync(h);u!==null&&a.push(u)}}a.length>0&&(r.children=a)}return await this._invokeAllAsync(function(a){a.writeNode&&a.writeNode(e,r)}),o}async processSceneAsync(e){const s=this.json,n=this.options;s.scenes||(s.scenes=[],s.scene=0);const t={};e.name!==""&&(t.name=e.name),s.scenes.push(t);const r=[];for(let o=0,a=e.children.length;o<a;o++){const c=e.children[o];if(c.visible||n.onlyVisible===!1){const l=await this.processNodeAsync(c);l!==null&&r.push(l)}}r.length>0&&(t.nodes=r),this.serializeUserData(e,t)}async processObjectsAsync(e){const s=new se;s.name="AuxScene";for(let n=0;n<e.length;n++)s.children.push(e[n]);await this.processSceneAsync(s)}async processInputAsync(e){const s=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync(function(t){t.beforeParse&&t.beforeParse(e)});const n=[];for(let t=0;t<e.length;t++)e[t]instanceof se?await this.processSceneAsync(e[t]):n.push(e[t]);n.length>0&&await this.processObjectsAsync(n);for(let t=0;t<this.skins.length;++t)this.processSkin(this.skins[t]);for(let t=0;t<s.animations.length;++t)this.processAnimation(s.animations[t],e[0]);await this._invokeAllAsync(function(t){t.afterParse&&t.afterParse(e)})}async _invokeAllAsync(e){for(let s=0,n=this.plugins.length;s<n;s++)await e(this.plugins[s])}}class We{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,s){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const n=this.writer,t=n.json,r=n.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),r[this.name]||(t.extensions=t.extensions||{},t.extensions[this.name]={lights:[]},r[this.name]=!0);const a=t.extensions[this.name].lights;a.push(o),s.extensions=s.extensions||{},s.extensions[this.name]={light:a.length-1}}}class Ke{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,s){if(!e.isMeshBasicMaterial)return;const t=this.writer.extensionsUsed;s.extensions=s.extensions||{},s.extensions[this.name]={},t[this.name]=!0,s.pbrMetallicRoughness.metallicFactor=0,s.pbrMetallicRoughness.roughnessFactor=.9}}class Ye{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const n=this.writer,t=n.extensionsUsed,r={};if(r.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:await n.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(o,e.clearcoatMap),r.clearcoatTexture=o}if(r.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:await n.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,e.clearcoatRoughnessMap),r.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:await n.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),n.applyTextureTransform(o,e.clearcoatNormalMap),r.clearcoatNormalTexture=o}s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class qe{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const t=this.writer.extensionsUsed,r={};r.dispersion=e.dispersion,s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class Xe{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const n=this.writer,t=n.extensionsUsed,r={};if(r.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:await n.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(o,e.iridescenceMap),r.iridescenceTexture=o}if(r.iridescenceIor=e.iridescenceIOR,r.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],r.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:await n.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(o,e.iridescenceThicknessMap),r.iridescenceThicknessTexture=o}s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class Je{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,t=n.extensionsUsed,r={};if(r.transmissionFactor=e.transmission,e.transmissionMap){const o={index:await n.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(o,e.transmissionMap),r.transmissionTexture=o}s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class Ze{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,t=n.extensionsUsed,r={};if(r.thicknessFactor=e.thickness,e.thicknessMap){const o={index:await n.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(o,e.thicknessMap),r.thicknessTexture=o}e.attenuationDistance!==1/0&&(r.attenuationDistance=e.attenuationDistance),r.attenuationColor=e.attenuationColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class Qe{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const t=this.writer.extensionsUsed,r={};r.ior=e.ior,s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class $e{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(Pe)&&!e.specularIntensityMap&&!e.specularColorMap)return;const n=this.writer,t=n.extensionsUsed,r={};if(e.specularIntensityMap){const o={index:await n.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(o,e.specularIntensityMap),r.specularTexture=o}if(e.specularColorMap){const o={index:await n.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(o,e.specularColorMap),r.specularColorTexture=o}r.specularFactor=e.specularIntensity,r.specularColorFactor=e.specularColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class et{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,t=n.extensionsUsed,r={};if(e.sheenRoughnessMap){const o={index:await n.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(o,e.sheenRoughnessMap),r.sheenRoughnessTexture=o}if(e.sheenColorMap){const o={index:await n.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(o,e.sheenColorMap),r.sheenColorTexture=o}r.sheenRoughnessFactor=e.sheenRoughness,r.sheenColorFactor=e.sheenColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class tt{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,s){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const n=this.writer,t=n.extensionsUsed,r={};if(e.anisotropyMap){const o={index:await n.processTextureAsync(e.anisotropyMap)};n.applyTextureTransform(o,e.anisotropyMap),r.anisotropyTexture=o}r.anisotropyStrength=e.anisotropy,r.anisotropyRotation=e.anisotropyRotation,s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class st{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,s){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const t=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class nt{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,s){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const n=this.writer,t=n.extensionsUsed,r={};if(e.bumpMap){const o={index:await n.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(o,e.bumpMap),r.bumpTexture=o}r.bumpFactor=e.bumpScale,s.extensions=s.extensions||{},s.extensions[this.name]=r,t[this.name]=!0}}class rt{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,s){if(!e.isInstancedMesh)return;const n=this.writer,t=e,r=new Float32Array(t.count*3),o=new Float32Array(t.count*4),a=new Float32Array(t.count*3),c=new ue,l=new G,h=new fe,u=new G;for(let p=0;p<t.count;p++)t.getMatrixAt(p,c),c.decompose(l,h,u),l.toArray(r,p*3),h.toArray(o,p*4),u.toArray(a,p*3);const y={TRANSLATION:n.processAccessor(new C(r,3)),ROTATION:n.processAccessor(new C(o,4)),SCALE:n.processAccessor(new C(a,3))};t.instanceColor&&(y._COLOR_0=n.processAccessor(t.instanceColor)),s.extensions=s.extensions||{},s.extensions[this.name]={attributes:y},n.extensionsUsed[this.name]=!0,n.extensionsRequired[this.name]=!0}}B.Utils={insertKeyframe:function(i,e){const n=i.getValueSize(),t=new i.TimeBufferType(i.times.length+1),r=new i.ValueBufferType(i.values.length+n),o=i.createInterpolant(new i.ValueBufferType(n));let a;if(i.times.length===0){t[0]=e;for(let c=0;c<n;c++)r[c]=0;a=0}else if(e<i.times[0]){if(Math.abs(i.times[0]-e)<.001)return 0;t[0]=e,t.set(i.times,1),r.set(o.evaluate(e),0),r.set(i.values,n),a=0}else if(e>i.times[i.times.length-1]){if(Math.abs(i.times[i.times.length-1]-e)<.001)return i.times.length-1;t[t.length-1]=e,t.set(i.times,0),r.set(i.values,0),r.set(o.evaluate(e),i.values.length),a=t.length-1}else for(let c=0;c<i.times.length;c++){if(Math.abs(i.times[c]-e)<.001)return c;if(i.times[c]<e&&i.times[c+1]>e){t.set(i.times.slice(0,c+1),0),t[c+1]=e,t.set(i.times.slice(c+1),c+2),r.set(i.values.slice(0,(c+1)*n),0),r.set(o.evaluate(e),(c+1)*n),r.set(i.values.slice((c+1)
1*n),(c+2)*n),a=c+1;break}}return i.times=t,i.values=r,a},mergeMorphTargetTracks:function(i,e){const s=[],n={},t=i.tracks;for(let r=0;r<t.length;++r){let o=t[r];const a=z.parseTrackName(o.name),c=z.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){s.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(Ie)}const l=c.morphTargetInfluences.length,h=c.morphTargetDictionary[a.propertyIndex];if(h===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let u;if(n[c.uuid]===void 0){u=o.clone();const p=new u.ValueBufferType(l*u.times.length);for(let d=0;d<u.times.length;d++)p[d*l+h]=u.values[d];u.name=(a.nodeName||"")+".morphTargetInfluences",u.values=p,n[c.uuid]=u,s.push(u);continue}const y=o.createInterpolant(new o.ValueBufferType(1));u=n[c.uuid];for(let p=0;p<u.times.length;p++)u.values[p*l+h]=y.evaluate(u.times[p]);for(let p=0;p<o.times.length;p++){const d=this.insertKeyframe(u,o.times[p]);u.values[d*l+h]=o.values[p]}}return i.tracks=s,i},toFloat32BufferAttribute:function(i){const e=new C(new Float32Array(i.count*i.itemSize),i.itemSize,!1);if(!i.normalized&&!i.isInterleavedBufferAttribute)return e.array.set(i.array),e;for(let s=0,n=i.count;s<n;s++)for(let t=0;t<i.itemSize;t++)e.setComponent(s,t,i.getComponent(s,t));return e}};const ot={name:"ModelExporter",data(){return{isExporting:!1,currentExport:null,exportProgress:0,exportMessage:"",statusMessage:"",statusType:"info",scene:null,renderer:null,ktx2Loader:null,dracoLoader:null,textureCache:{},sofaTexturesCache:{},auralisTexturesCache:{}}},mounted(){this.initRenderer(),this.initLoaders()},beforeUnmount(){this.renderer&&this.renderer.dispose(),this.ktx2Loader&&this.ktx2Loader.dispose(),this.dracoLoader&&this.dracoLoader.dispose()},methods:{initRenderer(){this.renderer=W(new ve({antialias:!0,alpha:!0}))},initLoaders(){this.ktx2Loader=W(new Ue),this.ktx2Loader.setTranscoderPath("https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/basis/"),this.ktx2Loader.detectSupport(this.renderer),this.dracoLoader=W(new Fe),this.dracoLoader.setDecoderPath("https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/draco/")},async loadTextureWithFallback(i,e=!0){const s=`${i}_${e?"color":"data"}`;if(this.textureCache[s])return this.textureCache[s];let n;
1try{return n=await new Ne().loadAsync(i+".webp"),e?n.colorSpace=Z:n.colorSpace=X,n.flipY=!1,n.wrapS=n.wrapT=ee,n.minFilter=$,n.magFilter=Q,n.anisotropy=this.renderer.capabilities.getMaxAnisotropy(),n.generateMipmaps=!0,n.needsUpdate=!0,this.textureCache[s]=n,n}catch{try{return n=await this.ktx2Loader.loadAsync(i+".ktx2"),e?n.colorSpace=Z:n.colorSpace=X,n.flipY=!1,n.wrapS=n.wrapT=ee,n.minFilter=$,n.magFilter=Q,n.anisotropy=this.renderer.capabilities.getMaxAnisotropy(),n.generateMipmaps=!0,n.needsUpdate=!0,this.textureCache[s]=n,n}catch{throw new Error(`No se pudo cargar textura: ${i}`)}}},async getSofaTextures(i){if(this.sofaTexturesCache[i])return this.sofaTexturesCache[i];const e={};try{const s=async(h,u)=>{try{return await this.loadTextureWithFallback(h,u)}catch{return null}},n=`/textures/${i}_`,[t,r,o,a,c,l]=await Promise.all([s(n+"map",!0),s(n+"roughnessMap",!1),s(n+"normalMap",!1),s(n+"metalnessMap",!1),s(n+"sheenColorMap",!0),s(n+"sheenRoughnessMap",!1)]);t&&(e.map=t),c&&(e.sheenColorMap=c),o&&(e.normalMap=o),r&&(e.roughnessMap=r),a&&(e.metalnessMap=a),l&&(e.sheenRoughnessMap=l),this.sofaTexturesCache[i]=e}catch(s){console.error(`Error cargando texturas de sofá ${i}:`,s)}return e},async getAuralisTextures(i){if(this.auralisTexturesCache[i])return this.auralisTexturesCache[i];const e={};try{const s=`/textures/auralis_${i}_`,[n,t,r,o]=await Promise.all([this.loadTextureWithFallback(s+"basecolor",!0),this.loadTextureWithFallback(s+"normal",!1),this.loadTextureWithFallback(s+"roughness",!1),this.loadTextureWithFallback(s+"metallic",!1)]);n&&(e.map=n),t&&(e.normalMap=t),r&&(e.roughnessMap=r),o&&(e.metalnessMap=o),this.auralisTexturesCache[i]=e}catch(s){console.error(`Error cargando texturas de Auralis ${i}:`,s)}return e},async exportModel(i,e){return new Promise((s,n)=>{const t=new B,r={binary:!0,maxTextureSize:2048,includeCustomExtensions:!0};t.parse(i,o=>{try{const a=new Blob([o],{type:"application/octet-stream"}),c=URL.createObjectURL(a),l=document.createElement("a");l.href=c,l.download=e,l.click(),URL.revokeObjectURL(c),s()}catch(a){n(a)}},o=>{n(o)},r)})},async exportPuerta(){this.isExporting=!0,this.currentExport="puerta",this.exportProgress=10,this.exportMessage="Cargando modelo de puerta...";try{const i=new k;this.dracoLoader&&i.setDRACOLoader(this.dracoLoader),i.setMeshoptDecoder(D);const s=(await i.loadAsync("/models/Puerta_Tamesis_VMax2023.glb")).scene;this.exportProgress=30,this.exportMessage="Cargando texturas...";const n="/textures/RCN-385_synch_roble_casella_natural_",[t,r,o,a,c]=await Promise.all([this.loadTextureWithFallback(n+"map",!0),this.loadTextureWithFallback(n+"normalMap",!1),this.loadTextureWithFallback(n+"roughnessMap",!1),this.loadTextureWithFallback(n+"metalnessMap",!1),this.loadTextureWithFallback("/models/AO/Puerta_Tamesis_VMax2023_aoMap",!1)]);this.exportProgress=60,this.exportMessage="Aplicando texturas...",s.traverse(l=>{if(l.isMesh){!l.geometry.attributes.uv2&&l.geometry.attributes.uv&&l.geometry.setAttribute("uv2",l.geometry.attributes.uv);const h=new Ce({map:t,normalMap:r,roughnessMap:o,metalnessMap:a,aoMap:c,aoMapIntensity:.8});l.material=h,l.material.needsUpdate=!0}}),this.exportProgress=80,this.exportMessage="Exportando modelo...",await this.exportModel(s,"puerta_tamesis_textured.glb"),this.exportProgress=100,this.exportMessage="Exportación completada!",this.showStatus("Puerta exportada exitosamente!","success")}catch(i){console.error("Error exportando puerta:",i),this.showStatus("Error al exportar puerta: "+i.message,"error")}finally{setTimeout(()=>{this.isExporting=!1,this.currentExport=null,this.exportProgress=0,this.exportMessage=""},2e3)}},async exportGriferia(i){this.isExporting=!0,this.currentExport=i==="cepillado"?"griferiaC":"griferiaN",this.exportProgress=10,this.exportMessage=`Cargando grifería ${i}...`;try{const e=i==="normal"?"/models/grifo.glb":"/models/grifo_cepillado.glb",s=new k;this.dracoLoader&&s.setDRACOLoader(this.dracoLoader),s.setMeshoptDecoder(D);const t=(await s.loadAsync(e)).scene;this.exportProgress=60,this.exportMessage="Exportando modelo...",await this.exportModel(t,`grifo_${i}.glb`),this.exportProgress=100,this.exportMessage="Exportación completada!",this.showStatus(`Grifería ${i} exportada exitosamente!`,"success")}catch(e){console.error("Error exportando grifería:",e),this.showStatus("Error al exportar grifería: "+e.message,"error")}finally{setTimeout(()=>{this.isExporting=!1,this.currentExport=null,this.exportProgress=0,this.exportMessage=""},2e3)}},async exportSofa(i){this.isExporting=!0,this.currentExport=`sofa${i}`,this.exportProgress=10,this.exportMessage=`Cargando sofá variante ${i}...`;try{const e=new k;this.dracoLoader&&e.setDRACOLoader(this.dracoLoader),e.setMeshoptDecoder(D);const n=(await e.loadAsync("/models/sofa.glb")).scene;this.exportProgress=30,this.exportMessage="Cargando texturas...";
1const t=await this.loadTextureWithFallback("/models/AO/sofa_aoMap",!1),r=[{objectName:"brazo",textureName:"teca"},{objectName:"t",textureName:i},{objectName:"estructura",textureName:"aluminio-c-56-gris-metalizado"}];this.exportProgress=50,this.exportMessage="Aplicando texturas...";for(const{objectName:o,textureName:a}of r){const c=n.getObjectByName(o);if(!c)continue;const l=await this.getSofaTextures(a);c.material&&(c.material.map=l.map,c.material.normalMap=l.normalMap,c.material.roughnessMap=l.roughnessMap,c.material.metalnessMap=l.metalnessMap,c.material.sheenColorMap=l.sheenColorMap,c.material.sheenRoughnessMap=l.sheenRoughnessMap,t&&(c.material.aoMap=t,c.material.aoMapIntensity=1),(l.sheenColorMap||l.sheenRoughnessMap)&&(c.material.sheen=1,c.material.sheenColor=new le(16777215)),c.material.needsUpdate=!0)}n.traverse(o=>{o.isMesh&&!o.geometry.attributes.uv2&&o.geometry.attributes.uv&&o.geometry.setAttribute("uv2",o.geometry.attributes.uv)}),this.exportProgress=80,this.exportMessage="Exportando modelo...",await this.exportModel(n,`sofa_${i}.glb`),this.exportProgress=100,this.exportMessage="Exportación completada!",this.showStatus(`Sofá variante ${i} exportado exitosamente!`,"success")}catch(e){console.error("Error exportando sofá:",e),this.showStatus("Error al exportar sofá: "+e.message,"error")}finally{setTimeout(()=>{this.isExporting=!1,this.currentExport=null,this.exportProgress=0,this.exportMessage=""},2e3)}},async exportAuralis(i){this.isExporting=!0,this.currentExport=`auralis${i[0].toUpperCase()}`,this.exportProgress=10,this.exportMessage=`Cargando Auralis ${i}...`;try{const e=new k;this.dracoLoader&&e.setDRACOLoader(this.dracoLoader),e.setMeshoptDecoder(D);const n=(await e.loadAsync("/models/Auralis.glb")).scene;this.exportProgress=30,this.exportMessage="Cargando texturas...";const t=await this.getAuralisTextures(i);this.exportProgress=60,this.exportMessage="Aplicando texturas...",n.traverse(r=>{r.isMesh&&(!r.geometry.attributes.uv2&&r.geometry.attributes.uv&&r.geometry.setAttribute("uv2",r.geometry.attributes.uv),r.material&&(r.material.map=t.map,r.material.normalMap=t.normalMap,r.material.roughnessMap=t.roughnessMap,r.material.metalnessMap=t.metalnessMap,r.material.needsUpdate=!0))}),this.exportProgress=80,this.exportMessage="Exportando modelo...",await this.exportModel(n,`auralis_${i}.glb`),this.exportProgress=100,this.exportMessage="Exportación completada!",this.showStatus(`Auralis ${i} exportado exitosamente!`,"success")}catch(e){console.error("Error exportando Auralis:",e),this.showStatus("Error al exportar Auralis: "+e.message,"error")}finally{setTimeout(()=>{this.isExporting=!1,this.currentExport=null,this.exportProgress=0,this.exportMessage=""},2e3)}},async exportAllGriferias(){this.currentExport="griferiaAll",await this.exportGriferia("cepillado"),await new Promise(i=>setTimeout(i,1e3)),await this.exportGriferia("normal")},async exportAllSofas(){this.currentExport="sofaAll",await this.exportSofa("1289"),await new Promise(i=>setTimeout(i,1e3)),await this.exportSofa("1281"),await new Promise(i=>setTimeout(i,1e3)),await this.exportSofa("1297")},async exportAllAuralis(){this.currentExport="auralisAll",await this.exportAuralis("bourdeaux"),await new Promise(i=>setTimeout(i,1e3)),await this.exportAuralis("forest"),await new Promise(i=>setTimeout(i,1e3)),await this.exportAuralis("sand")},async exportAll(){this.currentExport="all",this.showStatus("Comenzando exportación de todos los modelos...","info"),await this.exportPuerta(),await new Promise(i=>setTimeout(i,1e3)),await this.exportAllGriferias(),await new Promise(i=>setTimeout(i,1e3)),await this.exportAllSofas(),await new Promise(i=>setTimeout(i,1e3)),await this.exportAllAuralis(),this.showStatus("¡Todos los modelos han sido exportados exitosamente!","success"),this.currentExport=null},showStatus(i,e){this.statusMessage=i,this.statusType=e,setTimeout(()=>{this.statusMessage=""},5e3)}}},it={class:"model-exporter"},at={class:"exporter-container"},ct={class:"export-sections"},lt={class:"export-section"},ut=["disabled"],pt={class:"export-section"},ht={class:"button-group"},ft=["disabled"],dt=["disabled"],xt=["disabled"],gt={class:"export-section"},mt={class:"button-group"},yt=["disabled"],Mt=["disabled"],Tt=["disabled"],wt=["disabled"],Et={class:"export-section"},At={class:"button-group"},bt=["disabled"],Rt=["disabled"],It=["disabled"],St=["disabled"],Lt={class:"export-section"},_t=["disabled"],Ct={key:0,class:"progress-container"},Nt={class:"progress-bar"},Ut={class:"progress-text"};function Ft(i,e,s,n,t,r){return K(),j("div",it,[M("div",at,[e[17]||(e[17]=M("h1",null,"Model Exporter",-1)),e[18]||(e[18]=M("p",{class:"description"}," Exporta los modelos 3D con las texturas ya aplicadas (baked). Los archivos se descargarán automáticamente. ",-1)),M("div",ct,[M("div",lt,[e[13]||(e[13]=M("h2",null,"Puerta Tamesis",-1)),M("button",{onClick:e[0]||(e[0]=(...o)=>r.exportPuerta&&r.exportPuerta(...o)),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="puerta"?"Exportando...":"Exportar Puerta"),9,ut)]),M("div",pt,[e[14]||(e[14]=M("h2",null,"Grifería",-1)),M("div",ht,[M("button",{onClick:e[1]||(e[1]=o=>r.exportGriferia("cepillado")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="griferiaC"?"Exportando...":"Cepillado"),9,ft),M("button",{onClick:e[2]||(e[2]=o=>r.exportGriferia("normal")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="griferiaN"?"Exportando...":"Normal"),9,dt),M("button",{onClick:e[3]||(e[3]=(...o)=>r.exportAllGriferias&&r.exportAllGriferias(...o)),disabled:t.isExporting,class:"export-button export-all"},b(t.isExporting&&t.currentExport==="griferiaAll"?"Exportando...":"Exportar Todo"),9,xt)])]),M("div",gt,[e[15]||(e[15]=M("h2",null,"Sofá",-1)),M("div",mt,[M("button",{onClick:e[4]||(e[4]=o=>r.exportSofa("1289")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="sofa1289"?"Exportando...":"Variante 1289"),9,yt),M("button",{onClick:e[5]||(e[5]=o=>r.exportSofa("1281")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="sofa1281"?"Exportando...":"Variante 1281"),9,Mt),M("button",{onClick:e[6]||(e[6]=o=>r.exportSofa("1297")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="sofa1297"?"Exportando...":"Variante 1297"),9,Tt),M("button",{onClick:e[7]||(e[7]=(...o)=>r.exportAllSofas&&r.exportAllSofas(...o)),disabled:t.isExporting,class:"export-button export-all"},b(t.isExporting&&t.currentExport==="sofaAll"?"Exportando...":"Exportar Todo"),9,wt)])]),M("div",Et,[e[16]||(e[16]=M("h2",null,"Auralis",-1)),M("div",At,[M("button",{onClick:e[8]||(e[8]=o=>r.exportAuralis("bourdeaux")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="auralisB"?"Exportando...":"Bourdeaux"),9,bt),M("button",{onClick:e[9]||(e[9]=o=>r.exportAuralis("forest")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="auralisF"?"Exportando...":"Forest"),9,Rt),M("button",{onClick:e[10]||(e[10]=o=>r.exportAuralis("sand")),disabled:t.isExporting,class:"export-button"},b(t.isExporting&&t.currentExport==="auralisS"?"Exportando...":"Sand"),9,It),M("button",{onClick:e[11]||(e[11]=(...o)=>r.exportAllAuralis&&r.exportAllAuralis(...o)),disabled:t.isExporting,class:"export-button export-all"},b(t.isExporting&&t.currentExport==="auralisAll"?"Exportando...":"Exportar Todo"),9,St)])]),M("div",Lt,[M("button",{onClick:e[12]||(e[12]=(...o)=>r.exportAll&&r.exportAll(...o)),disabled:t.isExporting,class:"export-button export-all-models"},b(t.isExporting&&t.currentExport==="all"?"Exportando Todo...":"EXPORTAR TODOS LOS MODELOS"),9,_t)])]),t.exportProgress?(K(),j("div",Ct,[M("div",Nt,[M("div",{class:"progress-fill",style:Le({width:`${t.exportProgress}%`})},null,4)]),M("p",Ut,b(t.exportMessage),1)])):ne("",!0),t.statusMessage?(K(),j("div",{key:1,class:_e(["status-message",t.statusType])},b(t.statusMessage),3)):ne("",!0)])])}const Pt=Se(ot,[["render",Ft],["__scopeId","data-v-70ea8170"]]);export{Pt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.