first commit
This commit is contained in:
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+2
@@ -0,0 +1,2 @@
|
||||
import{L as z,F as I,B as H,C as P,a as G,V as _,b as N}from"./three.module-BB51Dq4E.js";class O extends z{constructor(h){super(h)}load(h,T,V,y){const b=this,m=new I(this.manager);m.setPath(this.path),m.setResponseType("arraybuffer"),m.setRequestHeader(this.requestHeader),m.setWithCredentials(this.withCredentials),m.load(h,function(v){try{T(b.parse(v))}catch(A){y?y(A):console.error(A),b.manager.itemError(h)}},V,y)}parse(h){function T(t){const e=new DataView(t),o=32/8*3+32/8*3*3+16/8,a=e.getUint32(80,!0);if(80+32/8+a*o===e.byteLength)return!0;const i=[115,111,108,105,100];for(let s=0;s<5;s++)if(V(i,e,s))return!1;return!0}function V(t,e,o){for(let a=0,f=t.length;a<f;a++)if(t[a]!==e.getUint8(o+a))return!1;return!0}function y(t){const e=new DataView(t),o=e.getUint32(80,!0);let a,f,i,s=!1,w,S,C,L,U;for(let n=0;n<70;n++)e.getUint32(n,!1)==1129270351&&e.getUint8(n+4)==82&&e.getUint8(n+5)==61&&(s=!0,w=new Float32Array(o*3*3),S=e.getUint8(n+6)/255,C=e.getUint8(n+7)/255,L=e.getUint8(n+8)/255,U=e.getUint8(n+9)/255);const g=84,r=50,c=new H,p=new Float32Array(o*3*3),d=new Float32Array(o*3*3),x=new P;for(let n=0;n<o;n++){const F=g+n*r,D=e.getFloat32(F,!0),B=e.getFloat32(F+4,!0),R=e.getFloat32(F+8,!0);if(s){const l=e.getUint16(F+48,!0);(l&32768)===0?(a=(l&31)/31,f=(l>>5&31)/31,i=(l>>10&31)/31):(a=S,f=C,i=L)}for(let l=1;l<=3;l++){const E=F+l*12,u=n*3*3+(l-1)*3;p[u]=e.getFloat32(E,!0),p[u+1]=e.getFloat32(E+4,!0),p[u+2]=e.getFloat32(E+8,!0),d[u]=D,d[u+1]=B,d[u+2]=R,s&&(x.set(a,f,i).convertSRGBToLinear(),w[u]=x.r,w[u+1]=x.g,w[u+2]=x.b)}}return c.setAttribute("position",new G(p,3)),c.setAttribute("normal",new G(d,3)),s&&(c.setAttribute("color",new G(w,3)),c.hasColors=!0,c.alpha=U),c}function b(t){const e=new H,o=/solid([\s\S]*?)endsolid/g,a=/facet([\s\S]*?)endfacet/g,f=/solid\s(.+)/;let i=0;const s=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,w=new RegExp("vertex"+s+s+s,"g"),S=new RegExp("normal"+s+s+s,"g"),C=[],L=[],U=[],g=new _;let r,c=0,p=0,d=0;for(;(r=o.exec(t))!==null;){p=d;const x=r[0],n=(r=f.exec(x))!==null?r[1]:"";for(U.push(n);(r=a.exec(x))!==null;){let B=0,R=0;const l=r[0];for(;(r=S.exec(l))!==null;)g.x=parseFloat(r[1]),g.y=parseFloat(r[2]),g.z=parseFloat(r[3]),R++;for(;(r=w.exec(l))!==null;)C.push(parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3])),L.push(g.x,g.y,g.z),B++,d++;R!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+i),B!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+i),i++}const F=p,D=d-p;e.userData.groupNames=U,e.addGroup(F,D,c),c++}return e.setAttribute("position",new N(C,3)),e.setAttribute("normal",new N(L,3)),e}function m(t){return typeof t!="string"?new TextDecoder().decode(t):t}function v(t){if(typeof t=="string"){const e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o)&255;return e.buffer||e}else return t}const A=v(h);return T(A)?y(A):b(m(h))}}export{O as STLLoader};
|
||||
//# sourceMappingURL=STLLoader-C7hGonJR.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
+2
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
+916
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+2
@@ -0,0 +1,2 @@
|
||||
function c(r){r.computeBoundingBox();const t=r.boundingBox?.min,e=r.boundingBox?.max;return!t||!e?{min:[0,0,0],max:[0,0,0]}:{min:[t.x,t.y,t.z],max:[e.x,e.y,e.z]}}const l=Math.PI/4;function f(r,t){const e=r.clone();e.deleteAttribute?.("normal");const o=typeof t=="function"?t(e,l):e;return o!==e&&e.dispose?.(),o.getAttribute("normal")||o.computeVertexNormals?.(),o}function u(r,t){const e=r.getIndex?.();if(e?.count>0)return new Uint32Array(e.array);const o=new Uint32Array(t);for(let n=0;n<t;n+=1)o[n]=n;return o}function d(r,{toCreasedNormals:t}={}){const e=f(r,t),o=r.getAttribute("position"),n=e.getAttribute("position"),s=e.getAttribute("normal");try{if(!o||o.itemSize!==3||!n||n.itemSize!==3)throw new Error("STL geometry is missing vertex positions");const a=n.count;return{vertices:new Float32Array(n.array),indices:u(e,a),normals:s?.itemSize===3?new Float32Array(s.array):new Float32Array(n.array.length),colors:new Float32Array(0),edge_indices:new Uint32Array(0),bounds:c(r),parts:[],has_source_colors:!1,sourceColor:"",sourceFormat:"stl"}}finally{e.dispose?.()}}async function y(r){const[{STLLoader:t},{toCreasedNormals:e}]=await Promise.all([import("./STLLoader-C7hGonJR.js"),import("./BufferGeometryUtils-xu92ooFc.js")]),n=new t().parse(r);try{return d(n,{toCreasedNormals:e})}finally{n.dispose?.()}}function m(r){const t=[r?.vertices?.buffer,r?.indices?.buffer,r?.normals?.buffer,r?.colors?.buffer,r?.edge_indices?.buffer,r?.surfaceEdgeBarycentric?.buffer,r?.surfaceEdgeClass?.buffer,r?.guide_line_segments?.buffer].filter(e=>e instanceof ArrayBuffer&&e.byteLength>0);return[...new Set(t)]}const i=new Map;function b(r,t){return new Error(`Failed to fetch ${r}: ${t.status} ${t.statusText}`)}async function g(r,t){const e=await fetch(r,{signal:t});if(!e.ok)throw b(r,e);return e.arrayBuffer()}self.addEventListener("message",async r=>{const t=r.data||{},e=t.id;if(!e)return;if(t.type==="cancel"){i.get(e)?.abort(),i.delete(e);return}if(t.type!=="loadStl")return;const o=new AbortController;i.set(e,o);try{const n=await g(t.url,o.signal),s=await y(n);if(o.signal.aborted)return;self.postMessage({id:e,ok:!0,meshData:s},m(s))}catch(n){o.signal.aborted||self.postMessage({id:e,ok:!1,error:{name:n?.name||"Error",message:n instanceof Error?n.message:String(n)}})}finally{i.delete(e)}});
|
||||
//# sourceMappingURL=stlMeshWorker-0yVf-FuZ.js.map
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+3683
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+9
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+4053
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+52
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Browse cached CAD parts, assemblies, and prompt-ready references" />
|
||||
<title>CAD Viewer</title>
|
||||
<script>
|
||||
(function () {
|
||||
const root = document.documentElement;
|
||||
const storageKey = "cad-viewer:color-scheme";
|
||||
const prefersDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
let preference = "system";
|
||||
try {
|
||||
const storedPreference = window.localStorage && window.localStorage.getItem(storageKey);
|
||||
if (storedPreference === "light" || storedPreference === "dark" || storedPreference === "system") {
|
||||
preference = storedPreference;
|
||||
}
|
||||
} catch {
|
||||
preference = "system";
|
||||
}
|
||||
const mode = preference === "system" ? (prefersDark ? "dark" : "light") : preference;
|
||||
root.dataset.themePreference = preference;
|
||||
root.dataset.theme = mode;
|
||||
root.classList.toggle("dark", mode === "dark");
|
||||
root.style.colorScheme = mode;
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/assets/index-BkFzql5p.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/vendor-react-7jnMmQ9s.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/vendor-ui-CtsphK4U.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/vendor-icons-FFp724MI.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/vendor-three-SYzIooV9.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-vRirKMey.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user