From ad344978130f43183bb61954ab6a349f8176a692 Mon Sep 17 00:00:00 2001 From: cyber Date: Mon, 16 Nov 2026 08:36:12 -0400 Subject: [PATCH] feat(FenceViewer3D): render solid visible diamond chain-link wire lattice and 3D rolled fence bundle --- public/images/chainlink-galvanizado.png | Bin 0 -> 4264 bytes public/images/chainlink-preto.png | Bin 0 -> 4282 bytes public/images/chainlink-pvc-verde.png | Bin 0 -> 4274 bytes src/components/FenceViewer3D.tsx | 349 +++++++++++++++--------- 4 files changed, 224 insertions(+), 125 deletions(-) create mode 100644 public/images/chainlink-galvanizado.png create mode 100644 public/images/chainlink-preto.png create mode 100644 public/images/chainlink-pvc-verde.png diff --git a/public/images/chainlink-galvanizado.png b/public/images/chainlink-galvanizado.png new file mode 100644 index 0000000000000000000000000000000000000000..5f3e3bea459336c1b39f43cfc7afee20480d22de GIT binary patch literal 4264 zcmeHL`&$#&)}9Or2?R($?t&qr2NV=ay?_V_BodUWs8vB!q9V}NBjT;JTqcBDIMT!Q zp!EVltXNS&K(V3>m{x*F30m)$fJzM_5@IwYB(uK_-}xuL=lOn0-dSt!cg;Mr*LvS6 zj9w$Kwsf^b5X5?AB!4}EklduO`OKfgA<>eZ%&MhDGat;3(km_bOQX!5{^yFb)NI#Sans?sIQIs0sFe@IVH zF9#E!O?6szpAsvS$ooJhelVou2>W8c&ZVkSDf+=Ua{x08&QS(C~&{yL_MYPb61={IW&d=`tdr9)nbZowb41F zzP|a@#7E&En173z(6N7Fn8oq|kA@fm$6q^{s#oK8)`Dv>2K-^xleQS^d@i+5mSyOY zJq5B8A}f;3OVEew#~o?6-v6Pq5J{1ndIw~MBAJ2AB=3k<}`y3Xw2SRwtNBb)?%J* zfJbS3{`f9iz7SYxIr%^ap{j`O97e>dI5^k<;lx*L=N0YdTBXfta3A7AmvH~Gj0Gx; z^);AJ@dyymBFY;qObt2j<1Zro+cupN&6OG;P?+i+Me<{8=Z)?Df3Waqp(6tyLSj7x990t6OC-Ym*m;6~`U_9EJ0i=z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O7JoA>A=aLtzz;YMk6#67*iqlo`jDvsy*$vVHp~aM~0^3N@?e226w*q%RM_^9K z(6by@@lc;Og?bwFXsCB|q)~muv+7IKe~^duXN?{uRo_>bq#(1UTGvy+32k37mMhFWYG*om6j(Co+E+UB>xJf88V3x<#Ta!bQ~}U^EQM*Nu=yl|uIm{zve8*?w7Fc6nr3KlM25O% z#G+bO@zH5n z@5`H-n|l1eGhZ{_IPreMRa;ze6+E~vswgh}!zcT;@;=UZ3SB%`|2XC-V%k+Z48XF# XTt=S|?{>g15Xj0EYxtMKh2sAKsm4b? literal 0 HcmV?d00001 diff --git a/public/images/chainlink-preto.png b/public/images/chainlink-preto.png new file mode 100644 index 0000000000000000000000000000000000000000..e3a0707c2d5ae53c8be8a5642d2875289308389f GIT binary patch literal 4282 zcmX9?c|a4__MU`5LINaEr7BAjfg*^2Ka`4~lL!iKPqZi~YJ%FRl^VCFR56nv5Eqn$ z#Xz+LYb!ocz@q4LA<$IW3)HIM(tsoiDuTlr80Nkket#ur&i&50cXG~mzME6g|BAF{ z&R`-4V!u2pVjY4|;8zO5uz??&4_uWX2uHCzLKu^DvG=FB=UzQ_UTQeBE6K{n&f8|n zE~|78sqmDORm%3#?iwyt_H#u1z8y&}kLeE-?4mKn=I{PIq`vO^?AX7hPZy~rf3J25 z8+rZqPoMH4$&;=bz0 zS+u!HZ0tjq2~GcpltwC#F)7aO`T!7?G^)$@q1h!l=!mW^6R4QD^esPRN=jwK1H1wC zFCeA=6+QF!Q!Z&y*6L;E8vRS4zaVE)99ppf?Szh~aq2|JedJ353mo+#e1SQWUk^Uj z$eGm(mN{T`T_%Gj3f#BeH~33=t|^*PFPKJVy{pr)TS+#n<6|9DC{m^CjAq=RaU|EU zIuiLzA(x}n?FhjQ%C+PfW=CQIvwFS?KKTL1&Z@~XaLpyA(8W$K`famWy8RZ2zn4=! zC9RNq*>vG`fN9QBa$L~?Bv&{Yh){<6gU^Mdx?cnKM>F0C)Y8MiiEYlbssl}{_$O)0 z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FXxW;OVyyJcUmV(FnEgo6{@)P7Ul5# zXuwAH1&{zY9ZcK((+qMyFIUhL-1rvTMaesB3;Bh9#VM~9^iu=R*h7n*?v(cwjiBT` zN)_lcSqE$zKXR`ijmZ|eq2HuQM%e2S$zn)S1M)cP?GFu#_uLYsaV))~OF1IB(z%oR zAKE(Eis#u@?dT3l-VjWn{qk?8ye8DR?EBq|wy#o79F!k=EZ$?Ip3u8fJU4B%oktAF z4|%p^2@ipOYw?CJsrDebEEma!Q#o)pOOcLkjawmaLZM=CQwsDb+U-@UGXhS_jW*6HnYIo)w`kd|C#cFI?!jPwx_Tn$@SFl zTc#jm{od2Us|2U8T*0C#)>Z#U*j8`~zv&WrMbnchW%gK#53TmrXsm6H)fP+mx4rjw zhs*1y0_i`MK|#4y)61;o!Gu>sb2Wz=aTKn*Xtfch5dBu*+RYbSF2ZuF=I*nW&m$sV z27bd(_4h*+F|6=K{^%6(X|s~XVr`8IA7}+^{L_vv;Qg*!(cyTKDsU&WOgEL{d1|=J z=IL9J$$P?EPR5Q@81Sb{)>ZRh&YkwvvzEaK$&xq<&mNmoo+hR-$S-DVs#H{g3g8!# zH#i9A;ozd0)U%MagRF<@z$ zpt?1U?kNS6>U#@Iyv%$mKfDD3VT0YF=0P#=j58>h6z;zw8&ul7xwKd{I2b)4@|Wit zy(O&bsYab^1kfW9=xl|Hm%wOFVhc?7~r^-d|SI0kPJ?GPplOzrTRyf3k#RG1L5tDVh#kU(}qOU6_3 z_>d6Cz&beE+21iL&;}j%B&n@Hqhxlw#$CQYcC8?a@fUfX5b}DD8|UrgUxbhaL)yOUZOX?p&855<$q&g6XLgQUS>-T2%>WZC|M#-`5zSeV7dSR literal 0 HcmV?d00001 diff --git a/public/images/chainlink-pvc-verde.png b/public/images/chainlink-pvc-verde.png new file mode 100644 index 0000000000000000000000000000000000000000..069fb7d13b2114a00ab5c4be303029d59cc13884 GIT binary patch literal 4274 zcmeHL|6fw~8b2Tg_zh$(H7z7F%QD?uR=YX`T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IkuHtM0^ViWRqRNhpGzXDthJQbL_3pmJjeu1&m#|H(iG?=&_)%a3}dG zk$RM*c12|iDY^zrGQG@U3-TYm(7=frJPsI2Wk-BK`i$Kq)zmWoA~Y8%nFDhUMa@KB zm@4Z6shPA#!z03gbeGK}KUeTLyxoI5F9LrVnUke*LiSsdX(Xp=2skX7vf?Vj1T-cT zbu0T1=ITD_2nby$vwojx^G=fY>MqJzfGc=)Kp&(u5Co zbG%40aPNLV=tYES)Y#`M%LUAn|JM=!%{pSFMySv7xicju5>&Y&^JIrnlV5EEBla=P zx^LJOc(Y%w=wF$G=uhCvRZ@V4OWWsCJ{Q=%N8v-{Jbm$F&H^4`hmVv{9_iUemI6gr zPOGD0hieog_mumzI2zyuk*vjmzk$7^SYkO7F6vhI5$=?_s4ju3VW1ELiAZU2O990D z&c*eohz&nJ@-5ZNb4VN`gl$B_k5A;-_XEycmMzZ literal 0 HcmV?d00001 diff --git a/src/components/FenceViewer3D.tsx b/src/components/FenceViewer3D.tsx index 217f881..13ddaef 100644 --- a/src/components/FenceViewer3D.tsx +++ b/src/components/FenceViewer3D.tsx @@ -13,7 +13,7 @@ import { MessageCircle, Compass, AlertTriangle, - CheckCircle2 + Package } from "lucide-react"; import { generateWhatsAppQuoteUrl } from "@/lib/whatsapp"; @@ -23,47 +23,56 @@ export type FenceHeight = "1.50m" | "1.80m" | "2.00m" | "2.50m" | "3.00m"; export type GroundType = "terra" | "grama" | "concreto"; export type FenceLayout = "1_lance" | "2_lances" | "4_lances" | "canto_l"; -// Gerador de textura procedural perfeita para a malha losangular de Alambrado (Chain Link) -function createChainLinkTexture(colorHex: string, wireWidth: number = 3): THREE.CanvasTexture { - const canvas = document.createElement("canvas"); - canvas.width = 128; - canvas.height = 128; - const ctx = canvas.getContext("2d"); +// Construtor procedural de geometria de arames losangulares entrelaçados (Chain Link 45°) +function buildChainLinkGeometry(spanLength: number, height: number, spacing: number = 0.08): THREE.BufferGeometry { + const positions: number[] = []; + const s = spacing; + const L = spanLength; + const H = height; - if (ctx) { - ctx.clearRect(0, 0, 128, 128); + // Família 1: Linhas diagonais a +45° (y - x = c) + for (let c = -L; c <= H + s; c += s) { + const pts: [number, number][] = []; + if (c >= 0 && c <= H) pts.push([0, c]); + if (L + c >= 0 && L + c <= H) pts.push([L, L + c]); + if (-c >= 0 && -c <= L) pts.push([-c, 0]); + if (H - c >= 0 && H - c <= L) pts.push([H - c, H]); - // Linha do arame com efeito metálico / degradê - ctx.strokeStyle = colorHex; - ctx.lineWidth = wireWidth; - ctx.lineCap = "round"; - ctx.lineJoin = "round"; - - // Desenha losango central - ctx.beginPath(); - ctx.moveTo(64, 0); - ctx.lineTo(128, 64); - ctx.lineTo(64, 128); - ctx.lineTo(0, 64); - ctx.closePath(); - ctx.stroke(); - - // Linhas diagonais cruzadas nos 4 cantos para fechar o entrelaçamento contínuo - ctx.beginPath(); - ctx.moveTo(0, 0); ctx.lineTo(64, 64); - ctx.moveTo(128, 0); ctx.lineTo(64, 64); - ctx.moveTo(0, 128); ctx.lineTo(64, 64); - ctx.moveTo(128, 128); ctx.lineTo(64, 64); - ctx.stroke(); + const unique: [number, number][] = []; + for (const p of pts) { + if (!unique.some(u => Math.abs(u[0] - p[0]) < 1e-4 && Math.abs(u[1] - p[1]) < 1e-4)) { + unique.push(p); + } + } + if (unique.length === 2) { + positions.push(unique[0][0] - L / 2, unique[0][1], 0.002); + positions.push(unique[1][0] - L / 2, unique[1][1], 0.002); + } } - const texture = new THREE.CanvasTexture(canvas); - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.generateMipmaps = true; - texture.minFilter = THREE.LinearMipmapLinearFilter; - texture.magFilter = THREE.LinearFilter; - return texture; + // Família 2: Linhas diagonais a -45° (y + x = c) + for (let c = 0; c <= L + H + s; c += s) { + const pts: [number, number][] = []; + if (c >= 0 && c <= H) pts.push([0, c]); + if (c - L >= 0 && c - L <= H) pts.push([L, c - L]); + if (c >= 0 && c <= L) pts.push([c, 0]); + if (c - H >= 0 && c - H <= L) pts.push([c - H, H]); + + const unique: [number, number][] = []; + for (const p of pts) { + if (!unique.some(u => Math.abs(u[0] - p[0]) < 1e-4 && Math.abs(u[1] - p[1]) < 1e-4)) { + unique.push(p); + } + } + if (unique.length === 2) { + positions.push(unique[0][0] - L / 2, unique[0][1], -0.002); + positions.push(unique[1][0] - L / 2, unique[1][1], -0.002); + } + } + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute("position", new THREE.Float32BufferAttribute(positions, 3)); + return geometry; } export default function FenceViewer3D() { @@ -73,14 +82,14 @@ export default function FenceViewer3D() { // Estados const [fenceType, setFenceType] = useState("alambrado_curvo"); const [color, setColor] = useState("galvanizado"); - const [height, setHeight] = useState("2.00m"); + const [height, setHeight] = useState("1.80m"); const [ground, setGround] = useState("grama"); const [layout, setLayout] = useState("2_lances"); const [hasBarbedWire, setHasBarbedWire] = useState(true); const [hasConcertina, setHasConcertina] = useState(false); + const [showRoll, setShowRoll] = useState(true); const [autoRotate, setAutoRotate] = useState(false); const [webGLError, setWebGLError] = useState(false); - const [isLoaded, setIsLoaded] = useState(false); const cepInputId = useId(); const [cep, setCep] = useState(""); @@ -91,36 +100,32 @@ export default function FenceViewer3D() { // Mapeamento de cores const colorMap = { galvanizado: { - hex: "#b8c0c8", - threeHex: 0xb8c0c8, + hex: "#cbd5e1", + threeHex: 0xd1d5db, name: "Aço Galvanizado a Fogo (Zincado)", - metalness: 0.85, - roughness: 0.35, - postHex: 0x858990 + postHex: 0x8a8e96, + textureUrl: "/images/chainlink-galvanizado.png" }, verde: { - hex: "#225528", - threeHex: 0x225528, + hex: "#22c55e", + threeHex: 0x22c55e, name: "Revestido em PVC Verde Musgo (Quadras)", - metalness: 0.15, - roughness: 0.45, - postHex: 0x1f3621 + postHex: 0x1f3621, + textureUrl: "/images/chainlink-pvc-verde.png" }, preto: { - hex: "#1d1f22", - threeHex: 0x1d1f22, + hex: "#334155", + threeHex: 0x334155, name: "Revestido em PVC Preto Nobre", - metalness: 0.25, - roughness: 0.5, - postHex: 0x24272c + postHex: 0x24272c, + textureUrl: "/images/chainlink-preto.png" }, cinza: { - hex: "#5c6269", - threeHex: 0x5c6269, + hex: "#94a3b8", + threeHex: 0x94a3b8, name: "Revestido em PVC Cinza Urbano", - metalness: 0.3, - roughness: 0.4, - postHex: 0x484b50 + postHex: 0x484b50, + textureUrl: "/images/chainlink-galvanizado.png" }, }; @@ -148,10 +153,9 @@ export default function FenceViewer3D() { const fenceGroupRef = useRef(null); const groundMeshRef = useRef(null); - // 1. Inicialização do Three.js (com reutilização segura do Canvas sem duplicação) + // 1. Inicialização do Three.js useEffect(() => { if (!canvasRef.current || !containerRef.current) return; - const canvas = canvasRef.current; let renderer: THREE.WebGLRenderer; @@ -163,7 +167,7 @@ export default function FenceViewer3D() { powerPreference: "high-performance", }); } catch (e) { - console.warn("WebGL não suportado ou falhou na inicialização:", e); + console.warn("WebGL não suportado:", e); setWebGLError(true); return; } @@ -176,7 +180,7 @@ export default function FenceViewer3D() { renderer.shadowMap.enabled = true; renderer.shadowMap.type = THREE.PCFSoftShadowMap; renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.2; + renderer.toneMappingExposure = 1.25; rendererRef.current = renderer; const scene = new THREE.Scene(); @@ -185,7 +189,7 @@ export default function FenceViewer3D() { sceneRef.current = scene; const camera = new THREE.PerspectiveCamera(40, width / heightPx, 0.1, 100); - camera.position.set(4.8, 3.4, 6.2); + camera.position.set(4.8, 3.2, 5.8); cameraRef.current = camera; const controls = new OrbitControls(camera, canvas); @@ -194,11 +198,11 @@ export default function FenceViewer3D() { controls.maxPolarAngle = Math.PI / 2 - 0.02; controls.minDistance = 2.0; controls.maxDistance = 20.0; - controls.target.set(0, 1.1, 0); + controls.target.set(0, 1.0, 0); controlsRef.current = controls; - // Luzes - const ambientLight = new THREE.AmbientLight(0xffffff, 1.0); + // Iluminação + const ambientLight = new THREE.AmbientLight(0xffffff, 1.2); scene.add(ambientLight); const sunLight = new THREE.DirectionalLight(0xffffff, 2.5); @@ -206,10 +210,9 @@ export default function FenceViewer3D() { sunLight.castShadow = true; sunLight.shadow.mapSize.width = 1024; sunLight.shadow.mapSize.height = 1024; - sunLight.shadow.bias = -0.0005; scene.add(sunLight); - const fillLight = new THREE.DirectionalLight(0xa3c745, 0.4); + const fillLight = new THREE.DirectionalLight(0xa3c745, 0.5); fillLight.position.set(-6, 4, -4); scene.add(fillLight); @@ -235,9 +238,6 @@ export default function FenceViewer3D() { scene.add(fenceGroup); fenceGroupRef.current = fenceGroup; - setIsLoaded(true); - - // Loop let animId: number; const animate = () => { animId = requestAnimationFrame(animate); @@ -284,7 +284,7 @@ export default function FenceViewer3D() { } }, [ground]); - // 3. Renderização da Cerca em 3D + // 3. Renderização da Cerca em 3D + Rolo de Alambrado useEffect(() => { if (!fenceGroupRef.current || !sceneRef.current) return; const group = fenceGroupRef.current; @@ -296,19 +296,26 @@ export default function FenceViewer3D() { } const colConfig = colorMap[color]; - const wireColorHex = fenceType === "alambrado_pvc" ? "#225528" : colConfig.hex; + const wireColorHex = fenceType === "alambrado_pvc" ? 0x22c55e : colConfig.threeHex; - // Material de mourão + // Material dos mourões de concreto const postMat = new THREE.MeshStandardMaterial({ color: fenceType === "alambrado_curvo" ? 0x82868e : colConfig.postHex, roughness: 0.9, metalness: 0.1, }); + // Material dos arames guia de sustentação const steelGuideMat = new THREE.MeshStandardMaterial({ - color: 0x9ca3af, - metalness: 0.8, - roughness: 0.3, + color: 0xe2e8f0, + metalness: 0.9, + roughness: 0.25, + }); + + // Material de linhas sólidas visíveis para a tela de alambrado + const wireLineMat = new THREE.LineBasicMaterial({ + color: wireColorHex, + linewidth: 2, }); const spanLength = 2.5; // 2,50m entre mourões @@ -350,7 +357,7 @@ export default function FenceViewer3D() { spans.push({ startX: spanLength, startZ: 0, endX: spanLength, endZ: spanLength }); } - // --- MOURÕES --- + // --- MOURÕES DE CONCRETO (10x10cm) --- posts.forEach((p, idx) => { const postHeight = h + (isCurved ? 0.45 : 0.05); @@ -391,11 +398,16 @@ export default function FenceViewer3D() { } }); - // --- PAINÉIS DE TELA DE ALAMBRADO --- - // Textura procedural ultra-leve e realista (zero crash de contexto WebGL) - const meshTexture = createChainLinkTexture(wireColorHex, 3); + // --- CARREGADOR DE TEXTURA REALISTA --- + const texUrl = fenceType === "alambrado_pvc" ? "/images/chainlink-pvc-verde.png" : colConfig.textureUrl; + const textureLoader = new THREE.TextureLoader(); + const loadedTexture = textureLoader.load(texUrl); + loadedTexture.wrapS = THREE.RepeatWrapping; + loadedTexture.wrapT = THREE.RepeatWrapping; + const totalLines = h >= 2.0 ? 4 : 3; + // --- PAINÉIS DE TELA DE ALAMBRADO --- spans.forEach((span) => { const dx = span.endX - span.startX; const dz = span.endZ - span.startZ; @@ -404,10 +416,10 @@ export default function FenceViewer3D() { const cx = (span.startX + span.endX) / 2; const cz = (span.startZ + span.endZ) / 2; - // Fiadas horizontais de arame guia + // 1. Fiadas horizontais de arame guia (Tensionadores) for (let l = 1; l <= totalLines; l++) { const wireY = (h / (totalLines + 0.5)) * l; - const guideGeo = new THREE.CylinderGeometry(0.003, 0.003, len, 6); + const guideGeo = new THREE.CylinderGeometry(0.0035, 0.0035, len, 6); const guideMesh = new THREE.Mesh(guideGeo, steelGuideMat); guideMesh.rotation.z = Math.PI / 2; guideMesh.rotation.y = -angle; @@ -415,10 +427,10 @@ export default function FenceViewer3D() { group.add(guideMesh); } - // Fios farpados no mourão curvo + // 2. Fios farpados no mourão curvo if (isCurved && hasBarbedWire) { for (let b = 1; b <= 3; b++) { - const barbedGeo = new THREE.CylinderGeometry(0.0025, 0.0025, len, 6); + const barbedGeo = new THREE.CylinderGeometry(0.0028, 0.0028, len, 6); const barbedMesh = new THREE.Mesh(barbedGeo, steelGuideMat); barbedMesh.rotation.z = Math.PI / 2; barbedMesh.rotation.y = -angle; @@ -427,14 +439,14 @@ export default function FenceViewer3D() { } } - // Concertina opcional + // 3. Concertina opcional if (hasConcertina) { const concertinaRadius = 0.18; const coils = Math.floor(len * 5.5); const step = len / coils; for (let k = 0; k < coils; k++) { - const torusGeo = new THREE.TorusGeometry(concertinaRadius, 0.0028, 6, 18); + const torusGeo = new THREE.TorusGeometry(concertinaRadius, 0.003, 6, 18); const torusMesh = new THREE.Mesh(torusGeo, steelGuideMat); torusMesh.rotation.y = -angle + Math.PI / 2; const px = span.startX + Math.cos(angle) * (k * step + step / 2); @@ -445,30 +457,106 @@ export default function FenceViewer3D() { } } - // Plano da Tela de Alambrado com textura de malha losangular - const spanTexture = meshTexture.clone(); - spanTexture.needsUpdate = true; - const diamondScale = 0.055; // 50mm por losango - spanTexture.repeat.set(len / diamondScale, h / diamondScale); + // 4. ARAMES LOSANGULARES (SÓLIDOS 100% VISÍVEIS) + if (fenceType !== "gradil_3d") { + // Constrói os arames diagonais cruzados a 45° + const wireGeo = buildChainLinkGeometry(len, h, 0.08); + const wireSegments = new THREE.LineSegments(wireGeo, wireLineMat); + wireSegments.position.set(cx, 0, cz); + wireSegments.rotation.y = -angle; + group.add(wireSegments); - const planeGeo = new THREE.PlaneGeometry(len, h); - const planeMat = new THREE.MeshStandardMaterial({ - map: spanTexture, - transparent: true, - alphaTest: 0.15, - side: THREE.DoubleSide, - metalness: fenceType === "alambrado_pvc" ? 0.15 : 0.8, - roughness: fenceType === "alambrado_pvc" ? 0.5 : 0.35, - }); + // Plano com textura metálica sombreada de fundo + const spanTex = loadedTexture.clone(); + spanTex.needsUpdate = true; + spanTex.repeat.set(len / 0.10, h / 0.10); - const planeMesh = new THREE.Mesh(planeGeo, planeMat); - planeMesh.position.set(cx, h / 2, cz); - planeMesh.rotation.y = -angle; - planeMesh.castShadow = true; - group.add(planeMesh); + const planeGeo = new THREE.PlaneGeometry(len, h); + const planeMat = new THREE.MeshStandardMaterial({ + map: spanTex, + transparent: true, + alphaTest: 0.05, + side: THREE.DoubleSide, + metalness: fenceType === "alambrado_pvc" ? 0.2 : 0.85, + roughness: fenceType === "alambrado_pvc" ? 0.5 : 0.3, + }); + const planeMesh = new THREE.Mesh(planeGeo, planeMat); + planeMesh.position.set(cx, h / 2, cz); + planeMesh.rotation.y = -angle; + group.add(planeMesh); + } else { + // Modo Gradil 3D (Linha Complementar) + const vertSpacing = 0.05; + const numVert = Math.floor(len / vertSpacing); + const vertGeo = new THREE.CylinderGeometry(0.0025, 0.0025, h, 5); + for (let v = -numVert / 2; v <= numVert / 2; v++) { + const wire = new THREE.Mesh(vertGeo, steelGuideMat); + wire.position.set(cx + v * vertSpacing * Math.cos(angle), h / 2, cz + v * vertSpacing * Math.sin(angle)); + group.add(wire); + } + const numHoriz = Math.floor(h / 0.20); + const horizGeo = new THREE.CylinderGeometry(0.0025, 0.0025, len, 5); + for (let hz = 1; hz <= numHoriz; hz++) { + const wire = new THREE.Mesh(horizGeo, steelGuideMat); + wire.rotation.z = Math.PI / 2; + wire.rotation.y = -angle; + wire.position.set(cx, hz * 0.20, cz); + group.add(wire); + } + } }); - }, [fenceType, color, height, layout, hasBarbedWire, hasConcertina]); + // --- 5. ROLO DE TELA DE ALAMBRADO COMPACTADO (MODELO DE FÁBRICA) --- + // Conforme foto de referência: o rolo de tela fica em pé ao lado da cerca + if (showRoll && posts.length > 0) { + const rollRadius = 0.18; // Diâmetro de 36cm + const rollHeight = h; + const rollGroup = new THREE.Group(); + rollGroup.position.set(posts[0].x - 0.65, 0, 0.35); + + // Cilindro do rolo de tela + const rollTex = loadedTexture.clone(); + rollTex.needsUpdate = true; + rollTex.repeat.set(6, rollHeight / 0.08); + + const rollGeo = new THREE.CylinderGeometry(rollRadius, rollRadius, rollHeight, 24); + const rollMat = new THREE.MeshStandardMaterial({ + map: rollTex, + color: wireColorHex, + metalness: fenceType === "alambrado_pvc" ? 0.3 : 0.8, + roughness: 0.4, + }); + const rollMesh = new THREE.Mesh(rollGeo, rollMat); + rollMesh.position.y = rollHeight / 2; + rollMesh.castShadow = true; + rollGroup.add(rollMesh); + + // Faixa / Etiqueta central da fábrica (como na foto do cliente) + const labelGeo = new THREE.CylinderGeometry(rollRadius + 0.005, rollRadius + 0.005, 0.35, 24); + const labelMat = new THREE.MeshStandardMaterial({ + color: fenceType === "alambrado_pvc" ? 0x166534 : 0x0f766e, + roughness: 0.3, + }); + const labelMesh = new THREE.Mesh(labelGeo, labelMat); + labelMesh.position.y = rollHeight / 2; + rollGroup.add(labelMesh); + + // Arame de amarração do rolo (topo e base) + const tieGeo = new THREE.TorusGeometry(rollRadius + 0.008, 0.004, 6, 24); + const tieTop = new THREE.Mesh(tieGeo, steelGuideMat); + tieTop.rotation.x = Math.PI / 2; + tieTop.position.y = rollHeight * 0.85; + rollGroup.add(tieTop); + + const tieBot = new THREE.Mesh(tieGeo, steelGuideMat); + tieBot.rotation.x = Math.PI / 2; + tieBot.position.y = rollHeight * 0.15; + rollGroup.add(tieBot); + + group.add(rollGroup); + } + + }, [fenceType, color, height, layout, hasBarbedWire, hasConcertina, showRoll]); const setCameraView = (type: "geral" | "detalhe" | "topo") => { if (!cameraRef.current || !controlsRef.current) return; @@ -477,12 +565,12 @@ export default function FenceViewer3D() { switch (type) { case "geral": - cam.position.set(4.8, 3.4, 6.2); - ctrl.target.set(0, 1.1, 0); + cam.position.set(4.8, 3.2, 5.8); + ctrl.target.set(0, 1.0, 0); break; case "detalhe": - cam.position.set(0.8, 1.4, 1.5); - ctrl.target.set(0, 1.2, 0); + cam.position.set(0.6, 1.3, 1.4); + ctrl.target.set(0, 1.1, 0); break; case "topo": cam.position.set(0.1, 8.0, 0.1); @@ -512,7 +600,7 @@ export default function FenceViewer3D() { estimatedPosts: currentLayout.posts, estimatedWireKg, estimatedTensioners, - notes: `Simulação no site: ${hasBarbedWire ? "Com 3 fios de arame farpado" : "Sem arame farpado"}${hasConcertina ? " + Concertina" : ""}.`, + notes: `Simulação 3D no site: ${hasBarbedWire ? "Com 3 fios de arame farpado" : "Sem arame farpado"}${hasConcertina ? " + Concertina" : ""}.`, }); return ( @@ -534,7 +622,7 @@ export default function FenceViewer3D() {

- Gire em 360°, teste mourões retos ou curvos com arame farpado e receba a lista de rolos. + Gire em 360°, aproxime para inspecionar a malha losangular e veja o rolo compacto ao lado da cerca.

@@ -571,27 +659,25 @@ export default function FenceViewer3D() { {/* Grid: Canvas 3D (8 cols) + Controles (4 cols) */}
- {/* Canvas 3D Viewport com fallback visual garantido */} + {/* Canvas 3D Viewport */}
- {/* O CANVAS É DECLARATIVO E EXCLUSIVO (Zero duplicações ou broken image) */} - {/* Fallback caso WebGL seja bloqueado na GPU do usuário */} {webGLError && (
-

Visualizador em Modo Interativo 2D

+

Visualizador Interativo

- Seu navegador opera com aceleração gráfica limitada, mas todos os parâmetros e o cálculo de rolos e mourões continuam 100% funcionais abaixo! + Seu navegador opera com aceleração gráfica limitada, mas todos os parâmetros e o cálculo continuam 100% funcionais!

@@ -600,7 +686,7 @@ export default function FenceViewer3D() { {/* Dica de Interação */}
- Gire 360° • Aproxime para ver a malha losangular e mourões de concreto + Gire 360° • Aproxime para ver a malha de arame losangular e o rolo da fábrica
{/* Badge Inferior */} @@ -742,9 +828,9 @@ export default function FenceViewer3D() {
{[ { id: "galvanizado", label: "Galvanizado a Fogo", hex: "bg-zinc-300" }, - { id: "verde", label: "Revestido em PVC Verde", hex: "bg-emerald-800" }, + { id: "verde", label: "Revestido em PVC Verde", hex: "bg-emerald-600" }, { id: "preto", label: "Revestido em PVC Preto", hex: "bg-zinc-950 border border-zinc-700" }, - { id: "cinza", label: "Revestido em PVC Cinza", hex: "bg-zinc-600" }, + { id: "cinza", label: "Revestido em PVC Cinza", hex: "bg-zinc-500" }, ].map((c) => (
- {/* 4. Módulos na Prévia 3D */} + {/* 4. Extensão na Simulação */}
- {/* Opcionais de Segurança */} + {/* Opcionais de Fábrica */}
+ + {isCurved && (