1 line
5.6 KiB
JavaScript
1 line
5.6 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,707772,e=>{"use strict";var t=e.i(843476);e.i(958123);var i=e.i(191493),r=e.i(279278);e.i(592888);var o=e.i(639001),n=e.i(271645),a=e.i(190072);function l(e,t,l){let s=(0,r.useLiveNodeOverrides)(e=>t?e.get(t.id)?.trim:void 0),f=(0,n.useMemo)(()=>t&&s?{...t,trim:s}:t,[t,s]);!function(e){if(!e)return;let t=(0,i.normalizeRoofSegmentTrim)(e);JSON.stringify([e.width,e.depth,t.left,t.right,t.front,t.back,t.frontLeftX,t.frontLeftZ,t.frontRightX,t.frontRightZ,t.backLeftX,t.backLeftZ,t.backRightX,t.backRightZ])}(f),l.elements.join(",");let u=(0,n.useMemo)(()=>{let t;if(!e||!f||!((t=(0,i.normalizeRoofSegmentTrim)(f)).left>0)&&!(t.right>0)&&!(t.front>0)&&!(t.back>0)&&!(t.frontLeftX>0)&&!(t.frontLeftZ>0)&&!(t.frontRightX>0)&&!(t.frontRightZ>0)&&!(t.backLeftX>0)&&!(t.backLeftZ>0)&&!(t.backRightX>0)&&!(t.backRightZ>0))return null;let r=e.clone();r.applyMatrix4(l);let n=(0,o.clipGeometryBySegmentTrim)(r,f);if(!n)return null;let s=new a.Matrix4().copy(l).invert();n.applyMatrix4(s),n.computeVertexNormals();let u=e.groups.reduce((e,t)=>Math.max(e,t.materialIndex??0),0);for(let e of n.groups)(e.materialIndex??0)>u&&(e.materialIndex=u);return n},[e,l,f]);return(0,n.useEffect)(()=>()=>{u?.dispose()},[u]),u??e}let s=new a.Matrix4,f=new a.Vector3,u=new a.Quaternion,m=new a.Euler,c=new a.Vector3(1,1,1);e.s(["TrimClippedMesh",0,function({geometry:e,segment:i,parentToSegment:r,position:o=[0,0,0],rotation:d=[0,0,0],material:g,name:h,castShadow:p,receiveShadow:R}){let v=l(e,i,(0,n.useMemo)(()=>(m.set(d[0],d[1],d[2]),u.setFromEuler(m),f.set(o[0],o[1],o[2]),s.compose(f,u,c),new a.Matrix4().multiplyMatrices(r,s)),[r,o[0],o[1],o[2],d[0],d[1],d[2]]));return(0,t.jsx)("mesh",{castShadow:p,geometry:v??e,material:g,name:h,position:o,receiveShadow:R,rotation:d})},"useSegmentTrimClippedGeometry",0,l])},44104,e=>{"use strict";e.i(958123);var t=e.i(318275),i=e.i(191493);e.s(["RIDGE_LIFT",0,.09,"resolveRidgeSnap",0,function(e,r,o){let n=e.roofType??"gable";if("flat"===n)return null;let a="shed"===n?function(e){let{minX:t,maxX:r,minZ:o}=(0,i.getRoofSegmentVisibleTopBounds)(e);return[{start:[t,o],end:[r,o]}]}(e):(0,t.getRidgeVentLinesForSegment)(e).map(({start:e,end:t})=>({start:e,end:t}));if(0===a.length)return null;let l=null,s=1/0;for(let e of a){let[t,i]=e.start,[n,a]=e.end,f=n-t,u=a-i,m=f*f+u*u,c=m<=1e-8?0:Math.max(0,Math.min(1,((r-t)*f+(o-i)*u)/m)),d=t+f*c,g=i+u*c,h=(r-d)**2+(o-g)**2;h<s&&(s=h,l={localX:d,localZ:g,rotation:Math.atan2(-u,f)})}return l}])},35397,e=>{"use strict";var t=e.i(843476);e.i(958123);var i=e.i(17826),r=e.i(191493),o=e.i(279278),n=e.i(312580),a=e.i(34731);e.i(592888);var l=e.i(961081),s=e.i(952081),f=e.i(853273),u=e.i(810741),m=e.i(271645),c=e.i(190072),d=e.i(44104),g=e.i(865181),h=e.i(707772),p=e.i(317058);e.s(["default",0,({node:e})=>{let R=(0,m.useRef)(null);(0,n.useRegistry)(e.id,"ridge-vent",R);let v=(0,f.useNodeEvents)(e,"ridge-vent"),M=(0,u.useViewer)(e=>e.shading),S=(0,u.useViewer)(e=>e.textures),b=(0,u.useViewer)(e=>e.colorPreset),w=(0,u.useViewer)(e=>e.sceneTheme),L=(0,o.useLiveNodeOverrides)(t=>t.get(e.id)),T=L?{...e,...L}:e,k=T.position??[0,0,0],x=(0,a.useScene)(e=>T.roofSegmentId?e.nodes[T.roofSegmentId]:void 0),y=(0,o.useLiveNodeOverrides)(e=>T.roofSegmentId?e.get(T.roofSegmentId):void 0),I=x?y?{...x,...y}:x:void 0,V=(0,a.useScene)(e=>x?.parentId?e.nodes[x.parentId]:void 0),X=function(e){if(!e)return"none";let t=e.trim;return[e.roofType,e.width,e.depth,e.wallHeight,e.pitch,e.wallThickness,e.deckThickness,e.overhang,e.shingleThickness,e.gambrelLowerWidthRatio,e.gambrelLowerHeightRatio,e.mansardSteepWidthRatio,e.mansardSteepHeightRatio,e.dutchHipWidthRatio,e.dutchHipHeightRatio,t.left,t.right,t.front,t.back,t.frontLeft,t.frontRight,t.backLeft,t.backRight,t.frontLeftX,t.frontLeftZ,t.frontRightX,t.frontRightZ,t.backLeftX,t.backLeftZ,t.backRightX,t.backRightZ].join("|")}(I),Z=T.rotation??0,E=(0,m.useMemo)(()=>I&&1e-5>Math.abs(Z)?(0,d.resolveRidgeSnap)(I,k[0]??0,k[2]??0):null,[I,Z,k[0],k[2]]),P=E?E.localX:k[0]??0,F=E?E.localZ:k[2]??0,j=(0,m.useMemo)(()=>({...T,position:[P,k[1]??0,F]}),[T,P,F,k[1]]),G=(0,m.useMemo)(()=>(0,p.buildRidgeVentGeometry)(j,I),[j.length,j.width,j.height,j.style,j.endCaps,j.rotation,j.position[0],j.position[2],X]);(0,m.useEffect)(()=>()=>G.dispose(),[G]);let C=(0,m.useMemo)(()=>{let e=()=>{let e=V?(0,i.getEffectiveRoofSurfaceMaterial)(V,"top"):void 0,t=I?(0,r.getEffectiveSegmentSurfaceMaterial)(I,"top",e):null;if("string"==typeof t?.materialPreset){let e=(0,l.createMaterialFromPresetRef)(t.materialPreset,M);if(e)return e}if(t?.material!==void 0)return(0,l.createMaterial)(t.material,M);let o=V?(0,s.getRoofMaterialArray)(V,M,S,b,w):null;return o?.[3]??(0,l.createSurfaceRoleMaterial)("roof",b,c.FrontSide,w)};return T.material?(0,l.createMaterial)(T.material,M):T.materialPreset?(0,l.createMaterialFromPresetRef)(T.materialPreset,M)??e():e()},[S,b,w,M,T.material,T.materialPreset,I,V]),H=(0,m.useMemo)(()=>{if(!I)return new c.Matrix4;let e=(0,g.getRoofTopSurfaceY)(P,F,I),t=Math.max(-2,Math.min(2,k[1]??0)),i=e+d.RIDGE_LIFT+t;return new c.Matrix4().compose(new c.Vector3(P,i,F),new c.Quaternion().setFromAxisAngle(new c.Vector3(0,1,0),Z),new c.Vector3(1,1,1))},[I,P,F,Z,k[1]]),N=(0,h.useSegmentTrimClippedGeometry)(G,I,H);if(!I)return null;let O=I.position??[0,0,0],A=I.rotation??0,B=(0,g.getRoofTopSurfaceY)(P,F,I),D=Math.max(-2,Math.min(2,k[1]??0)),W=B+d.RIDGE_LIFT+D;return(0,t.jsx)("group",{position:O,"rotation-y":A,children:(0,t.jsx)("group",{position:[P,W,F],ref:R,"rotation-y":Z,visible:T.visible,children:(0,t.jsx)("mesh",{castShadow:!0,geometry:N??G,material:C,name:"ridge-vent-surface",receiveShadow:!0,...v})})})}])}]); |